Browse Source

Move remaining functions out of String.h and into StringUtilities.h.

Michael Ragazzon 6 years ago
parent
commit
acea973863
72 changed files with 239 additions and 324 deletions
  1. 0 2
      Cmake/FileList.cmake
  2. 1 1
      Include/RmlUi/Controls/DataFormatter.h
  3. 0 1
      Include/RmlUi/Controls/DataSource.h
  4. 1 1
      Include/RmlUi/Controls/DataSourceListener.h
  5. 1 1
      Include/RmlUi/Controls/SelectOption.h
  6. 1 1
      Include/RmlUi/Core/Animation.h
  7. 0 1
      Include/RmlUi/Core/Context.h
  8. 1 2
      Include/RmlUi/Core/Core.h
  9. 1 1
      Include/RmlUi/Core/ElementText.h
  10. 0 1
      Include/RmlUi/Core/ElementUtilities.h
  11. 1 1
      Include/RmlUi/Core/EventListenerInstancer.h
  12. 0 62
      Include/RmlUi/Core/String.h
  13. 36 20
      Include/RmlUi/Core/StringUtilities.h
  14. 1 1
      Include/RmlUi/Core/SystemInterface.h
  15. 1 1
      Include/RmlUi/Core/TypeConverter.inl
  16. 4 1
      Include/RmlUi/Core/Types.h
  17. 1 2
      Include/RmlUi/Core/URL.h
  18. 1 0
      Samples/basic/customlog/src/SystemInterface.cpp
  19. 1 1
      Samples/basic/drag/src/Inventory.h
  20. 1 0
      Samples/basic/treeview/src/FileSystem.cpp
  21. 1 1
      Samples/invaders/src/DecoratorInstancerDefender.cpp
  22. 1 1
      Samples/invaders/src/EventHandler.h
  23. 1 1
      Samples/luainvaders/src/DecoratorInstancerDefender.cpp
  24. 1 1
      Samples/shell/include/ShellFileInterface.h
  25. 1 1
      Samples/tutorial/datagrid/src/DecoratorInstancerDefender.cpp
  26. 1 1
      Samples/tutorial/datagrid_tree/src/DecoratorInstancerDefender.cpp
  27. 1 1
      Samples/tutorial/drag/src/Inventory.h
  28. 1 0
      Source/Controls/DataFormatter.cpp
  29. 0 1
      Source/Controls/InputType.h
  30. 0 1
      Source/Controls/Lua/LuaDataSource.cpp
  31. 0 1
      Source/Controls/Lua/LuaDataSource.h
  32. 0 1
      Source/Controls/WidgetDropDown.h
  33. 11 11
      Source/Controls/WidgetTextInput.cpp
  34. 0 1
      Source/Controls/WidgetTextInput.h
  35. 3 3
      Source/Core/BaseXMLParser.cpp
  36. 0 1
      Source/Core/BitmapFont/FontFaceHandle.h
  37. 0 1
      Source/Core/BitmapFont/FontFaceLayer.h
  38. 1 1
      Source/Core/BitmapFont/FontProvider.cpp
  39. 2 2
      Source/Core/DocumentHeader.cpp
  40. 1 1
      Source/Core/DocumentHeader.h
  41. 2 2
      Source/Core/Element.cpp
  42. 1 1
      Source/Core/ElementDocument.cpp
  43. 1 1
      Source/Core/ElementStyle.cpp
  44. 1 1
      Source/Core/ElementTextDefault.cpp
  45. 1 1
      Source/Core/EventDispatcher.h
  46. 4 4
      Source/Core/Factory.cpp
  47. 0 1
      Source/Core/FontFaceHandle.h
  48. 0 1
      Source/Core/FontFaceLayer.h
  49. 1 1
      Source/Core/FontProvider.cpp
  50. 0 1
      Source/Core/FreeType/FontFaceHandle.h
  51. 1 1
      Source/Core/FreeType/FontProvider.cpp
  52. 0 1
      Source/Core/LayoutInlineBoxText.h
  53. 2 2
      Source/Core/Lua/ElementText.cpp
  54. 0 1
      Source/Core/Lua/Interpreter.cpp
  55. 0 1
      Source/Core/Lua/Log.cpp
  56. 0 1
      Source/Core/Lua/LuaEventListener.h
  57. 1 1
      Source/Core/PropertyParserAnimation.cpp
  58. 1 1
      Source/Core/PropertyParserColour.cpp
  59. 1 1
      Source/Core/PropertyParserKeyword.cpp
  60. 1 1
      Source/Core/PropertySpecification.cpp
  61. 2 2
      Source/Core/StreamFile.cpp
  62. 0 125
      Source/Core/String.cpp
  63. 1 1
      Source/Core/StringCache.h
  64. 123 26
      Source/Core/StringUtilities.cpp
  65. 2 3
      Source/Core/StyleSheetParser.cpp
  66. 2 0
      Source/Core/SystemInterface.cpp
  67. 1 1
      Source/Core/TextureDatabase.cpp
  68. 1 2
      Source/Core/TextureDatabase.h
  69. 1 1
      Source/Core/XMLNodeHandlerHead.cpp
  70. 4 4
      Source/Core/XMLParser.cpp
  71. 2 0
      Source/Debugger/ElementInfo.cpp
  72. 3 1
      Source/Debugger/ElementLog.cpp

+ 0 - 2
Cmake/FileList.cmake

@@ -172,7 +172,6 @@ set(Core_PUB_HDR_FILES
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Spritesheet.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Spritesheet.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Stream.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Stream.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StreamMemory.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StreamMemory.h
-    ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/String.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StringUtilities.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StringUtilities.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheet.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheet.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheetKeywords.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheetKeywords.h
@@ -300,7 +299,6 @@ set(Core_SRC_FILES
     ${PROJECT_SOURCE_DIR}/Source/Core/Stream.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/Stream.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/StreamFile.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/StreamFile.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/StreamMemory.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/StreamMemory.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/String.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/StringCache.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/StringCache.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/StringUtilities.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/StringUtilities.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/StyleSheet.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/StyleSheet.cpp

+ 1 - 1
Include/RmlUi/Controls/DataFormatter.h

@@ -29,8 +29,8 @@
 #ifndef RMLUICONTROLSDATAFORMATTER_H
 #ifndef RMLUICONTROLSDATAFORMATTER_H
 #define RMLUICONTROLSDATAFORMATTER_H
 #define RMLUICONTROLSDATAFORMATTER_H
 
 
+#include "../Core/Types.h"
 #include "../Core/ScriptInterface.h"
 #include "../Core/ScriptInterface.h"
-#include "../Core/String.h"
 #include "Header.h"
 #include "Header.h"
 
 
 namespace Rml {
 namespace Rml {

+ 0 - 1
Include/RmlUi/Controls/DataSource.h

@@ -31,7 +31,6 @@
 
 
 #include "Header.h"
 #include "Header.h"
 #include "../Core/Types.h"
 #include "../Core/Types.h"
-#include "../Core/String.h"
 #include <list>
 #include <list>
 
 
 namespace Rml {
 namespace Rml {

+ 1 - 1
Include/RmlUi/Controls/DataSourceListener.h

@@ -30,7 +30,7 @@
 #define RMLUICONTROLSDATASOURCELISTENER_H
 #define RMLUICONTROLSDATASOURCELISTENER_H
 
 
 #include "Header.h"
 #include "Header.h"
-#include "../Core/String.h"
+#include "../Core/Types.h"
 
 
 namespace Rml {
 namespace Rml {
 namespace Controls {
 namespace Controls {

+ 1 - 1
Include/RmlUi/Controls/SelectOption.h

@@ -30,7 +30,7 @@
 #define RMLUICONTROLSSELECTOPTION_H
 #define RMLUICONTROLSSELECTOPTION_H
 
 
 #include "Header.h"
 #include "Header.h"
-#include "../Core/String.h"
+#include "../Core/Types.h"
 
 
 namespace Rml {
 namespace Rml {
 namespace Core {
 namespace Core {

+ 1 - 1
Include/RmlUi/Core/Animation.h

@@ -31,7 +31,7 @@
 #define RMLUICOREANIMATION_H
 #define RMLUICOREANIMATION_H
 
 
 
 
-#include "String.h"
+#include "Types.h"
 #include "Tween.h"
 #include "Tween.h"
 
 
 namespace Rml {
 namespace Rml {

+ 0 - 1
Include/RmlUi/Core/Context.h

@@ -33,7 +33,6 @@
 #include "Types.h"
 #include "Types.h"
 #include "Traits.h"
 #include "Traits.h"
 #include "Input.h"
 #include "Input.h"
-#include "String.h"
 #include "ScriptInterface.h"
 #include "ScriptInterface.h"
 #include "ViewState.h"
 #include "ViewState.h"
 
 

+ 1 - 2
Include/RmlUi/Core/Core.h

@@ -71,13 +71,12 @@
 #include "PropertySpecification.h"
 #include "PropertySpecification.h"
 #include "RenderInterface.h"
 #include "RenderInterface.h"
 #include "Spritesheet.h"
 #include "Spritesheet.h"
-#include "String.h"
+#include "StringUtilities.h"
 #include "StyleSheet.h"
 #include "StyleSheet.h"
 #include "StyleSheetKeywords.h"
 #include "StyleSheetKeywords.h"
 #include "StyleSheetSpecification.h"
 #include "StyleSheetSpecification.h"
 #include "SystemInterface.h"
 #include "SystemInterface.h"
 #include "Texture.h"
 #include "Texture.h"
-#include "Types.h"
 #include "Tween.h"
 #include "Tween.h"
 #include "Vertex.h"
 #include "Vertex.h"
 #include "XMLNodeHandler.h"
 #include "XMLNodeHandler.h"

+ 1 - 1
Include/RmlUi/Core/ElementText.h

@@ -30,8 +30,8 @@
 #define RMLUICOREELEMENTTEXT_H
 #define RMLUICOREELEMENTTEXT_H
 
 
 #include "Header.h"
 #include "Header.h"
+#include "Types.h"
 #include "Element.h"
 #include "Element.h"
-#include "String.h"
 
 
 namespace Rml {
 namespace Rml {
 namespace Core {
 namespace Core {

+ 0 - 1
Include/RmlUi/Core/ElementUtilities.h

@@ -31,7 +31,6 @@
 
 
 #include "Header.h"
 #include "Header.h"
 #include "Box.h"
 #include "Box.h"
-#include "String.h"
 #include "Types.h"
 #include "Types.h"
 
 
 namespace Rml {
 namespace Rml {

+ 1 - 1
Include/RmlUi/Core/EventListenerInstancer.h

@@ -30,7 +30,7 @@
 #define RMLUICOREEVENTLISTENERINSTANCER_H
 #define RMLUICOREEVENTLISTENERINSTANCER_H
 
 
 #include "Traits.h"
 #include "Traits.h"
-#include "String.h"
+#include "Types.h"
 #include "Header.h"
 #include "Header.h"
 #include "Element.h"
 #include "Element.h"
 
 

+ 0 - 62
Include/RmlUi/Core/String.h

@@ -1,62 +0,0 @@
-/*
- * This source file is part of RmlUi, the HTML/CSS Interface Middleware
- *
- * For the latest information, see http://github.com/mikke89/RmlUi
- *
- * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- */
-
-#ifndef RMLUICORESTRING_H
-#define RMLUICORESTRING_H
-
-#include "Header.h"
-#include <string>
-#include <vector>
-
-namespace Rml {
-namespace Core {
-
-typedef std::string String;
-typedef std::wstring WString;
-typedef std::vector< String > StringList;
-
-// Redefine Windows APIs as their STDC counterparts.
-#ifdef RMLUI_PLATFORM_WIN32
-	#define strcasecmp stricmp
-	#define strncasecmp strnicmp
-#endif
-
-RMLUICORE_API int FormatString(String& string, size_t max_size, const char* format, ...);
-RMLUICORE_API String CreateString(size_t max_size, const char* format, ...);
-
-RMLUICORE_API String ToLower(const String& string);
-RMLUICORE_API String Replace(String subject, const String& search, const String& replace);
-RMLUICORE_API String Replace(String subject, char search, char replace);
-
-RMLUICORE_API WString ToWideString(const String& str);
-RMLUICORE_API String ToUTF8(const WString& wstr);
-
-}
-}
-
-#endif

+ 36 - 20
Include/RmlUi/Core/StringUtilities.h

@@ -31,7 +31,6 @@
 
 
 #include "Header.h"
 #include "Header.h"
 #include "Types.h"
 #include "Types.h"
-#include "String.h"
 
 
 namespace Rml {
 namespace Rml {
 namespace Core {
 namespace Core {
@@ -41,47 +40,64 @@ namespace Core {
 	@author Lloyd Weehuizen
 	@author Lloyd Weehuizen
  */
  */
 
 
-class RMLUICORE_API StringUtilities
+// Redefine Windows APIs as their STDC counterparts.
+#ifdef RMLUI_PLATFORM_WIN32
+	#define strcasecmp stricmp
+	#define strncasecmp strnicmp
+#endif
+
+
+/// Construct a string using sprintf-style syntax.
+RMLUICORE_API String CreateString(size_t max_size, const char* format, ...);
+
+/// Format to a string using sprintf-style syntax.
+RMLUICORE_API int FormatString(String& string, size_t max_size, const char* format, ...);
+
+
+namespace StringUtilities
 {
 {
-public:
 	/// Expands character-delimited list of values in a single string to a whitespace-trimmed list
 	/// Expands character-delimited list of values in a single string to a whitespace-trimmed list
 	/// of values.
 	/// of values.
 	/// @param[out] string_list Resulting list of values.
 	/// @param[out] string_list Resulting list of values.
 	/// @param[in] string String to expand.
 	/// @param[in] string String to expand.
 	/// @param[in] delimiter Delimiter found between entries in the string list.
 	/// @param[in] delimiter Delimiter found between entries in the string list.
-	static void ExpandString(StringList& string_list, const String& string, const char delimiter = ',');
+	RMLUICORE_API void ExpandString(StringList& string_list, const String& string, const char delimiter = ',');
 	/// Expands character-delimited list of values with custom quote characters.
 	/// Expands character-delimited list of values with custom quote characters.
 	/// @param[out] string_list Resulting list of values.
 	/// @param[out] string_list Resulting list of values.
 	/// @param[in] string String to expand.
 	/// @param[in] string String to expand.
 	/// @param[in] delimiter Delimiter found between entries in the string list.
 	/// @param[in] delimiter Delimiter found between entries in the string list.
 	/// @param[in] quote_character Begin quote
 	/// @param[in] quote_character Begin quote
 	/// @param[in] unquote_character End quote
 	/// @param[in] unquote_character End quote
-	static void ExpandString(StringList& string_list, const String& string, const char delimiter, char quote_character, char unquote_character);
+	RMLUICORE_API void ExpandString(StringList& string_list, const String& string, const char delimiter, char quote_character, char unquote_character);
 	/// Joins a list of string values into a single string separated by a character delimiter.
 	/// Joins a list of string values into a single string separated by a character delimiter.
 	/// @param[out] string Resulting concatenated string.
 	/// @param[out] string Resulting concatenated string.
 	/// @param[in] string_list Input list of string values.
 	/// @param[in] string_list Input list of string values.
 	/// @param[in] delimiter Delimiter to insert between the individual values.
 	/// @param[in] delimiter Delimiter to insert between the individual values.
-	static void JoinString(String& string, const StringList& string_list, const char delimiter = ',');
+	RMLUICORE_API void JoinString(String& string, const StringList& string_list, const char delimiter = ',');
 
 
-	/// Converts a character array in UTF-8 encoding to a vector of words. The UCS-2 words will be encoded as
-	/// either big- or little-endian, depending on the host processor.
-	/// @param[in] input Input string in UTF-8 encoding.
-	/// @param[out] output Output string of UCS-2 characters.
-	/// @return True if the conversion went successfully, false if any characters had to be skipped (this will occur if they can't fit into UCS-2).
-	static bool UTF8toUCS2(const String& input, WString& output);
+	/// Converts a string in UTF-8 encoding to a wide string in UCS-2 encoding. The UCS-2 words will
+	/// be encoded as either big- or little-endian, depending on the host processor.
+	/// Reports a warning if the conversion fails.
+	RMLUICORE_API WString ToUCS2(const String& str);
 
 
-	/// Converts an array of words in UCS-2 encoding into a character array in UTF-8 encoding. This
+	/// Converts a wide string in UCS-2 encoding into a string in UTF-8 encoding. This
 	/// function assumes the endianness of the input words to be the same as the host processor.
 	/// function assumes the endianness of the input words to be the same as the host processor.
-	/// @param[in] input Input string of words in UCS-2 encoding.
-	/// @param[out] output Output string in UTF-8 encoding.
-	/// @return True if the conversion went successfully, false if not.
-	static bool UCS2toUTF8(const WString& input, String& output);
+	/// Reports a warning if the conversion fails.
+	RMLUICORE_API String ToUTF8(const WString& wstr);
+
+	/// Converts upper-case characters in string to lower-case.
+	RMLUICORE_API String ToLower(const String& string);
+
+	// Replaces all occurences of 'search' in 'subject' with 'replace'.
+	RMLUICORE_API String Replace(String subject, const String& search, const String& replace);
+	// Replaces all occurences of 'search' in 'subject' with 'replace'.
+	RMLUICORE_API String Replace(String subject, char search, char replace);
 
 
 	/// Checks if a given value is a whitespace character.
 	/// Checks if a given value is a whitespace character.
 	/// @param[in] x The character to evaluate.
 	/// @param[in] x The character to evaluate.
 	/// @return True if the character is whitespace, false otherwise.
 	/// @return True if the character is whitespace, false otherwise.
 	template < typename CharacterType >
 	template < typename CharacterType >
-	static bool IsWhitespace(CharacterType x)
+	inline bool IsWhitespace(CharacterType x)
 	{
 	{
 		return (x == '\r' || x == '\n' || x == ' ' || x == '\t');
 		return (x == '\r' || x == '\n' || x == ' ' || x == '\t');
 	}
 	}
@@ -89,14 +105,14 @@ public:
 	/// Strip whitespace characters from the beginning and end of a string.
 	/// Strip whitespace characters from the beginning and end of a string.
 	/// @param[in] string The string to trim.
 	/// @param[in] string The string to trim.
 	/// @return The stripped string.
 	/// @return The stripped string.
-	static String StripWhitespace(const String& string);
+	RMLUICORE_API String StripWhitespace(const String& string);
 
 
 	/// Operator for STL containers using strings.
 	/// Operator for STL containers using strings.
 	struct RMLUICORE_API StringComparei
 	struct RMLUICORE_API StringComparei
 	{
 	{
 		bool operator()(const String& lhs, const String& rhs) const;
 		bool operator()(const String& lhs, const String& rhs) const;
 	};
 	};
-};
+}
 
 
 }
 }
 }
 }

+ 1 - 1
Include/RmlUi/Core/SystemInterface.h

@@ -29,9 +29,9 @@
 #ifndef RMLUICORESYSTEMINTERFACE_H
 #ifndef RMLUICORESYSTEMINTERFACE_H
 #define RMLUICORESYSTEMINTERFACE_H
 #define RMLUICORESYSTEMINTERFACE_H
 
 
+#include "Types.h"
 #include "Log.h"
 #include "Log.h"
 #include "Traits.h"
 #include "Traits.h"
-#include "String.h"
 #include "Header.h"
 #include "Header.h"
 
 
 namespace Rml {
 namespace Rml {

+ 1 - 1
Include/RmlUi/Core/TypeConverter.inl

@@ -207,7 +207,7 @@ class TypeConverter< String, bool >
 public:
 public:
 	static bool Convert(const String& src, bool& dest)
 	static bool Convert(const String& src, bool& dest)
 	{
 	{
-		String lower = ToLower(src);
+		String lower = StringUtilities::ToLower(src);
 		if (lower == "1" || lower == "true")
 		if (lower == "1" || lower == "true")
 		{
 		{
 			dest = true;
 			dest = true;

+ 4 - 1
Include/RmlUi/Core/Types.h

@@ -73,7 +73,6 @@ typedef unsigned __int64 uint64_t;
 #include "Vector3.h"
 #include "Vector3.h"
 #include "Vector4.h"
 #include "Vector4.h"
 #include "Matrix4.h"
 #include "Matrix4.h"
-#include "String.h"
 
 
 namespace Rml {
 namespace Rml {
 namespace Core {
 namespace Core {
@@ -117,6 +116,10 @@ using TextureHandle = uintptr_t;
 using CompiledGeometryHandle = uintptr_t;
 using CompiledGeometryHandle = uintptr_t;
 using DecoratorDataHandle = uintptr_t;
 using DecoratorDataHandle = uintptr_t;
 
 
+// Strings
+using String = std::string;
+using WString = std::wstring;
+using StringList = std::vector< String >;
 
 
 // Smart pointer types
 // Smart pointer types
 template<typename T>
 template<typename T>

+ 1 - 2
Include/RmlUi/Core/URL.h

@@ -30,8 +30,7 @@
 #define RMLUICOREURL_H
 #define RMLUICOREURL_H
 
 
 #include "Header.h"
 #include "Header.h"
-#include "String.h"
-#include <map>
+#include "Types.h"
 
 
 namespace Rml {
 namespace Rml {
 namespace Core {
 namespace Core {

+ 1 - 0
Samples/basic/customlog/src/SystemInterface.cpp

@@ -28,6 +28,7 @@
 
 
 #include "SystemInterface.h"
 #include "SystemInterface.h"
 #include <RmlUi/Core/Platform.h>
 #include <RmlUi/Core/Platform.h>
+#include <RmlUi/Core/StringUtilities.h>
 #include <Shell.h>
 #include <Shell.h>
 #include <stdio.h>
 #include <stdio.h>
 #ifdef RMLUI_PLATFORM_WIN32
 #ifdef RMLUI_PLATFORM_WIN32

+ 1 - 1
Samples/basic/drag/src/Inventory.h

@@ -29,7 +29,7 @@
 #ifndef INVENTORY_H
 #ifndef INVENTORY_H
 #define INVENTORY_H
 #define INVENTORY_H
 
 
-#include <RmlUi/Core/String.h>
+#include <RmlUi/Core/Types.h>
 #include <RmlUi/Core/Context.h>
 #include <RmlUi/Core/Context.h>
 #include <RmlUi/Core/ElementDocument.h>
 #include <RmlUi/Core/ElementDocument.h>
 
 

+ 1 - 0
Samples/basic/treeview/src/FileSystem.cpp

@@ -27,6 +27,7 @@
  */
  */
 
 
 #include "FileSystem.h"
 #include "FileSystem.h"
+#include <RmlUi/Core/StringUtilities.h>
 #include <cstdlib>
 #include <cstdlib>
 #include <cstdio>
 #include <cstdio>
 
 

+ 1 - 1
Samples/invaders/src/DecoratorInstancerDefender.cpp

@@ -28,7 +28,7 @@
 
 
 #include "DecoratorInstancerDefender.h"
 #include "DecoratorInstancerDefender.h"
 #include <RmlUi/Core/Math.h>
 #include <RmlUi/Core/Math.h>
-#include <RmlUi/Core/String.h>
+#include <RmlUi/Core/Types.h>
 #include "DecoratorDefender.h"
 #include "DecoratorDefender.h"
 
 
 DecoratorInstancerDefender::DecoratorInstancerDefender()
 DecoratorInstancerDefender::DecoratorInstancerDefender()

+ 1 - 1
Samples/invaders/src/EventHandler.h

@@ -29,7 +29,7 @@
 #ifndef RMLUIINVADERSEVENTHANDLER_H
 #ifndef RMLUIINVADERSEVENTHANDLER_H
 #define RMLUIINVADERSEVENTHANDLER_H
 #define RMLUIINVADERSEVENTHANDLER_H
 
 
-#include <RmlUi/Core/String.h>
+#include <RmlUi/Core/Types.h>
 
 
 namespace Rml {
 namespace Rml {
 namespace Core {
 namespace Core {

+ 1 - 1
Samples/luainvaders/src/DecoratorInstancerDefender.cpp

@@ -28,7 +28,7 @@
 
 
 #include "DecoratorInstancerDefender.h"
 #include "DecoratorInstancerDefender.h"
 #include <RmlUi/Core/Math.h>
 #include <RmlUi/Core/Math.h>
-#include <RmlUi/Core/String.h>
+#include <RmlUi/Core/Types.h>
 #include "DecoratorDefender.h"
 #include "DecoratorDefender.h"
 
 
 DecoratorInstancerDefender::DecoratorInstancerDefender()
 DecoratorInstancerDefender::DecoratorInstancerDefender()

+ 1 - 1
Samples/shell/include/ShellFileInterface.h

@@ -29,7 +29,7 @@
 #ifndef SHELLFILEINTERFACE_H
 #ifndef SHELLFILEINTERFACE_H
 #define SHELLFILEINTERFACE_H
 #define SHELLFILEINTERFACE_H
 
 
-#include <RmlUi/Core/String.h>
+#include <RmlUi/Core/Types.h>
 #include <RmlUi/Core/FileInterface.h>
 #include <RmlUi/Core/FileInterface.h>
 
 
 /**
 /**

+ 1 - 1
Samples/tutorial/datagrid/src/DecoratorInstancerDefender.cpp

@@ -11,7 +11,7 @@
 
 
 #include "DecoratorInstancerDefender.h"
 #include "DecoratorInstancerDefender.h"
 #include <RmlUi/Core/Math.h>
 #include <RmlUi/Core/Math.h>
-#include <RmlUi/Core/String.h>
+#include <RmlUi/Core/Types.h>
 #include "DecoratorDefender.h"
 #include "DecoratorDefender.h"
 
 
 DecoratorInstancerDefender::DecoratorInstancerDefender()
 DecoratorInstancerDefender::DecoratorInstancerDefender()

+ 1 - 1
Samples/tutorial/datagrid_tree/src/DecoratorInstancerDefender.cpp

@@ -11,7 +11,7 @@
 
 
 #include "DecoratorInstancerDefender.h"
 #include "DecoratorInstancerDefender.h"
 #include <RmlUi/Core/Math.h>
 #include <RmlUi/Core/Math.h>
-#include <RmlUi/Core/String.h>
+#include <RmlUi/Core/Types.h>
 #include "DecoratorDefender.h"
 #include "DecoratorDefender.h"
 
 
 DecoratorInstancerDefender::DecoratorInstancerDefender()
 DecoratorInstancerDefender::DecoratorInstancerDefender()

+ 1 - 1
Samples/tutorial/drag/src/Inventory.h

@@ -1,7 +1,7 @@
 #ifndef INVENTORY_H
 #ifndef INVENTORY_H
 #define INVENTORY_H
 #define INVENTORY_H
 
 
-#include <RmlUi/Core/String.h>
+#include <RmlUi/Core/Types.h>
 #include <RmlUi/Core/Context.h>
 #include <RmlUi/Core/Context.h>
 #include <RmlUi/Core/ElementDocument.h>
 #include <RmlUi/Core/ElementDocument.h>
 
 

+ 1 - 0
Source/Controls/DataFormatter.cpp

@@ -27,6 +27,7 @@
  */
  */
 
 
 #include "../../Include/RmlUi/Controls/DataFormatter.h"
 #include "../../Include/RmlUi/Controls/DataFormatter.h"
+#include "../../Include/RmlUi/Core/StringUtilities.h"
 
 
 namespace Rml {
 namespace Rml {
 namespace Controls {
 namespace Controls {

+ 0 - 1
Source/Controls/InputType.h

@@ -29,7 +29,6 @@
 #ifndef RMLUICONTROLSINPUTTYPE_H
 #ifndef RMLUICONTROLSINPUTTYPE_H
 #define RMLUICONTROLSINPUTTYPE_H
 #define RMLUICONTROLSINPUTTYPE_H
 
 
-#include "../../Include/RmlUi/Core/String.h"
 #include "../../Include/RmlUi/Core/Event.h"
 #include "../../Include/RmlUi/Core/Event.h"
 #include "../../Include/RmlUi/Core/Types.h"
 #include "../../Include/RmlUi/Core/Types.h"
 
 

+ 0 - 1
Source/Controls/Lua/LuaDataSource.cpp

@@ -30,7 +30,6 @@
 #include "LuaDataSource.h"
 #include "LuaDataSource.h"
 #include <RmlUi/Core/Lua/Interpreter.h>
 #include <RmlUi/Core/Lua/Interpreter.h>
 #include <RmlUi/Core/Log.h>
 #include <RmlUi/Core/Log.h>
-#include <RmlUi/Core/String.h>
 
 
 using Rml::Core::Lua::Interpreter;
 using Rml::Core::Lua::Interpreter;
 using Rml::Core::Log;
 using Rml::Core::Log;

+ 0 - 1
Source/Controls/Lua/LuaDataSource.h

@@ -32,7 +32,6 @@
 #include <RmlUi/Core/Lua/LuaType.h>
 #include <RmlUi/Core/Lua/LuaType.h>
 #include <RmlUi/Core/Lua/lua.hpp>
 #include <RmlUi/Core/Lua/lua.hpp>
 #include <RmlUi/Controls/DataSource.h>
 #include <RmlUi/Controls/DataSource.h>
-#include <RmlUi/Core/String.h>
 
 
 namespace Rml {
 namespace Rml {
 namespace Controls {
 namespace Controls {

+ 0 - 1
Source/Controls/WidgetDropDown.h

@@ -29,7 +29,6 @@
 #ifndef RMLUICONTROLSWIDGETDROPDOWN_H
 #ifndef RMLUICONTROLSWIDGETDROPDOWN_H
 #define RMLUICONTROLSWIDGETDROPDOWN_H
 #define RMLUICONTROLSWIDGETDROPDOWN_H
 
 
-#include "../../Include/RmlUi/Core/String.h"
 #include "../../Include/RmlUi/Core/EventListener.h"
 #include "../../Include/RmlUi/Core/EventListener.h"
 #include "../../Include/RmlUi/Controls/SelectOption.h"
 #include "../../Include/RmlUi/Controls/SelectOption.h"
 #include <vector>
 #include <vector>

+ 11 - 11
Source/Controls/WidgetTextInput.cpp

@@ -114,7 +114,7 @@ WidgetTextInput::~WidgetTextInput()
 // Sets the value of the text field.
 // Sets the value of the text field.
 void WidgetTextInput::SetValue(const Core::String& value)
 void WidgetTextInput::SetValue(const Core::String& value)
 {
 {
-	text_element->SetText(Core::ToWideString(value));
+	text_element->SetText(Core::StringUtilities::ToUCS2(value));
 	FormatElement();
 	FormatElement();
 
 
 	UpdateRelativeCursor();
 	UpdateRelativeCursor();
@@ -128,11 +128,11 @@ void WidgetTextInput::SetMaxLength(int _max_length)
 		max_length = _max_length;
 		max_length = _max_length;
 		if (max_length >= 0)
 		if (max_length >= 0)
 		{
 		{
-			Core::WString value = Core::ToWideString( GetElement()->GetAttribute< Rml::Core::String >("value", "") );
+			Core::WString value = Core::StringUtilities::ToUCS2( GetElement()->GetAttribute< Rml::Core::String >("value", "") );
 			if ((int) value.size() > max_length)
 			if ((int) value.size() > max_length)
 			{
 			{
 				Rml::Core::String new_value;
 				Rml::Core::String new_value;
-				new_value = Core::ToUTF8(Core::WString(value.c_str(), value.c_str() + max_length));
+				new_value = Core::StringUtilities::ToUTF8(Core::WString(value.c_str(), value.c_str() + max_length));
 
 
 				GetElement()->SetAttribute("value", new_value);
 				GetElement()->SetAttribute("value", new_value);
 			}
 			}
@@ -358,7 +358,7 @@ void WidgetTextInput::ProcessEvent(Core::Event& event)
 				for (size_t i = 0; i < clipboard_text.size(); ++i)
 				for (size_t i = 0; i < clipboard_text.size(); ++i)
 				{
 				{
 					if (max_length > 0 &&
 					if (max_length > 0 &&
-						(int)Core::ToWideString(GetElement()->GetAttribute< Rml::Core::String >("value", "")).size() > max_length)
+						(int)Core::StringUtilities::ToUCS2(GetElement()->GetAttribute< Rml::Core::String >("value", "")).size() > max_length)
 						break;
 						break;
 
 
 					AddCharacter(clipboard_text[i]);
 					AddCharacter(clipboard_text[i]);
@@ -450,12 +450,12 @@ bool WidgetTextInput::AddCharacter(Rml::Core::word character)
 	if (selection_length > 0)
 	if (selection_length > 0)
 		DeleteSelection();
 		DeleteSelection();
 
 
-	Core::WString value = Core::ToWideString(GetElement()->GetAttribute< Rml::Core::String >("value", ""));
+	Core::WString value = Core::StringUtilities::ToUCS2(GetElement()->GetAttribute< Rml::Core::String >("value", ""));
 	value.insert(GetCursorIndex(), 1, character);
 	value.insert(GetCursorIndex(), 1, character);
 
 
 	edit_index += 1;
 	edit_index += 1;
 
 
-	Rml::Core::String utf8_value = Core::ToUTF8(value);
+	Rml::Core::String utf8_value = Core::StringUtilities::ToUTF8(value);
 	GetElement()->SetAttribute("value", utf8_value);
 	GetElement()->SetAttribute("value", utf8_value);
 	DispatchChangeEvent();
 	DispatchChangeEvent();
 
 
@@ -479,7 +479,7 @@ bool WidgetTextInput::DeleteCharacter(bool back)
 		return true;
 		return true;
 	}
 	}
 
 
-	Core::WString value = Core::ToWideString(GetElement()->GetAttribute< Rml::Core::String >("value", ""));
+	Core::WString value = Core::StringUtilities::ToUCS2(GetElement()->GetAttribute< Rml::Core::String >("value", ""));
 
 
 	if (back)
 	if (back)
 	{
 	{
@@ -497,7 +497,7 @@ bool WidgetTextInput::DeleteCharacter(bool back)
 		value.erase(GetCursorIndex(), 1);
 		value.erase(GetCursorIndex(), 1);
 	}
 	}
 
 
-	Rml::Core::String utf8_value = Core::ToUTF8(value);
+	Rml::Core::String utf8_value = Core::StringUtilities::ToUTF8(value);
 	GetElement()->SetAttribute("value", utf8_value);
 	GetElement()->SetAttribute("value", utf8_value);
 	DispatchChangeEvent();
 	DispatchChangeEvent();
 
 
@@ -510,7 +510,7 @@ bool WidgetTextInput::DeleteCharacter(bool back)
 void WidgetTextInput::CopySelection()
 void WidgetTextInput::CopySelection()
 {
 {
 	const Core::String& value = GetElement()->GetAttribute< Rml::Core::String >("value", "");
 	const Core::String& value = GetElement()->GetAttribute< Rml::Core::String >("value", "");
-	const Core::WString snippet = Core::ToWideString(value.substr(selection_begin_index, selection_length));
+	const Core::WString snippet = Core::StringUtilities::ToUCS2(value.substr(selection_begin_index, selection_length));
 	Core::GetSystemInterface()->SetClipboardText(snippet);
 	Core::GetSystemInterface()->SetClipboardText(snippet);
 }
 }
 
 
@@ -958,9 +958,9 @@ void WidgetTextInput::DeleteSelection()
 {
 {
 	if (selection_length > 0)
 	if (selection_length > 0)
 	{
 	{
-		const Core::WString& value = Core::ToWideString( GetElement()->GetAttribute< Rml::Core::String >("value", "") );
+		const Core::WString& value = Core::StringUtilities::ToUCS2( GetElement()->GetAttribute< Rml::Core::String >("value", "") );
 
 
-		Rml::Core::String new_value = Core::ToUTF8(Core::WString(value.substr(0, selection_begin_index) + value.substr(selection_begin_index + selection_length)));
+		Rml::Core::String new_value = Core::StringUtilities::ToUTF8(Core::WString(value.substr(0, selection_begin_index) + value.substr(selection_begin_index + selection_length)));
 		GetElement()->SetAttribute("value", new_value);
 		GetElement()->SetAttribute("value", new_value);
 
 
 		// Move the cursor to the beginning of the old selection.
 		// Move the cursor to the beginning of the old selection.

+ 0 - 1
Source/Controls/WidgetTextInput.h

@@ -31,7 +31,6 @@
 
 
 #include "../../Include/RmlUi/Core/EventListener.h"
 #include "../../Include/RmlUi/Core/EventListener.h"
 #include "../../Include/RmlUi/Core/Geometry.h"
 #include "../../Include/RmlUi/Core/Geometry.h"
-#include "../../Include/RmlUi/Core/String.h"
 #include "../../Include/RmlUi/Core/Vertex.h"
 #include "../../Include/RmlUi/Core/Vertex.h"
 
 
 namespace Rml {
 namespace Rml {

+ 3 - 3
Source/Core/BaseXMLParser.cpp

@@ -52,7 +52,7 @@ BaseXMLParser::~BaseXMLParser()
 void BaseXMLParser::RegisterCDATATag(const String& tag)
 void BaseXMLParser::RegisterCDATATag(const String& tag)
 {
 {
 	if (!tag.empty())
 	if (!tag.empty())
-		cdata_tags.insert(ToLower(tag));
+		cdata_tags.insert(StringUtilities::ToLower(tag));
 }
 }
 
 
 // Parses the given stream as an XML file, and calls the handlers when
 // Parses the given stream as an XML file, and calls the handlers when
@@ -232,7 +232,7 @@ bool BaseXMLParser::ReadOpenTag()
 	// Check if this tag needs to processed as CDATA.
 	// Check if this tag needs to processed as CDATA.
 	if (section_opened)
 	if (section_opened)
 	{
 	{
-		String lcase_tag_name = ToLower(tag_name);
+		String lcase_tag_name = StringUtilities::ToLower(tag_name);
 		if (cdata_tags.find(lcase_tag_name) != cdata_tags.end())
 		if (cdata_tags.find(lcase_tag_name) != cdata_tags.end())
 		{
 		{
 			if (ReadCDATA(lcase_tag_name.c_str()))
 			if (ReadCDATA(lcase_tag_name.c_str()))
@@ -341,7 +341,7 @@ bool BaseXMLParser::ReadCDATA(const char* terminator)
 				{
 				{
 					size_t slash_pos = tag.find('/');
 					size_t slash_pos = tag.find('/');
 					String tag_name = StringUtilities::StripWhitespace(slash_pos == String::npos ? tag : tag.substr(slash_pos + 1));
 					String tag_name = StringUtilities::StripWhitespace(slash_pos == String::npos ? tag : tag.substr(slash_pos + 1));
-					if (ToLower(tag_name) == terminator)
+					if (StringUtilities::ToLower(tag_name) == terminator)
 					{
 					{
 						data += cdata;
 						data += cdata;
 						return true;
 						return true;

+ 0 - 1
Source/Core/BitmapFont/FontFaceHandle.h

@@ -34,7 +34,6 @@
 #include "../../../Include/RmlUi/Core/FontEffect.h"
 #include "../../../Include/RmlUi/Core/FontEffect.h"
 #include "../../../Include/RmlUi/Core/FontGlyph.h"
 #include "../../../Include/RmlUi/Core/FontGlyph.h"
 #include "../../../Include/RmlUi/Core/Geometry.h"
 #include "../../../Include/RmlUi/Core/Geometry.h"
-#include "../../../Include/RmlUi/Core/String.h"
 #include "../../../Include/RmlUi/Core/Texture.h"
 #include "../../../Include/RmlUi/Core/Texture.h"
 #include "../FontFaceHandle.h"
 #include "../FontFaceHandle.h"
 #include "BitmapFontDefinitions.h"
 #include "BitmapFontDefinitions.h"

+ 0 - 1
Source/Core/BitmapFont/FontFaceLayer.h

@@ -33,7 +33,6 @@
 #include <RmlUi/Core/FontGlyph.h>
 #include <RmlUi/Core/FontGlyph.h>
 #include <RmlUi/Core/Geometry.h>
 #include <RmlUi/Core/Geometry.h>
 #include <RmlUi/Core/GeometryUtilities.h>
 #include <RmlUi/Core/GeometryUtilities.h>
-#include <RmlUi/Core/String.h>
 #include "../FontFaceLayer.h"
 #include "../FontFaceLayer.h"
 
 
 namespace Rml {
 namespace Rml {

+ 1 - 1
Source/Core/BitmapFont/FontProvider.cpp

@@ -143,7 +143,7 @@ bool BitmapFont::FontProvider::LoadFontFace(const byte* data, int data_length, c
 // Adds a loaded face to the appropriate font family.
 // Adds a loaded face to the appropriate font family.
 bool BitmapFont::FontProvider::AddFace(void* face, const String& family, Font::Style style, Font::Weight weight, bool release_stream)
 bool BitmapFont::FontProvider::AddFace(void* face, const String& family, Font::Style style, Font::Weight weight, bool release_stream)
 {
 {
-	String family_lower = ToLower(family);
+	String family_lower = StringUtilities::ToLower(family);
 	Rml::Core::FontFamily* font_family = nullptr;
 	Rml::Core::FontFamily* font_family = nullptr;
 	FontFamilyMap::iterator iterator = instance->font_families.find(family_lower);
 	FontFamilyMap::iterator iterator = instance->font_families.find(family_lower);
 	if (iterator != instance->font_families.end())
 	if (iterator != instance->font_families.end())

+ 2 - 2
Source/Core/DocumentHeader.cpp

@@ -59,9 +59,9 @@ void DocumentHeader::MergePaths(StringList& target, const StringList& source, co
 	for (size_t i = 0; i < source.size(); i++)
 	for (size_t i = 0; i < source.size(); i++)
 	{
 	{
 		String joined_path;
 		String joined_path;
-		Rml::Core::GetSystemInterface()->JoinPath(joined_path, Replace(source_path, '|', ':'), Replace(source[i], '|', ':'));
+		Rml::Core::GetSystemInterface()->JoinPath(joined_path, StringUtilities::Replace(source_path, '|', ':'), StringUtilities::Replace(source[i], '|', ':'));
 
 
-		target.push_back(Replace(joined_path, ':', '|'));
+		target.push_back(StringUtilities::Replace(joined_path, ':', '|'));
 	}
 	}
 }
 }
 
 

+ 1 - 1
Source/Core/DocumentHeader.h

@@ -29,7 +29,7 @@
 #ifndef RMLUICOREDOCUMENTHEADER_H
 #ifndef RMLUICOREDOCUMENTHEADER_H
 #define RMLUICOREDOCUMENTHEADER_H
 #define RMLUICOREDOCUMENTHEADER_H
 
 
-#include "../../Include/RmlUi/Core/String.h"
+#include "../../Include/RmlUi/Core/Types.h"
 
 
 namespace Rml {
 namespace Rml {
 namespace Core {
 namespace Core {

+ 2 - 2
Source/Core/Element.cpp

@@ -126,7 +126,7 @@ struct alignas(ElementMeta) ElementMetaChunk
 Element::Element(const String& tag) : tag(tag), relative_offset_base(0, 0), relative_offset_position(0, 0), absolute_offset(0, 0), scroll_offset(0, 0), content_offset(0, 0), content_box(0, 0), 
 Element::Element(const String& tag) : tag(tag), relative_offset_base(0, 0), relative_offset_position(0, 0), absolute_offset(0, 0), scroll_offset(0, 0), content_offset(0, 0), content_box(0, 0), 
 transform_state(), transform_state_perspective_dirty(true), transform_state_transform_dirty(true), transform_state_parent_transform_dirty(true), dirty_animation(false), dirty_transition(false)
 transform_state(), transform_state_perspective_dirty(true), transform_state_transform_dirty(true), transform_state_parent_transform_dirty(true), dirty_animation(false), dirty_transition(false)
 {
 {
-	RMLUI_ASSERT(tag == ToLower(tag));
+	RMLUI_ASSERT(tag == StringUtilities::ToLower(tag));
 	parent = nullptr;
 	parent = nullptr;
 	focus = nullptr;
 	focus = nullptr;
 	instancer = nullptr;
 	instancer = nullptr;
@@ -366,7 +366,7 @@ String Element::GetAddress(bool include_pseudo_classes, bool include_parents) co
 	String classes = style->GetClassNames();
 	String classes = style->GetClassNames();
 	if (!classes.empty())
 	if (!classes.empty())
 	{
 	{
-		classes = Replace(classes, ' ', '.');
+		classes = StringUtilities::Replace(classes, ' ', '.');
 		address += ".";
 		address += ".";
 		address += classes;
 		address += classes;
 	}
 	}

+ 1 - 1
Source/Core/ElementDocument.cpp

@@ -270,7 +270,7 @@ ElementPtr ElementDocument::CreateTextNode(const String& text)
 	}
 	}
 	
 	
 	// Set the text
 	// Set the text
-	element_text->SetText(ToWideString(text));
+	element_text->SetText(StringUtilities::ToUCS2(text));
 
 
 	return element;
 	return element;
 }
 }

+ 1 - 1
Source/Core/ElementStyle.cpp

@@ -764,7 +764,7 @@ PropertyIdSet ElementStyle::ComputeValues(Style::ComputedValues& values, const S
 			break;
 			break;
 
 
 		case PropertyId::FontFamily:
 		case PropertyId::FontFamily:
-			values.font_family = ToLower(p->Get<String>());
+			values.font_family = StringUtilities::ToLower(p->Get<String>());
 			break;
 			break;
 		case PropertyId::FontCharset:
 		case PropertyId::FontCharset:
 			values.font_charset = p->Get<String>();
 			values.font_charset = p->Get<String>();

+ 1 - 1
Source/Core/ElementTextDefault.cpp

@@ -359,7 +359,7 @@ void ElementTextDefault::OnPropertyChange(const PropertyIdSet& changed_propertie
 // Returns the RML of this element
 // Returns the RML of this element
 void ElementTextDefault::GetRML(String& content)
 void ElementTextDefault::GetRML(String& content)
 {
 {
-	content += ToUTF8(text);
+	content += StringUtilities::ToUTF8(text);
 }
 }
 
 
 // Forces a reevaluation of applicable font effects.
 // Forces a reevaluation of applicable font effects.

+ 1 - 1
Source/Core/EventDispatcher.h

@@ -29,7 +29,7 @@
 #ifndef RMLUICOREEVENTDISPATCHER_H
 #ifndef RMLUICOREEVENTDISPATCHER_H
 #define RMLUICOREEVENTDISPATCHER_H
 #define RMLUICOREEVENTDISPATCHER_H
 
 
-#include "../../Include/RmlUi/Core/String.h"
+#include "../../Include/RmlUi/Core/Types.h"
 #include "../../Include/RmlUi/Core/Event.h"
 #include "../../Include/RmlUi/Core/Event.h"
 
 
 namespace Rml {
 namespace Rml {

+ 4 - 4
Source/Core/Factory.cpp

@@ -193,7 +193,7 @@ ContextPtr Factory::InstanceContext(const String& name)
 
 
 void Factory::RegisterElementInstancer(const String& name, ElementInstancer* instancer)
 void Factory::RegisterElementInstancer(const String& name, ElementInstancer* instancer)
 {
 {
-	element_instancers[ToLower(name)] = instancer;
+	element_instancers[StringUtilities::ToLower(name)] = instancer;
 }
 }
 
 
 // Looks up the instancer for the given element
 // Looks up the instancer for the given element
@@ -288,7 +288,7 @@ bool Factory::InstanceElementText(Element* parent, const String& text)
 			return false;
 			return false;
 		}
 		}
 
 
-		text_element->SetText(ToWideString(translated_data));
+		text_element->SetText(StringUtilities::ToUCS2(translated_data));
 
 
 		// Add to active node.
 		// Add to active node.
 		parent->AppendChild(std::move(element));
 		parent->AppendChild(std::move(element));
@@ -335,7 +335,7 @@ ElementPtr Factory::InstanceDocumentStream(Rml::Core::Context* context, Stream*
 void Factory::RegisterDecoratorInstancer(const String& name, DecoratorInstancer* instancer)
 void Factory::RegisterDecoratorInstancer(const String& name, DecoratorInstancer* instancer)
 {
 {
 	RMLUI_ASSERT(instancer);
 	RMLUI_ASSERT(instancer);
-	decorator_instancers[ToLower(name)] = instancer;
+	decorator_instancers[StringUtilities::ToLower(name)] = instancer;
 }
 }
 
 
 // Retrieves a decorator instancer registered with the factory.
 // Retrieves a decorator instancer registered with the factory.
@@ -352,7 +352,7 @@ DecoratorInstancer* Factory::GetDecoratorInstancer(const String& name)
 void Factory::RegisterFontEffectInstancer(const String& name, FontEffectInstancer* instancer)
 void Factory::RegisterFontEffectInstancer(const String& name, FontEffectInstancer* instancer)
 {
 {
 	RMLUI_ASSERT(instancer);
 	RMLUI_ASSERT(instancer);
-	font_effect_instancers[ToLower(name)] = instancer;
+	font_effect_instancers[StringUtilities::ToLower(name)] = instancer;
 }
 }
 
 
 FontEffectInstancer* Factory::GetFontEffectInstancer(const String& name)
 FontEffectInstancer* Factory::GetFontEffectInstancer(const String& name)

+ 0 - 1
Source/Core/FontFaceHandle.h

@@ -35,7 +35,6 @@
 #include "../../Include/RmlUi/Core/FontEffect.h"
 #include "../../Include/RmlUi/Core/FontEffect.h"
 #include "../../Include/RmlUi/Core/FontGlyph.h"
 #include "../../Include/RmlUi/Core/FontGlyph.h"
 #include "../../Include/RmlUi/Core/Geometry.h"
 #include "../../Include/RmlUi/Core/Geometry.h"
-#include "../../Include/RmlUi/Core/String.h"
 #include "../../Include/RmlUi/Core/Texture.h"
 #include "../../Include/RmlUi/Core/Texture.h"
 
 
 namespace Rml {
 namespace Rml {

+ 0 - 1
Source/Core/FontFaceLayer.h

@@ -32,7 +32,6 @@
 #include "../../Include/RmlUi/Core/FontGlyph.h"
 #include "../../Include/RmlUi/Core/FontGlyph.h"
 #include "../../Include/RmlUi/Core/Geometry.h"
 #include "../../Include/RmlUi/Core/Geometry.h"
 #include "../../Include/RmlUi/Core/GeometryUtilities.h"
 #include "../../Include/RmlUi/Core/GeometryUtilities.h"
-#include "../../Include/RmlUi/Core/String.h"
 #include "../../Include/RmlUi/Core/Texture.h"
 #include "../../Include/RmlUi/Core/Texture.h"
 #include "TextureLayout.h"
 #include "TextureLayout.h"
 
 

+ 1 - 1
Source/Core/FontProvider.cpp

@@ -36,7 +36,7 @@ namespace Core {
 // Returns a handle to a font face that can be used to position and render text.
 // Returns a handle to a font face that can be used to position and render text.
 SharedPtr<FontFaceHandle> FontProvider::GetFontFaceHandle(const String& family, const String& charset, Font::Style style, Font::Weight weight, int size)
 SharedPtr<FontFaceHandle> FontProvider::GetFontFaceHandle(const String& family, const String& charset, Font::Style style, Font::Weight weight, int size)
 {
 {
-	RMLUI_ASSERTMSG(family == ToLower(family), "Font family name must be converted to lowercase before entering here.");
+	RMLUI_ASSERTMSG(family == StringUtilities::ToLower(family), "Font family name must be converted to lowercase before entering here.");
 	FontFamilyMap::iterator iterator = font_families.find(family);
 	FontFamilyMap::iterator iterator = font_families.find(family);
 	if (iterator == font_families.end())
 	if (iterator == font_families.end())
 		return nullptr;
 		return nullptr;

+ 0 - 1
Source/Core/FreeType/FontFaceHandle.h

@@ -34,7 +34,6 @@
 #include "../../../Include/RmlUi/Core/FontEffect.h"
 #include "../../../Include/RmlUi/Core/FontEffect.h"
 #include "../../../Include/RmlUi/Core/FontGlyph.h"
 #include "../../../Include/RmlUi/Core/FontGlyph.h"
 #include "../../../Include/RmlUi/Core/Geometry.h"
 #include "../../../Include/RmlUi/Core/Geometry.h"
-#include "../../../Include/RmlUi/Core/String.h"
 #include "../../../Include/RmlUi/Core/Texture.h"
 #include "../../../Include/RmlUi/Core/Texture.h"
 #include <ft2build.h>
 #include <ft2build.h>
 #include FT_FREETYPE_H
 #include FT_FREETYPE_H

+ 1 - 1
Source/Core/FreeType/FontProvider.cpp

@@ -191,7 +191,7 @@ bool FontProvider::LoadFontFace(const byte* data, int data_length, const String&
 // Adds a loaded face to the appropriate font family.
 // Adds a loaded face to the appropriate font family.
 bool FontProvider::AddFace(void* face, const String& family, Font::Style style, Font::Weight weight, bool release_stream)
 bool FontProvider::AddFace(void* face, const String& family, Font::Style style, Font::Weight weight, bool release_stream)
 {
 {
-	String family_lower = ToLower(family);
+	String family_lower = StringUtilities::ToLower(family);
 	FontFamily* font_family = nullptr;
 	FontFamily* font_family = nullptr;
 	FontFamilyMap::iterator iterator = font_families.find(family_lower);
 	FontFamilyMap::iterator iterator = font_families.find(family_lower);
 	if (iterator != font_families.end())
 	if (iterator != font_families.end())

+ 0 - 1
Source/Core/LayoutInlineBoxText.h

@@ -30,7 +30,6 @@
 #define RMLUICORELAYOUTINLINEBOXTEXT_H
 #define RMLUICORELAYOUTINLINEBOXTEXT_H
 
 
 #include "LayoutInlineBox.h"
 #include "LayoutInlineBox.h"
-#include "../../Include/RmlUi/Core/String.h"
 
 
 namespace Rml {
 namespace Rml {
 namespace Core {
 namespace Core {

+ 2 - 2
Source/Core/Lua/ElementText.cpp

@@ -46,7 +46,7 @@ int ElementTextGetAttrtext(lua_State* L)
 {
 {
     ElementText* obj = LuaType<ElementText>::check(L, 1);
     ElementText* obj = LuaType<ElementText>::check(L, 1);
     LUACHECKOBJ(obj);
     LUACHECKOBJ(obj);
-    lua_pushstring(L, ToUTF8(obj->GetText()).c_str());
+    lua_pushstring(L, StringUtilities::ToUTF8(obj->GetText()).c_str());
     return 1;
     return 1;
 }
 }
 
 
@@ -55,7 +55,7 @@ int ElementTextSetAttrtext(lua_State* L)
     ElementText* obj = LuaType<ElementText>::check(L, 1);
     ElementText* obj = LuaType<ElementText>::check(L, 1);
     LUACHECKOBJ(obj);
     LUACHECKOBJ(obj);
     const char* text = luaL_checkstring(L,2);
     const char* text = luaL_checkstring(L,2);
-    obj->SetText(ToWideString(text));
+    obj->SetText(StringUtilities::ToUCS2(text));
     return 0;
     return 0;
 }
 }
 
 

+ 0 - 1
Source/Core/Lua/Interpreter.cpp

@@ -30,7 +30,6 @@
 #include <RmlUi/Core/Lua/Interpreter.h>
 #include <RmlUi/Core/Lua/Interpreter.h>
 #include <RmlUi/Core/Lua/Utilities.h>
 #include <RmlUi/Core/Lua/Utilities.h>
 #include <RmlUi/Core/Log.h>
 #include <RmlUi/Core/Log.h>
-#include <RmlUi/Core/String.h>
 #include <RmlUi/Core/FileInterface.h>
 #include <RmlUi/Core/FileInterface.h>
 #include <RmlUi/Core/Lua/LuaType.h>
 #include <RmlUi/Core/Lua/LuaType.h>
 #include "LuaDocumentElementInstancer.h"
 #include "LuaDocumentElementInstancer.h"

+ 0 - 1
Source/Core/Lua/Log.cpp

@@ -29,7 +29,6 @@
 #include "precompiled.h"
 #include "precompiled.h"
 #include "Log.h"
 #include "Log.h"
 #include <RmlUi/Core/Log.h>
 #include <RmlUi/Core/Log.h>
-#include <RmlUi/Core/String.h>
 #include <RmlUi/Core/StringUtilities.h>
 #include <RmlUi/Core/StringUtilities.h>
 
 
 
 

+ 0 - 1
Source/Core/Lua/LuaEventListener.h

@@ -30,7 +30,6 @@
 #define RMLUICORELUALUAEVENTLISTENER_H
 #define RMLUICORELUALUAEVENTLISTENER_H
 
 
 #include <RmlUi/Core/EventListener.h>
 #include <RmlUi/Core/EventListener.h>
-#include <RmlUi/Core/String.h>
 #include <RmlUi/Core/Lua/lua.hpp>
 #include <RmlUi/Core/Lua/lua.hpp>
 
 
 namespace Rml {
 namespace Rml {

+ 1 - 1
Source/Core/PropertyParserAnimation.cpp

@@ -355,7 +355,7 @@ bool PropertyParserAnimation::ParseValue(Property & property, const String & val
 {
 {
 	StringList list_of_values;
 	StringList list_of_values;
 	{
 	{
-		auto lowercase_value = ToLower(value);
+		auto lowercase_value = StringUtilities::ToLower(value);
 		StringUtilities::ExpandString(list_of_values, lowercase_value, ',');
 		StringUtilities::ExpandString(list_of_values, lowercase_value, ',');
 	}
 	}
 
 

+ 1 - 1
Source/Core/PropertyParserColour.cpp

@@ -157,7 +157,7 @@ bool PropertyParserColour::ParseValue(Property& property, const String& value, c
 	else
 	else
 	{
 	{
 		// Check for the specification of an HTML colour.
 		// Check for the specification of an HTML colour.
-		ColourMap::const_iterator iterator = html_colours.find(ToLower(value));
+		ColourMap::const_iterator iterator = html_colours.find(StringUtilities::ToLower(value));
 		if (iterator == html_colours.end())
 		if (iterator == html_colours.end())
 			return false;
 			return false;
 		else
 		else

+ 1 - 1
Source/Core/PropertyParserKeyword.cpp

@@ -43,7 +43,7 @@ PropertyParserKeyword::~PropertyParserKeyword()
 // Called to parse a RCSS keyword declaration.
 // Called to parse a RCSS keyword declaration.
 bool PropertyParserKeyword::ParseValue(Property& property, const String& value, const ParameterMap& parameters) const
 bool PropertyParserKeyword::ParseValue(Property& property, const String& value, const ParameterMap& parameters) const
 {
 {
-	ParameterMap::const_iterator iterator = parameters.find(ToLower(value));
+	ParameterMap::const_iterator iterator = parameters.find(StringUtilities::ToLower(value));
 	if (iterator == parameters.end())
 	if (iterator == parameters.end())
 		return false;
 		return false;
 
 

+ 1 - 1
Source/Core/PropertySpecification.cpp

@@ -126,7 +126,7 @@ ShorthandId PropertySpecification::RegisterShorthand(const String& shorthand_nam
 		shorthand_map->AddPair(id, shorthand_name);
 		shorthand_map->AddPair(id, shorthand_name);
 
 
 	StringList property_list;
 	StringList property_list;
-	StringUtilities::ExpandString(property_list, ToLower(property_names));
+	StringUtilities::ExpandString(property_list, StringUtilities::ToLower(property_names));
 
 
 	// Construct the new shorthand definition and resolve its properties.
 	// Construct the new shorthand definition and resolve its properties.
 	UniquePtr<ShorthandDefinition> property_shorthand(new ShorthandDefinition());
 	UniquePtr<ShorthandDefinition> property_shorthand(new ShorthandDefinition());

+ 2 - 2
Source/Core/StreamFile.cpp

@@ -49,14 +49,14 @@ StreamFile::~StreamFile()
 /// Attempts to open the stream pointing at a given URL.
 /// Attempts to open the stream pointing at a given URL.
 bool StreamFile::Open(const String& path)
 bool StreamFile::Open(const String& path)
 {
 {
-	String url_safe_path = Replace(path, ':', '|');
+	String url_safe_path = StringUtilities::Replace(path, ':', '|');
 	SetStreamDetails(URL(url_safe_path), Stream::MODE_READ);
 	SetStreamDetails(URL(url_safe_path), Stream::MODE_READ);
 
 
 	if (file_handle)
 	if (file_handle)
 		Close();
 		Close();
 
 
 	// Fix the path if a leading colon has been replaced with a pipe.
 	// Fix the path if a leading colon has been replaced with a pipe.
-	String fixed_path = Replace(path, '|', ':');
+	String fixed_path = StringUtilities::Replace(path, '|', ':');
 	file_handle = GetFileInterface()->Open(fixed_path);
 	file_handle = GetFileInterface()->Open(fixed_path);
 	if (!file_handle)
 	if (!file_handle)
 	{
 	{

+ 0 - 125
Source/Core/String.cpp

@@ -1,125 +0,0 @@
-/*
- * This source file is part of RmlUi, the HTML/CSS Interface Middleware
- *
- * For the latest information, see http://github.com/mikke89/RmlUi
- *
- * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- */
-
-#include "precompiled.h"
-#include "../../Include/RmlUi/Core/String.h"
-#include <stdarg.h>
-
-namespace Rml {
-namespace Core {
-
-
-int FormatString(String& string, size_t max_size, const char* format, va_list argument_list)
-{
-	const int INTERNAL_BUFFER_SIZE = 1024;
-	static char buffer[INTERNAL_BUFFER_SIZE];
-	char* buffer_ptr = buffer;
-
-	if (max_size + 1 > INTERNAL_BUFFER_SIZE)
-		buffer_ptr = new char[max_size + 1];
-
-	int length = vsnprintf(buffer_ptr, max_size, format, argument_list);
-	buffer_ptr[length >= 0 ? length : max_size] = '\0';
-#ifdef RMLUI_DEBUG
-	if (length == -1)
-	{
-		Log::Message(Log::LT_WARNING, "String::sprintf: String truncated to %d bytes when processing %s", max_size, format);
-	}
-#endif
-
-	string = buffer_ptr;
-
-	if (buffer_ptr != buffer)
-		delete[] buffer_ptr;
-
-	return length;
-}
-
-int FormatString(String& string, size_t max_size, const char* format, ...)
-{
-	va_list argument_list;
-	va_start(argument_list, format);
-	int result = FormatString(string, (int)max_size, format, argument_list);
-	va_end(argument_list);
-	return result;
-}
-String CreateString(size_t max_size, const char* format, ...)
-{
-	String result;
-	result.reserve(max_size);
-	va_list argument_list;
-	va_start(argument_list, format);
-	FormatString(result, max_size, format, argument_list);
-	va_end(argument_list);
-	return result;
-}
-
-String ToLower(const String& string) {
-	std::string str_lower = string;
-	std::transform(str_lower.begin(), str_lower.end(), str_lower.begin(), ::tolower);
-	return str_lower;
-}
-
-WString ToWideString(const String& str)
-{
-	WString result;
-	StringUtilities::UTF8toUCS2(str, result);
-	return result;
-}
-
-String ToUTF8(const WString& wstr)
-{
-	std::string result;
-	StringUtilities::UCS2toUTF8(wstr, result);
-	return result;
-}
-
-String Replace(String subject, const String& search, const String& replace)
-{
-	size_t pos = 0;
-	while ((pos = subject.find(search, pos)) != String::npos) {
-		subject.replace(pos, search.length(), replace);
-		pos += replace.length();
-	}
-	return subject;
-}
-
-String Replace(String subject, char search, char replace)
-{
-	const size_t size = subject.size();
-	for (size_t i = 0; i < size; i++)
-	{
-		if (subject[i] == search)
-			subject[i] = replace;
-	}
-	return subject;
-}
-
-
-}
-}

+ 1 - 1
Source/Core/StringCache.h

@@ -30,7 +30,7 @@
 #ifndef RMLUICORESTRINGCACHE_H
 #ifndef RMLUICORESTRINGCACHE_H
 #define RMLUICORESTRINGCACHE_H
 #define RMLUICORESTRINGCACHE_H
 
 
-#include "../../Include/RmlUi/Core/String.h"
+#include "../../Include/RmlUi/Core/Types.h"
 
 
 namespace Rml {
 namespace Rml {
 namespace Core {
 namespace Core {

+ 123 - 26
Source/Core/StringUtilities.cpp

@@ -30,10 +30,105 @@
 #include "../../Include/RmlUi/Core/StringUtilities.h"
 #include "../../Include/RmlUi/Core/StringUtilities.h"
 #include <ctype.h>
 #include <ctype.h>
 #include <stdio.h>
 #include <stdio.h>
+#include <stdarg.h>
 
 
 namespace Rml {
 namespace Rml {
 namespace Core {
 namespace Core {
 
 
+static bool UTF8toUCS2(const String& input, WString& output);
+static bool UCS2toUTF8(const WString& input, String& output);
+
+
+static int FormatString(String& string, size_t max_size, const char* format, va_list argument_list)
+{
+	const int INTERNAL_BUFFER_SIZE = 1024;
+	static char buffer[INTERNAL_BUFFER_SIZE];
+	char* buffer_ptr = buffer;
+
+	if (max_size + 1 > INTERNAL_BUFFER_SIZE)
+		buffer_ptr = new char[max_size + 1];
+
+	int length = vsnprintf(buffer_ptr, max_size, format, argument_list);
+	buffer_ptr[length >= 0 ? length : max_size] = '\0';
+#ifdef RMLUI_DEBUG
+	if (length == -1)
+	{
+		Log::Message(Log::LT_WARNING, "FormatString: String truncated to %d bytes when processing %s", max_size, format);
+	}
+#endif
+
+	string = buffer_ptr;
+
+	if (buffer_ptr != buffer)
+		delete[] buffer_ptr;
+
+	return length;
+}
+
+int FormatString(String& string, size_t max_size, const char* format, ...)
+{
+	va_list argument_list;
+	va_start(argument_list, format);
+	int result = FormatString(string, (int)max_size, format, argument_list);
+	va_end(argument_list);
+	return result;
+}
+String CreateString(size_t max_size, const char* format, ...)
+{
+	String result;
+	result.reserve(max_size);
+	va_list argument_list;
+	va_start(argument_list, format);
+	FormatString(result, max_size, format, argument_list);
+	va_end(argument_list);
+	return result;
+}
+
+
+String StringUtilities::ToLower(const String& string) {
+	String str_lower = string;
+	std::transform(str_lower.begin(), str_lower.end(), str_lower.begin(), ::tolower);
+	return str_lower;
+}
+
+WString StringUtilities::ToUCS2(const String& str)
+{
+	WString result;
+	if (!UTF8toUCS2(str, result))
+		Log::Message(Log::LT_WARNING, "Failed to convert UTF8 string to UCS2.");
+	return result;
+}
+
+String StringUtilities::ToUTF8(const WString& wstr)
+{
+	String result;
+	if(!UCS2toUTF8(wstr, result))
+		Log::Message(Log::LT_WARNING, "Failed to convert UCS2 string to UTF8.");
+	return result;
+}
+
+String StringUtilities::Replace(String subject, const String& search, const String& replace)
+{
+	size_t pos = 0;
+	while ((pos = subject.find(search, pos)) != String::npos) {
+		subject.replace(pos, search.length(), replace);
+		pos += replace.length();
+	}
+	return subject;
+}
+
+String StringUtilities::Replace(String subject, char search, char replace)
+{
+	const size_t size = subject.size();
+	for (size_t i = 0; i < size; i++)
+	{
+		if (subject[i] == search)
+			subject[i] = replace;
+	}
+	return subject;
+}
+
+
 // Expands character-delimited list of values in a single string to a whitespace-trimmed list of values.
 // Expands character-delimited list of values in a single string to a whitespace-trimmed list of values.
 void StringUtilities::ExpandString(StringList& string_list, const String& string, const char delimiter)
 void StringUtilities::ExpandString(StringList& string_list, const String& string, const char delimiter)
 {	
 {	
@@ -150,6 +245,32 @@ void StringUtilities::JoinString(String& string, const StringList& string_list,
 }
 }
 
 
 
 
+
+// Strip whitespace characters from the beginning and end of a string.
+String StringUtilities::StripWhitespace(const String& string)
+{
+	const char* start = string.c_str();
+	const char* end = start + string.size();
+
+	while (start < end && IsWhitespace(*start))
+		start++;
+
+	while (end > start && IsWhitespace(*(end - 1)))
+		end--;
+
+	if (start < end)
+		return String(start, end);
+
+	return String();
+}
+
+// Operators for STL containers using strings.
+bool StringUtilities::StringComparei::operator()(const String& lhs, const String& rhs) const
+{
+	return strcasecmp(lhs.c_str(), rhs.c_str()) < 0;
+}
+
+
 // Defines, helper functions for the UTF8 / UCS2 conversion functions.
 // Defines, helper functions for the UTF8 / UCS2 conversion functions.
 #define _NXT	0x80
 #define _NXT	0x80
 #define _SEQ2	0xc0
 #define _SEQ2	0xc0
@@ -187,7 +308,7 @@ static int __utf8_forbidden(unsigned char octet)
 
 
 
 
 // Converts a character array in UTF-8 encoding to a vector of words.
 // Converts a character array in UTF-8 encoding to a vector of words.
-bool StringUtilities::UTF8toUCS2(const String& input, WString& output)
+static bool UTF8toUCS2(const String& input, WString& output)
 {
 {
 	if (input.empty())
 	if (input.empty())
 		return true;
 		return true;
@@ -295,7 +416,7 @@ bool StringUtilities::UTF8toUCS2(const String& input, WString& output)
 }
 }
 
 
 // Converts an array of words in UCS-2 encoding into a character array in UTF-8 encoding.
 // Converts an array of words in UCS-2 encoding into a character array in UTF-8 encoding.
-bool StringUtilities::UCS2toUTF8(const WString& input, String& output)
+static bool UCS2toUTF8(const WString& input, String& output)
 {
 {
 	unsigned char *oc;
 	unsigned char *oc;
 	size_t n;
 	size_t n;
@@ -368,29 +489,5 @@ bool StringUtilities::UCS2toUTF8(const WString& input, String& output)
 	return true;
 	return true;
 }
 }
 
 
-// Strip whitespace characters from the beginning and end of a string.
-String StringUtilities::StripWhitespace(const String& string)
-{
-	const char* start = string.c_str();
-	const char* end = start + string.size();
-	
-	while (start < end && IsWhitespace(*start))
-		start++;
-	
-	while (end > start && IsWhitespace(*(end - 1)))
-		end--;
-	
-	if (start < end)
-		return String(start, end);
-	
-	return String();
-}
-
-// Operators for STL containers using strings.
-bool StringUtilities::StringComparei::operator()(const String& lhs, const String& rhs) const
-{
-	return strcasecmp(lhs.c_str(), rhs.c_str()) < 0;
-}
-
 }
 }
 }
 }

+ 2 - 3
Source/Core/StyleSheetParser.cpp

@@ -215,7 +215,7 @@ bool StyleSheetParser::ParseKeyframeBlock(KeyframesMap& keyframes_map, const Str
 	{
 	{
 		float value = 0.0f;
 		float value = 0.0f;
 		int count = 0;
 		int count = 0;
-		rule = ToLower(rule);
+		rule = StringUtilities::ToLower(rule);
 		if (rule == "from")
 		if (rule == "from")
 			rule_values.push_back(0.0f);
 			rule_values.push_back(0.0f);
 		else if (rule == "to")
 		else if (rule == "to")
@@ -324,7 +324,7 @@ int StyleSheetParser::Parse(StyleSheetNode* node, Stream* _stream, const StyleSh
 	int rule_count = 0;
 	int rule_count = 0;
 	line_number = begin_line_number;
 	line_number = begin_line_number;
 	stream = _stream;
 	stream = _stream;
-	stream_file_name = Replace(stream->GetSourceURL().GetURL(), '|', ':');
+	stream_file_name = StringUtilities::Replace(stream->GetSourceURL().GetURL(), '|', ':');
 
 
 	enum class State { Global, AtRuleIdentifier, KeyframeBlock, Invalid };
 	enum class State { Global, AtRuleIdentifier, KeyframeBlock, Invalid };
 	State state = State::Global;
 	State state = State::Global;
@@ -501,7 +501,6 @@ bool StyleSheetParser::ParseProperties(PropertyDictionary& parsed_properties, co
 
 
 bool StyleSheetParser::ReadProperties(AbstractPropertyParser& property_parser)
 bool StyleSheetParser::ReadProperties(AbstractPropertyParser& property_parser)
 {
 {
-	const int rule_line_number = (int)line_number;
 	String name;
 	String name;
 	String value;
 	String value;
 
 

+ 2 - 0
Source/Core/SystemInterface.cpp

@@ -116,6 +116,8 @@ void SystemInterface::JoinPath(String& translated_path, const String& document_p
 		return;
 		return;
 	}
 	}
 
 
+	using StringUtilities::Replace;
+
 	// Strip off the referencing document name.
 	// Strip off the referencing document name.
 	translated_path = document_path;
 	translated_path = document_path;
 	translated_path = Replace(translated_path, '\\', '/');
 	translated_path = Replace(translated_path, '\\', '/');

+ 1 - 1
Source/Core/TextureDatabase.cpp

@@ -66,7 +66,7 @@ SharedPtr<TextureResource> TextureDatabase::Fetch(const String& source, const St
 	if (source.size() > 0 && source[0] == '?')
 	if (source.size() > 0 && source[0] == '?')
 		path = source;
 		path = source;
 	else
 	else
-		GetSystemInterface()->JoinPath(path, Replace(source_directory, '|', ':'), source);
+		GetSystemInterface()->JoinPath(path, StringUtilities::Replace(source_directory, '|', ':'), source);
 
 
 	TextureMap::iterator iterator = instance->textures.find(path);
 	TextureMap::iterator iterator = instance->textures.find(path);
 	if (iterator != instance->textures.end())
 	if (iterator != instance->textures.end())

+ 1 - 2
Source/Core/TextureDatabase.h

@@ -29,8 +29,7 @@
 #ifndef RMLUICORETEXTUREDATABASE_H
 #ifndef RMLUICORETEXTUREDATABASE_H
 #define RMLUICORETEXTUREDATABASE_H
 #define RMLUICORETEXTUREDATABASE_H
 
 
-#include "../../Include/RmlUi/Core/String.h"
-#include <map>
+#include "../../Include/RmlUi/Core/Types.h"
 
 
 namespace Rml {
 namespace Rml {
 namespace Core {
 namespace Core {

+ 1 - 1
Source/Core/XMLNodeHandlerHead.cpp

@@ -55,7 +55,7 @@ Element* XMLNodeHandlerHead::ElementStart(XMLParser* parser, const String& name,
 	else if (name == "link")
 	else if (name == "link")
 	{
 	{
 		// Lookup the type and href
 		// Lookup the type and href
-		String type = ToLower(Get<String>(attributes, "type", ""));
+		String type = StringUtilities::ToLower(Get<String>(attributes, "type", ""));
 		String href = Get<String>(attributes, "href", "");
 		String href = Get<String>(attributes, "href", "");
 
 
 		if (!type.empty() && !href.empty())
 		if (!type.empty() && !href.empty())

+ 4 - 4
Source/Core/XMLParser.cpp

@@ -64,7 +64,7 @@ XMLParser::~XMLParser()
 // Registers a custom node handler to be used to a given tag.
 // Registers a custom node handler to be used to a given tag.
 XMLNodeHandler* XMLParser::RegisterNodeHandler(const String& _tag, SharedPtr<XMLNodeHandler> handler)
 XMLNodeHandler* XMLParser::RegisterNodeHandler(const String& _tag, SharedPtr<XMLNodeHandler> handler)
 {
 {
-	String tag = ToLower(_tag);
+	String tag = StringUtilities::ToLower(_tag);
 
 
 	// Check for a default node registration.
 	// Check for a default node registration.
 	if (tag.empty())
 	if (tag.empty())
@@ -103,7 +103,7 @@ void XMLParser::PushDefaultHandler()
 
 
 bool XMLParser::PushHandler(const String& tag)
 bool XMLParser::PushHandler(const String& tag)
 {
 {
-	NodeHandlers::iterator i = node_handlers.find(ToLower(tag));
+	NodeHandlers::iterator i = node_handlers.find(StringUtilities::ToLower(tag));
 	if (i == node_handlers.end())
 	if (i == node_handlers.end())
 		return false;
 		return false;
 
 
@@ -120,7 +120,7 @@ const XMLParser::ParseFrame* XMLParser::GetParseFrame() const
 /// Called when the parser finds the beginning of an element tag.
 /// Called when the parser finds the beginning of an element tag.
 void XMLParser::HandleElementStart(const String& _name, const XMLAttributes& attributes)
 void XMLParser::HandleElementStart(const String& _name, const XMLAttributes& attributes)
 {
 {
-	const String name = ToLower(_name);
+	const String name = StringUtilities::ToLower(_name);
 
 
 	// Check for a specific handler that will override the child handler.
 	// Check for a specific handler that will override the child handler.
 	NodeHandlers::iterator itr = node_handlers.find(name);
 	NodeHandlers::iterator itr = node_handlers.find(name);
@@ -150,7 +150,7 @@ void XMLParser::HandleElementStart(const String& _name, const XMLAttributes& att
 /// Called when the parser finds the end of an element tag.
 /// Called when the parser finds the end of an element tag.
 void XMLParser::HandleElementEnd(const String& _name)
 void XMLParser::HandleElementEnd(const String& _name)
 {
 {
-	String name = ToLower(_name);
+	String name = StringUtilities::ToLower(_name);
 
 
 	// Copy the top of the stack
 	// Copy the top of the stack
 	ParseFrame frame = stack.top();
 	ParseFrame frame = stack.top();

+ 2 - 0
Source/Debugger/ElementInfo.cpp

@@ -93,6 +93,7 @@ static Core::String PrettyFormatNumbers(const Core::String& in_string)
 	return string;
 	return string;
 }
 }
 
 
+#ifdef RMLUI_DEBUG
 static bool TestPrettyFormat(Core::String original, Core::String should_be)
 static bool TestPrettyFormat(Core::String original, Core::String should_be)
 {
 {
 	Core::String formatted = PrettyFormatNumbers(original);
 	Core::String formatted = PrettyFormatNumbers(original);
@@ -101,6 +102,7 @@ static bool TestPrettyFormat(Core::String original, Core::String should_be)
 		Core::Log::Message(Core::Log::LT_ERROR, "Remove trailing string failed. PrettyFormatNumbers('%s') == '%s' != '%s'", original.c_str(), formatted.c_str(), should_be.c_str());
 		Core::Log::Message(Core::Log::LT_ERROR, "Remove trailing string failed. PrettyFormatNumbers('%s') == '%s' != '%s'", original.c_str(), formatted.c_str(), should_be.c_str());
 	return result;
 	return result;
 }
 }
+#endif
 
 
 ElementInfo::ElementInfo(const Core::String& tag) : Core::ElementDocument(tag)
 ElementInfo::ElementInfo(const Core::String& tag) : Core::ElementDocument(tag)
 {
 {

+ 3 - 1
Source/Debugger/ElementLog.cpp

@@ -129,10 +129,12 @@ bool ElementLog::Initialise()
 // Adds a log message to the debug log.
 // Adds a log message to the debug log.
 void ElementLog::AddLogMessage(Core::Log::Type type, const Core::String& message)
 void ElementLog::AddLogMessage(Core::Log::Type type, const Core::String& message)
 {
 {
+	using Core::StringUtilities::Replace;
+
 	// Add the message to the list of messages for the specified log type.
 	// Add the message to the list of messages for the specified log type.
 	LogMessage log_message;
 	LogMessage log_message;
 	log_message.index = current_index++;
 	log_message.index = current_index++;
-	log_message.message = Core::Replace(Core::Replace(Core::String(message), "<", "&lt;"), ">", "&gt;");
+	log_message.message = Replace(Replace(Core::String(message), "<", "&lt;"), ">", "&gt;");
 	log_types[type].log_messages.push_back(log_message);
 	log_types[type].log_messages.push_back(log_message);
 	if (log_types[type].log_messages.size() >= MAX_LOG_MESSAGES)
 	if (log_types[type].log_messages.size() >= MAX_LOG_MESSAGES)
 	{
 	{