diff options
author | Jaromir Wysoglad | 2019-09-05 02:51:10 +0200 |
---|---|---|
committer | Thierry Crozat | 2019-09-05 23:52:46 +0100 |
commit | 8f930126e7de6db9c22ff9f02d52564c4c99a9a8 (patch) | |
tree | bf72e404b6e282a93339d4c8074ff634b484488e /common/encoding.h | |
parent | a9be9c1453c5106fca7598bd0d7ca1e685a59539 (diff) | |
download | scummvm-rg350-8f930126e7de6db9c22ff9f02d52564c4c99a9a8.tar.gz scummvm-rg350-8f930126e7de6db9c22ff9f02d52564c4c99a9a8.tar.bz2 scummvm-rg350-8f930126e7de6db9c22ff9f02d52564c4c99a9a8.zip |
COMMON: Add string size computation to Encoding.
Diffstat (limited to 'common/encoding.h')
-rw-r--r-- | common/encoding.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/common/encoding.h b/common/encoding.h index 2b079ad962..adb61191d1 100644 --- a/common/encoding.h +++ b/common/encoding.h @@ -108,6 +108,18 @@ class Encoding { * @return Array of characters with the opposite endianity */ static char *switchEndian(const char *string, int length, int bitCount); + + /** + * Computes length (in bytes) of a string in a given encoding. + * The string must be zero ended. Similar to strlen + * (could be used instead of strlen). + * + * @param string String, which size should be computed. + * @param encoding Encoding of the string. + * + * @return Size of the string in bytes. + */ + static size_t stringLength(const char *string, const String &encoding); private: /** The encoding, which is currently being converted to */ |