aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/base/Unicode.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/base/Unicode.h')
-rw-r--r--src/lib/base/Unicode.h42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/lib/base/Unicode.h b/src/lib/base/Unicode.h
index 1391c1e..9bf83ae 100644
--- a/src/lib/base/Unicode.h
+++ b/src/lib/base/Unicode.h
@@ -18,8 +18,8 @@
#pragma once
-#include "base/String.h"
#include "common/basic_types.h"
+#include <string>
//! Unicode utility functions
/*!
@@ -36,7 +36,7 @@ public:
Returns true iff the string contains a valid sequence of UTF-8
encoded characters.
*/
- static bool isUTF8(const String&);
+ static bool isUTF8(const std::string&);
//! Convert from UTF-8 to UCS-2 encoding
/*!
@@ -44,7 +44,7 @@ public:
is set to true iff any character could not be encoded in UCS-2.
Decoding errors do not set *errors.
*/
- static String UTF8ToUCS2(const String&, bool* errors = NULL);
+ static std::string UTF8ToUCS2(const std::string&, bool* errors = NULL);
//! Convert from UTF-8 to UCS-4 encoding
/*!
@@ -52,7 +52,7 @@ public:
is set to true iff any character could not be encoded in UCS-4.
Decoding errors do not set *errors.
*/
- static String UTF8ToUCS4(const String&, bool* errors = NULL);
+ static std::string UTF8ToUCS4(const std::string&, bool* errors = NULL);
//! Convert from UTF-8 to UTF-16 encoding
/*!
@@ -60,7 +60,7 @@ public:
is set to true iff any character could not be encoded in UTF-16.
Decoding errors do not set *errors.
*/
- static String UTF8ToUTF16(const String&, bool* errors = NULL);
+ static std::string UTF8ToUTF16(const std::string&, bool* errors = NULL);
//! Convert from UTF-8 to UTF-32 encoding
/*!
@@ -68,7 +68,7 @@ public:
is set to true iff any character could not be encoded in UTF-32.
Decoding errors do not set *errors.
*/
- static String UTF8ToUTF32(const String&, bool* errors = NULL);
+ static std::string UTF8ToUTF32(const std::string&, bool* errors = NULL);
//! Convert from UTF-8 to the current locale encoding
/*!
@@ -76,42 +76,42 @@ public:
NULL then *errors is set to true iff any character could not be encoded.
Decoding errors do not set *errors.
*/
- static String UTF8ToText(const String&, bool* errors = NULL);
+ static std::string UTF8ToText(const std::string&, bool* errors = NULL);
//! Convert from UCS-2 to UTF-8
/*!
Convert from UCS-2 to UTF-8. If errors is not NULL then *errors is
set to true iff any character could not be decoded.
*/
- static String UCS2ToUTF8(const String&, bool* errors = NULL);
+ static std::string UCS2ToUTF8(const std::string&, bool* errors = NULL);
//! Convert from UCS-4 to UTF-8
/*!
Convert from UCS-4 to UTF-8. If errors is not NULL then *errors is
set to true iff any character could not be decoded.
*/
- static String UCS4ToUTF8(const String&, bool* errors = NULL);
+ static std::string UCS4ToUTF8(const std::string&, bool* errors = NULL);
//! Convert from UTF-16 to UTF-8
/*!
Convert from UTF-16 to UTF-8. If errors is not NULL then *errors is
set to true iff any character could not be decoded.
*/
- static String UTF16ToUTF8(const String&, bool* errors = NULL);
+ static std::string UTF16ToUTF8(const std::string&, bool* errors = NULL);
//! Convert from UTF-32 to UTF-8
/*!
Convert from UTF-32 to UTF-8. If errors is not NULL then *errors is
set to true iff any character could not be decoded.
*/
- static String UTF32ToUTF8(const String&, bool* errors = NULL);
+ static std::string UTF32ToUTF8(const std::string&, bool* errors = NULL);
//! Convert from the current locale encoding to UTF-8
/*!
Convert from the current locale encoding to UTF-8. If errors is not
NULL then *errors is set to true iff any character could not be decoded.
*/
- static String textToUTF8(const String&, bool* errors = NULL);
+ static std::string textToUTF8(const std::string&, bool* errors = NULL);
//@}
@@ -120,23 +120,21 @@ private:
// to the platform). caller must delete[] the returned string. the
// string is *not* nul terminated; the length (in characters) is
// returned in size.
- static wchar_t* UTF8ToWideChar(const String&,
- UInt32& size, bool* errors);
+ static wchar_t* UTF8ToWideChar(const std::string&, UInt32& size, bool* errors);
// convert nul terminated wchar_t string (in platform's native
// encoding) to UTF8.
- static String wideCharToUTF8(const wchar_t*,
- UInt32 size, bool* errors);
+ static std::string wideCharToUTF8(const wchar_t*, UInt32 size, bool* errors);
// internal conversion to UTF8
- static String doUCS2ToUTF8(const UInt8* src, UInt32 n, bool* errors);
- static String doUCS4ToUTF8(const UInt8* src, UInt32 n, bool* errors);
- static String doUTF16ToUTF8(const UInt8* src, UInt32 n, bool* errors);
- static String doUTF32ToUTF8(const UInt8* src, UInt32 n, bool* errors);
+ static std::string doUCS2ToUTF8(const UInt8* src, UInt32 n, bool* errors);
+ static std::string doUCS4ToUTF8(const UInt8* src, UInt32 n, bool* errors);
+ static std::string doUTF16ToUTF8(const UInt8* src, UInt32 n, bool* errors);
+ static std::string doUTF32ToUTF8(const UInt8* src, UInt32 n, bool* errors);
// convert characters to/from UTF8
- static UInt32 fromUTF8(const UInt8*& src, UInt32& size);
- static void toUTF8(String& dst, UInt32 c, bool* errors);
+ static UInt32 fromUTF8(const UInt8*& src, UInt32& size);
+ static void toUTF8(std::string& dst, UInt32 c, bool* errors);
private:
static UInt32 s_invalid;