UTF8String.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //
  2. // UTF8String.h
  3. //
  4. // $Id: //poco/1.4/Foundation/include/Poco/UTF8String.h#1 $
  5. //
  6. // Library: Foundation
  7. // Package: Text
  8. // Module: UTF8String
  9. //
  10. // Definition of the UTF8 string functions.
  11. //
  12. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
  13. // and Contributors.
  14. //
  15. // SPDX-License-Identifier: BSL-1.0
  16. //
  17. #ifndef Foundation_UTF8String_INCLUDED
  18. #define Foundation_UTF8String_INCLUDED
  19. #include "Poco/Foundation.h"
  20. namespace Poco {
  21. struct Foundation_API UTF8
  22. /// This class provides static methods that are UTF-8 capable variants
  23. /// of the same functions in Poco/String.h.
  24. ///
  25. /// The various variants of icompare() provide case insensitive comparison
  26. /// for UTF-8 encoded strings.
  27. ///
  28. /// toUpper(), toUpperInPlace(), toLower() and toLowerInPlace() provide
  29. /// Unicode-based character case transformation for UTF-8 encoded strings.
  30. ///
  31. /// removeBOM() removes the UTF-8 Byte Order Mark sequence (0xEF, 0xBB, 0xBF)
  32. /// from the beginning of the given string, if it's there.
  33. {
  34. static int icompare(const std::string& str, std::string::size_type pos, std::string::size_type n, std::string::const_iterator it2, std::string::const_iterator end2);
  35. static int icompare(const std::string& str1, const std::string& str2);
  36. static int icompare(const std::string& str1, std::string::size_type n1, const std::string& str2, std::string::size_type n2);
  37. static int icompare(const std::string& str1, std::string::size_type n, const std::string& str2);
  38. static int icompare(const std::string& str1, std::string::size_type pos, std::string::size_type n, const std::string& str2);
  39. static int icompare(const std::string& str1, std::string::size_type pos1, std::string::size_type n1, const std::string& str2, std::string::size_type pos2, std::string::size_type n2);
  40. static int icompare(const std::string& str1, std::string::size_type pos1, std::string::size_type n, const std::string& str2, std::string::size_type pos2);
  41. static int icompare(const std::string& str, std::string::size_type pos, std::string::size_type n, const std::string::value_type* ptr);
  42. static int icompare(const std::string& str, std::string::size_type pos, const std::string::value_type* ptr);
  43. static int icompare(const std::string& str, const std::string::value_type* ptr);
  44. static std::string toUpper(const std::string& str);
  45. static std::string& toUpperInPlace(std::string& str);
  46. static std::string toLower(const std::string& str);
  47. static std::string& toLowerInPlace(std::string& str);
  48. static void removeBOM(std::string& str);
  49. /// Remove the UTF-8 Byte Order Mark sequence (0xEF, 0xBB, 0xBF)
  50. /// from the beginning of the string, if it's there.
  51. };
  52. } // namespace Poco
  53. #endif // Foundation_UTF8String_INCLUDED