Skip to content

Commit

Permalink
COMMON: Add getEncodingName() to get the name of an encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Dec 19, 2016
1 parent a3c8387 commit b0c43e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/common/encoding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ DECLARE_SINGLETON(Common::ConversionManager)

namespace Common {

UString getEncodingName(Encoding encoding) {
if (((size_t) encoding) >= kEncodingMAX)
return "Invalid";

return kEncodingName[encoding];
}

bool hasSupportEncoding(Encoding encoding) {
return ConvMan.hasSupportTranscode(Common::kEncodingUTF8, encoding ) &&
ConvMan.hasSupportTranscode(encoding , Common::kEncodingUTF8);
Expand Down
3 changes: 3 additions & 0 deletions src/common/encoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ enum Encoding {
kEncodingMAX ///< For range checks.
};

/** Return the human readable name of an encoding. */
UString getEncodingName(Encoding encoding);

/** Do we have support for this encoding?
*
* To support an encoding, we need to be able to convert it to and from UTF-8.
Expand Down

0 comments on commit b0c43e2

Please sign in to comment.