Browse Source

WIP: Attempt to replace Rocket::String with std::string

Michael Ragazzon 6 years ago
parent
commit
e6638f1020
92 changed files with 680 additions and 1915 deletions
  1. 2 2
      Include/Rocket/Controls/DataQuery.h
  2. 25 45
      Include/Rocket/Core/String.h
  3. 0 176
      Include/Rocket/Core/StringBase.h
  4. 0 701
      Include/Rocket/Core/StringBase.inl
  5. 1 1
      Include/Rocket/Core/TransformPrimitive.h
  6. 10 10
      Include/Rocket/Core/TypeConverter.inl
  7. 1 1
      Include/Rocket/Core/Types.h
  8. 2 55
      Include/Rocket/Core/WString.h
  9. 3 3
      Samples/basic/animation/src/main.cpp
  10. 2 2
      Samples/shell/src/ShellFileInterface.cpp
  11. 1 1
      Samples/shell/src/win32/ShellWin32.cpp
  12. 4 4
      Source/Controls/Clipboard.cpp
  13. 2 2
      Source/Controls/DataFormatter.cpp
  14. 1 1
      Source/Controls/DataQuery.cpp
  15. 3 3
      Source/Controls/DataSource.cpp
  16. 3 3
      Source/Controls/DataSourceListener.cpp
  17. 11 11
      Source/Controls/ElementDataGrid.cpp
  18. 6 6
      Source/Controls/ElementDataGridRow.cpp
  19. 2 2
      Source/Controls/ElementForm.cpp
  20. 6 6
      Source/Controls/ElementFormControlDataSelect.cpp
  21. 1 1
      Source/Controls/ElementFormControlTextArea.cpp
  22. 1 1
      Source/Controls/InputTypeRange.cpp
  23. 1 1
      Source/Controls/InputTypeText.cpp
  24. 40 43
      Source/Controls/WidgetTextInput.cpp
  25. 1 1
      Source/Controls/WidgetTextInputSingleLine.cpp
  26. 1 1
      Source/Controls/WidgetTextInputSingleLinePassword.cpp
  27. 1 1
      Source/Controls/XMLNodeHandlerDataGrid.cpp
  28. 2 2
      Source/Controls/XMLNodeHandlerTabSet.cpp
  29. 17 17
      Source/Core/BaseXMLParser.cpp
  30. 1 1
      Source/Core/BitmapFont/FontFace.cpp
  31. 6 6
      Source/Core/BitmapFont/FontFaceHandle.cpp
  32. 6 6
      Source/Core/BitmapFont/FontProvider.cpp
  33. 5 5
      Source/Core/Context.cpp
  34. 4 4
      Source/Core/Core.cpp
  35. 1 1
      Source/Core/DecoratorTiledBox.cpp
  36. 1 1
      Source/Core/DecoratorTiledHorizontal.cpp
  37. 16 16
      Source/Core/DecoratorTiledInstancer.cpp
  38. 1 1
      Source/Core/DecoratorTiledVertical.cpp
  39. 13 13
      Source/Core/Dictionary.cpp
  40. 4 4
      Source/Core/DocumentHeader.cpp
  41. 16 16
      Source/Core/Element.cpp
  42. 2 2
      Source/Core/ElementAnimation.cpp
  43. 9 9
      Source/Core/ElementDefinition.cpp
  44. 4 4
      Source/Core/ElementDocument.cpp
  45. 2 2
      Source/Core/ElementHandle.cpp
  46. 4 4
      Source/Core/ElementImage.cpp
  47. 3 3
      Source/Core/ElementStyle.cpp
  48. 17 19
      Source/Core/ElementTextDefault.cpp
  49. 1 1
      Source/Core/ElementUtilities.cpp
  50. 3 3
      Source/Core/EventDispatcher.cpp
  51. 10 10
      Source/Core/Factory.cpp
  52. 1 1
      Source/Core/FileInterfaceDefault.cpp
  53. 1 1
      Source/Core/FontDatabase.cpp
  54. 1 1
      Source/Core/FontEffectInstancer.cpp
  55. 3 3
      Source/Core/FontFaceHandle.cpp
  56. 1 1
      Source/Core/FontFaceLayer.cpp
  57. 1 1
      Source/Core/FreeType/FontFace.cpp
  58. 4 4
      Source/Core/FreeType/FontFaceHandle.cpp
  59. 8 8
      Source/Core/FreeType/FontProvider.cpp
  60. 1 1
      Source/Core/LayoutInlineBoxText.cpp
  61. 3 3
      Source/Core/Log.cpp
  62. 15 15
      Source/Core/PropertyDefinition.cpp
  63. 6 6
      Source/Core/PropertyParserAnimation.cpp
  64. 10 10
      Source/Core/PropertyParserColour.cpp
  65. 7 7
      Source/Core/PropertyParserNumber.cpp
  66. 1 1
      Source/Core/PropertyParserTransform.cpp
  67. 34 34
      Source/Core/PropertySpecification.cpp
  68. 4 4
      Source/Core/Stream.cpp
  69. 3 3
      Source/Core/StreamFile.cpp
  70. 51 192
      Source/Core/String.cpp
  71. 10 10
      Source/Core/StringUtilities.cpp
  72. 2 2
      Source/Core/StyleSheet.cpp
  73. 3 3
      Source/Core/StyleSheetFactory.cpp
  74. 13 13
      Source/Core/StyleSheetNode.cpp
  75. 43 43
      Source/Core/StyleSheetParser.cpp
  76. 14 14
      Source/Core/SystemInterface.cpp
  77. 3 3
      Source/Core/Template.cpp
  78. 4 4
      Source/Core/TemplateCache.cpp
  79. 2 2
      Source/Core/TextureDatabase.cpp
  80. 5 5
      Source/Core/TextureResource.cpp
  81. 61 61
      Source/Core/URL.cpp
  82. 15 15
      Source/Core/UnicodeRange.cpp
  83. 1 1
      Source/Core/Variant.cpp
  84. 0 139
      Source/Core/WString.cpp
  85. 1 1
      Source/Core/XMLNodeHandlerBody.cpp
  86. 1 1
      Source/Core/XMLNodeHandlerDefault.cpp
  87. 6 6
      Source/Core/XMLNodeHandlerHead.cpp
  88. 1 1
      Source/Core/XMLParseTools.cpp
  89. 7 7
      Source/Core/XMLParser.cpp
  90. 46 46
      Source/Debugger/ElementInfo.cpp
  91. 6 6
      Source/Debugger/ElementLog.cpp
  92. 2 2
      Source/Debugger/Plugin.cpp

+ 2 - 2
Include/Rocket/Controls/DataQuery.h

@@ -63,7 +63,7 @@ public:
 		FieldIndices::const_iterator itr = field_indices.find(field_name);
 		if (itr == field_indices.end())
 		{
-			Rocket::Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Field %s not found in query", field_name.CString());
+			Rocket::Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Field %s not found in query", field_name.c_str());
 			return default_value;
 		}		
 		
@@ -80,7 +80,7 @@ public:
 		FieldIndices::const_iterator itr = field_indices.find(field_name);
 		if (itr == field_indices.end())
 		{
-			Rocket::Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Field %s not found in query", field_name.CString());
+			Rocket::Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Field %s not found in query", field_name.c_str());
 			return false;
 		}		
 

+ 25 - 45
Include/Rocket/Core/String.h

@@ -33,68 +33,48 @@
 #include <stdarg.h>
 #include <string.h>
 #include <vector>
+#include <string>
 
 namespace Rocket {
 namespace Core {
 
-typedef StringBase< char > String;
+//typedef StringBase< char > String;
+typedef std::string String;
 typedef std::vector< String > StringList;
 
-// Template specialisation of the constructor and FormatString() methods that use variable argument lists.
-template<>
-ROCKETCORE_API StringBase<char>::StringBase(StringBase<char>::size_type max_size, const char* fmt, ...);
-template<>
-ROCKETCORE_API int StringBase<char>::FormatString(StringBase<char>::size_type max_size, const char* fmt, ...);
-
-// Global operators for adding C strings to strings.
-ROCKETCORE_API String operator+(const char* cstring, const String& string);
-
-// partial specialization follows
-
-/* !!! CHANGING THIS METHOD BREAKS ABI COMPATIBILITY DUE TO INLINING !!! */
-template<>
-ROCKETCORE_API_INLINE bool StringBase< char >::operator<(const char * compare) const
-{
-	return strcmp( value, compare ) < 0;
-}
-
-/* !!! CHANGING THIS METHOD BREAKS ABI COMPATIBILITY DUE TO INLINING !!! */
-template<>
-ROCKETCORE_API_INLINE bool StringBase< char >::operator==(const char * compare) const
-{
-	return strcmp( value, compare ) == 0;
-}
-
-/* !!! CHANGING THIS METHOD BREAKS ABI COMPATIBILITY DUE TO INLINING !!! */
-template<>
-ROCKETCORE_API_INLINE bool StringBase< char >::operator!=(const char * compare) const
-{
-	return strcmp( value, compare ) != 0;
-}
-
 // Redefine Windows APIs as their STDC counterparts.
 #ifdef ROCKET_PLATFORM_WIN32
 	#define strcasecmp stricmp
 	#define strncasecmp strnicmp
 #endif
 
+int FormatString(String& string, size_t max_size, const char* format, ...);
+String CreateString(size_t max_size, const char* format, ...);
+
+String ToLower(const String& string);
+std::string Replace(std::string subject, const std::string& search, const std::string& replace);
+
+std::wstring ToWideString(const std::string& str);
+std::string ToUTF8(const std::wstring& wstr);
+
 struct hash_str_lowercase {
-	std::size_t operator()(const ::Rocket::Core::String& string) const
+	std::size_t operator()(const String& string) const
 	{
-		auto str_lower = string.ToLower();
-		return str_lower.Hash();
+		std::hash<String> hash_fn;
+		return hash_fn(ToLower(string));
 	}
 };
-}
-}
 
-namespace std {
-	template <> struct hash<::Rocket::Core::String> {
-		std::size_t operator()(const ::Rocket::Core::String& string) const
-		{
-			return string.Hash();
-		}
-	};
 }
+}
+//
+//namespace std {
+//	template <> struct hash<::Rocket::Core::String> {
+//		std::size_t operator()(const ::Rocket::Core::String& string) const
+//		{
+//			return string.Hash();
+//		}
+//	};
+//}
 
 #endif

+ 0 - 176
Include/Rocket/Core/StringBase.h

@@ -34,183 +34,7 @@
 namespace Rocket {
 namespace Core {
 
-/**
-	Base String Implementation
-	@author Lloyd Weehuizen
- */
-template< typename T >
-class StringBase
-{
-public:
-	typedef size_t size_type;
-	static const size_type npos = (size_type)-1;
-
-	StringBase();
-	StringBase(const StringBase& copy);
-	StringBase(const T* string);
-	StringBase(const T* string_start, const T* string_end);
-	StringBase(size_type length, const T character);
-	StringBase(size_type max_length, const T* fmt, ...);
-
-	~StringBase();
-
-	/// Is the string currently empty
-	inline bool Empty() const;
-	/// Clear the string to empty
-	void Clear();
-
-	/// The length of the string
-	inline size_type Length() const;
-	/// Get the hash value of this string
-	inline unsigned int Hash() const;
-	/// Access the string as a standard C string
-	inline const T* CString() const;
-	
-	/// Reserve space for at least this much data
-	inline void Reserve(size_type size);
-
-	/// Find the given string within this string
-	/// @param find The string to search for
-	/// @param offset Starting location of the search
-	size_type Find(const T* find, size_type offset = 0) const;
-	/// Find the given string within this string
-	/// @param find The string to search for
-	/// @param offset Starting location of the search
-	size_type Find(const StringBase<T>& find, size_type offset = 0) const;
-	/// Reverse find the given string within this string
-	/// @param find The string to search for
-	/// @param offset Starting location of the search
-	size_type RFind(const T* find, size_type offset = npos) const;
-	/// Reverse find the given string within this string
-	/// @param find The string to search for
-	/// @param offset Starting location of the search
-	size_type RFind(const StringBase<T>& find, size_type offset = npos) const;
-
-	/// Replace all occurances of the given string with another
-	/// @param find The string to search for
-	/// @param replace The string to replace it with
-	StringBase<T> Replace(const T* find, const T* replace) const;
-	/// Replace all occurances of the given string with another
-	/// @param find The string to search for
-	/// @param replace The string to replace it with
-	StringBase<T> Replace(const StringBase<T>& find, const StringBase<T>& replace) const;
-
-	/// Return a substring of this string
-	/// @param start The starting position
-	/// @param length The number of characters to copy
-	inline StringBase<T> Substring(size_type start, size_type length = StringBase<T>::npos) const;
-
-	/// Append the given string to this string
-	/// @param append The string to appen
-	/// @param count The number of characters to append
-	inline StringBase<T>& Append(const T* append, size_type count = StringBase<T>::npos);
-	/// Assign the given string to this string
-	/// @param assign The string to assign
-	/// @param count The number of characters to assign
-	inline StringBase<T>& Append(const StringBase<T>& append, size_type count = StringBase<T>::npos);
-	/// Append a single character
-	/// @param append The character to append
-	inline StringBase<T>& Append(const T& append);
-
-	/// Assign the given string to this string
-	/// @param assign The string to assign
-	/// @param length The number of characters to assign
-	inline StringBase<T>& Assign(const T* assign, size_type count = StringBase<T>::npos);
-	/// Assign the given string to this string
-	/// @param assign The string to assign
-	/// @param count The number of characters to assign
-	inline StringBase<T>& Assign(const T* assign, const T* end);
-	/// Assign the given string to this string
-	/// @param assign The string to assign
-	/// @param count The number of characters to assign
-	inline StringBase<T>& Assign(const StringBase<T>& assign, size_type count = StringBase<T>::npos);
-
-	/// Insert a string into this string
-	/// @param index Index to insert the characters
-	/// @param insert String to insert
-	/// @param count Number of characters to insert
-	inline void Insert(size_type index, const T* insert, size_type count = StringBase<T>::npos);
-	/// Insert a string into this string
-	/// @param index Index to insert the characters
-	/// @param insert String to insert
-	/// @param count Number of characters to insert
-	inline void Insert(size_type index, const StringBase<T>& insert, size_type count = StringBase<T>::npos);
-	/// Insert a character into this string
-	/// @param index Index to insert the characters
-	/// @param insert Character to insert	
-	inline void Insert(size_type index, const T& insert);
-
-	/// Erase characters from this string
-	/// @param index Index to erase the characters
-	/// @param length Number of characters to erase
-	inline void Erase(size_type index, size_type length = StringBase<T>::npos);
-
-	/// sprsize_typef style string formatting.
-	/// NOTE: This is not implemented in the base layer and requires template
-	/// specialisation of the specific string type
-	/// @param max_length Maximum length of the result
-	/// @param format The sprsize_typef style formatting
-	int FormatString(size_type max_length, const T* format, ...);
-
-	/// Resize the string to the given size, inserts space if the string is getting bigger
-	/// @param size New size
-	void Resize(size_type size);
-
-	/// Create a lowercase version of the string
-	/// @returns The lower case representation of the string
-	StringBase<T> ToLower() const;
-	/// Create a lowercase version of the string
-	/// @returns The lower case representation of the string
-	StringBase<T> ToUpper() const;
-
-	inline bool operator==(const T* compare) const;
-	inline bool operator==(const StringBase<T>& compare) const;
-
-	inline bool operator!=(const T* compare) const;
-	inline bool operator!=(const StringBase<T>& compare) const;
-
-	inline bool operator<(const T* compare) const;
-	inline bool operator<(const StringBase<T>& compare) const;
-
-	inline StringBase<T>& operator=(const T* assign);
-	inline StringBase<T>& operator=(const StringBase<T>& assign);
-
-	inline StringBase<T> operator+(const T* append) const;
-	inline StringBase<T> operator+(const StringBase<T>& append) const;
-
-	inline StringBase<T>& operator+=(const T* append);
-	inline StringBase<T>& operator+=(const StringBase<T>& append);
-	inline StringBase<T>& operator+=(const T& append);
-
-	inline const T& operator[](size_type index) const;
-	inline T& operator[](size_type index);
-
-protected:	
-
-	T* value;
-	size_type buffer_size;
-	size_type length;
-	mutable unsigned int hash;
-	static const size_type LOCAL_BUFFER_SIZE = 8;
-	char local_buffer[LOCAL_BUFFER_SIZE];
-
-	size_type GetLength(const T* string) const;
-
-	// Copies the source string to target string
-	inline void Copy(T* target, const T* src, size_type length, bool terminate = false);
 
-	// Internal implementations of the public interfaces,
-	// all these functions take the length of the const T*'s they're
-	// dealing with which *MUST* be accurate.
-	// Its up to the external interfaces to provide valid values for these functions
-	inline size_type _Find(const T* find, size_type find_length, size_type offset = 0) const;
-	inline size_type _RFind(const T* find, size_type find_length, size_type offset = 0) const;
-	inline StringBase<T> _Replace(const T* find, size_type find_length, const T* replace, size_type replace_length) const;
-	inline StringBase<T>& _Append(const T* append, size_type append_length, size_type count = StringBase<T>::npos);
-	inline StringBase<T>& _Assign(const T* assign, size_type assign_length, size_type count = StringBase<T>::npos);
-	inline void _Insert(size_type index, const T* insert, size_type insert_length, size_type count = StringBase<T>::npos);
-};
-	
 #include "StringBase.inl"
 
 }

+ 0 - 701
Include/Rocket/Core/StringBase.inl

@@ -24,704 +24,3 @@
  * THE SOFTWARE.
  *
  */
-
-template< typename T >
-StringBase< T >::StringBase() : value((T*)local_buffer), buffer_size(LOCAL_BUFFER_SIZE), length(0), hash(0)
-{
-	value[0] = 0;
-}
-
-template< typename T >
-StringBase< T >::StringBase(const StringBase< T >& copy) : value((T*)local_buffer), buffer_size(LOCAL_BUFFER_SIZE), length(0), hash(0)
-{
-	value[0] = 0;
-	*this = copy;
-}
-
-template< typename T >
-StringBase< T >::StringBase(const T* string) : value((T*)local_buffer), buffer_size(LOCAL_BUFFER_SIZE), length(0), hash(0)
-{
-	value[0] = 0;
-	*this = string;
-}
-
-template< typename T >
-StringBase< T >::StringBase(const T* string_start, const T* string_end) : value((T*)local_buffer), buffer_size(LOCAL_BUFFER_SIZE), length(0), hash(0)
-{
-	value[0] = 0;
-	length = (string_end - string_start);
-
-	if (length > 0)
-	{
-		Reserve(length);
-		Copy(value, string_start, length, true);		
-	}
-}
-
-template< typename T >
-StringBase< T >::StringBase(size_type count, const T character) : value((T*)local_buffer), buffer_size(LOCAL_BUFFER_SIZE), length(0), hash(0)
-{
-	value[0] = 0;
-	length = count;
-
-	if (length > 0)
-	{
-		Reserve(length);
-		for (size_type i = 0; i < length; i++)
-			value[i] = character;
-		value[length] = '\0';
-	}
-}
-
-template< typename T >
-StringBase< T >::StringBase(size_type ROCKET_UNUSED_PARAMETER(max_length), const T* ROCKET_UNUSED_PARAMETER(fmt), ...) : value((T*)local_buffer), buffer_size(LOCAL_BUFFER_SIZE), length(0), hash(0)
-{
-	ROCKET_UNUSED(max_length);
-	ROCKET_UNUSED(fmt);
-
-	value[0] = 0;
-	// Can't implement this at the base level, requires template specialisation
-	ROCKET_ERRORMSG("Not implemented.");
-}
-
-template< typename T >
-StringBase< T >::~StringBase()
-{
-	if (value != (T*)local_buffer)
-		free(value);
-}
-
-template< typename T >
-bool StringBase< T >::Empty() const
-{
-	return length == 0;
-}
-
-template< typename T >
-void StringBase< T >::Clear()
-{
-	if (value != (T*)local_buffer)
-		free(value);
-
-	length = 0;
-	hash = 0;
-	value = (T*)local_buffer;
-	value[0] = 0;
-	buffer_size = LOCAL_BUFFER_SIZE;
-}
-
-template< typename T >
-typename StringBase< T >::size_type StringBase< T >::Length() const
-{
-	return length;
-}
-
-template< typename T >
-unsigned int StringBase< T >::Hash() const
-{
-	if (hash == 0 && length > 0)
-	{
-		// FNV-1 hash algorithm
-		unsigned char* bp = (unsigned char *)value;	// start of buffer
-		unsigned char* be = (unsigned char *)value + (length * sizeof(T));
-		
-		// FNV-1a hash each octet in the buffer
-		while (bp < be) 
-		{
-			// xor the bottom with the current octet
-			hash ^= *bp++;
-			
-			/* multiply by the 32 bit FNV magic prime mod 2^32 */
-			#if !defined(__GNUC__)
-				const unsigned int FNV_32_PRIME = ((unsigned int)16777619);
-				hash *= FNV_32_PRIME;
-			#else
-				hash += (hash<<1) + (hash<<4) + (hash<<7) + (hash<<8) + (hash<<24);
-			#endif
-		}
-	}
-	return hash;
-}
-
-template< typename T >
-const T* StringBase< T >::CString() const
-{
-	return value;
-}
-
-template< typename T >
-void StringBase< T >::Reserve(size_type size)
-{
-	size_type new_size = (size + 1) * sizeof(T);
-	
-	if (buffer_size >= new_size)
-		return;
-	
-	// Pad out to a block of 16 bytes
-	const int BLOCK_SIZE = 16;
-	new_size = (new_size+BLOCK_SIZE-1)&(~(BLOCK_SIZE-1));
-	
-	if (value == (T*)local_buffer)
-	{
-		T* new_value = (T*)realloc(NULL, new_size);
-		ROCKET_ASSERTMSG(new_value, "Could not reserve memory for String, realloc failed.");
-		if(new_value != NULL)
-		{
-			buffer_size = new_size;
-			Copy(new_value, (T*)local_buffer, LOCAL_BUFFER_SIZE / sizeof(T));
-			value = new_value;
-		}
-	}
-	else
-	{
-		T* new_value = (T*)realloc(value, new_size);
-		ROCKET_ASSERTMSG(new_value, "Could not reserve memory for String, realloc failed.");
-		if(new_value != NULL)
-		{
-			buffer_size = new_size;
-			value = new_value;
-		}
-	}
-}
-
-template< typename T >
-typename StringBase< T >::size_type StringBase< T >::Find(const T* find, size_type offset) const
-{
-	return _Find(find, GetLength(find), offset);	
-}
-
-template< typename T >
-typename StringBase< T >::size_type StringBase< T >::Find(const StringBase< T >& find, size_type offset) const
-{
-	return _Find(find.CString(), find.Length(), offset);
-}
-
-template< typename T >
-typename StringBase< T >::size_type StringBase< T >::RFind(const T* find, size_type offset) const
-{
-	return _RFind(find, GetLength(find), offset);	
-}
-
-template< typename T >
-typename StringBase< T >::size_type StringBase< T >::RFind(const StringBase< T >& find, size_type offset) const
-{
-	return _RFind(find.CString(), find.Length(), offset);
-}
-
-template< typename T >
-StringBase< T > StringBase< T >::Replace(const T* find, const T* replace) const
-{
-	return _Replace(find, GetLength(find), replace, GetLength(replace));
-}
-
-template< typename T >
-StringBase< T > StringBase< T >::Replace(const StringBase< T >& find, const StringBase< T >& replace) const
-{
-	return _Replace(find.CString(), find.Length(), replace.CString(), replace.Length());
-}
-
-template< typename T >
-StringBase< T > StringBase< T >::Substring(size_type start, size_type count) const
-{	
-	// Ensure we're not going of bounds
-	if (count > length - start)
-		count = length - start;
-
-	if (start > length)
-		count = 0;
-
-	return StringBase< T >(&value[start], &value[start + count]);
-}
-
-template< typename T >
-StringBase< T >& StringBase< T >::Append(const T* append, size_type count)
-{
-	return _Append(append, GetLength(append), count);
-}
-
-template< typename T >
-StringBase< T >& StringBase< T >::Append(const StringBase< T >& append, size_type count)
-{
-	return _Append(append.CString(), append.Length(), count);
-}
-
-template< typename T >
-StringBase< T >& StringBase< T >::Append(const T& append)
-{
-	T buffer[2] = { append, 0 };
-	return (*this += buffer);
-}
-
-template< typename T >
-StringBase< T >& StringBase< T >::Assign(const T* assign, size_type count)
-{
-	size_type assign_length = GetLength(assign);
-	return _Assign(assign, count > assign_length ? assign_length : count);
-}
-
-template< typename T >
-StringBase< T >& StringBase< T >::Assign(const T* assign, const T* end)
-{	
-	return _Assign(assign, end - assign);
-}
-
-template< typename T >
-StringBase< T >& StringBase< T >::Assign(const StringBase< T >& assign, size_type count)
-{
-	return _Assign(assign.CString(), assign.length, count);
-}
-
-// Insert a string into this string
-template< typename T >
-void StringBase< T >::Insert(size_type index, const T* insert, size_type count)
-{
-	return _Insert(index, insert, GetLength(insert), count);
-}
-
-// Insert a string into this string
-template< typename T >
-void StringBase< T >::Insert(size_type index, const StringBase< T >& insert, size_type count)
-{
-	return _Insert(index, insert.value, insert.length, count);
-}
-
-// Insert a character into this string
-template< typename T >
-void StringBase< T >::Insert(size_type index, const T& insert)
-{
-	return _Insert(index, &insert, 1, 1);
-}
-
-/// Erase characters from this string
-template< typename T >
-void StringBase< T >::Erase(size_type index, size_type count)
-{
-	if (index >= length)
-		return;
-
-	if (count == npos)
-	{
-		Resize(index);
-	}
-	else
-	{
-		size_type erase_amount = count < length - index ? count : length - index;
-			
-		Copy(&value[index], &value[index + erase_amount], length - index - erase_amount, true);		
-
-		length -= erase_amount;
-
-		if (length == 0)
-			Clear();
-	}
-}
-
-template< typename T >
-int StringBase< T >::FormatString(size_type ROCKET_UNUSED_PARAMETER(max_length), const T* ROCKET_UNUSED_PARAMETER(fmt), ...)
-{
-	ROCKET_UNUSED(max_length);
-	ROCKET_UNUSED(fmt);
-
-	ROCKET_ERRORMSG("Not implemented.");
-	return -1;
-}
-
-template< typename T >
-void StringBase< T >::Resize(size_type new_length)
-{
-	Reserve(new_length);
-	length = new_length;
-	value[length] = '\0';
-
-	if (length == 0)
-		Clear();
-}
-
-// Create a lowercase version of the string
-template< typename T >
-StringBase< T > StringBase< T >::ToLower() const
-{
-	// Loop through the string, looking for an uppercase character
-	size_t copy_index = npos;
-	for (size_t i = 0; i < length; i++)
-	{
-		if (value[i] >= 'A' && value[i] <= 'Z')
-		{
-			copy_index = i;
-			break;
-		}
-	}
-
-	// If theres no lowercase letters, simply copy us direct
-	if (copy_index == npos)
-		return StringBase< T >(*this);
-
-	StringBase< T > lowercase(CString(), CString() + copy_index);
-	// Otherwise trawl through the rest of the letters
-	for (size_t i = copy_index; i < length; i++)
-	{
-		if (value[i] >= 'A' && value[i] <= 'Z')
-			lowercase.Append((T)(value[i] + ('a' - 'A')));
-		else
-			lowercase.Append(value[i]);
-	}
-
-	return lowercase;
-}
-
-// Create a lowercase version of the string
-template< typename T >
-StringBase< T > StringBase< T >::ToUpper() const
-{
-	// Loop through the string, looking for an lowercase character
-	size_t copy_index = npos;
-	for (size_t i = 0; i < length; i++)
-	{
-		if (value[i] >= 'a' && value[i] <= 'z')
-		{
-			copy_index = i;
-			break;
-		}
-	}
-
-	// If theres no lowercase letters, simply copy us direct
-	if (copy_index == npos)
-		return StringBase< T >(*this);
-
-	StringBase< T > uppercase(CString(), CString() + copy_index);
-	// Otherwise trawl through the rest of the letters
-	for (size_t i = copy_index; i < length; i++)
-	{
-		if (value[i] >= 'a' && value[i] <= 'z')
-			uppercase.Append((T)(value[i] - ('a' - 'A')));
-		else
-			uppercase.Append(value[i]);
-	}
-
-	return uppercase;
-}
-
-template< typename T >
-bool StringBase< T >::operator==(const T* compare) const
-{
-	size_type index = 0;
-	
-	while (index < length && compare[index] == value[index])
-		index++;
-
-	return index == length && compare[index] == '\0';	
-}
-
-template< typename T >
-bool StringBase< T >::operator==(const StringBase< T >& compare) const
-{
-	if (length != compare.length)
-		return false;
-	
-	if (Hash() != compare.Hash())
-		return false;
-		
-	return (*this) == compare.value;
-}
-
-template< typename T >
-bool StringBase< T >::operator!=(const T* compare) const
-{
-	return !(*this == compare);
-}
-
-template< typename T >
-bool StringBase< T >::operator!=(const StringBase< T >& compare) const
-{
-	return !(*this == compare);
-}
-
-template< typename T >
-bool StringBase< T >::operator<(const T* compare) const
-{
-	size_type index = 0;
-	while (index < length && compare[index] == value[index])
-		index++;
-
-	// Check if we reached the end of the string
-	if (index < length)
-	{
-		// If we didn't check if we reached the end of
-		// the string we're comparing against, if so
-		// then we're not less than
-		if (compare[index] == 0)
-			return false;
-
-		// Check the character at index
-		return value[index] < compare[index];
-	}
-	else
-	{
-		// We reached the end of our string,
-		// if the string we're comparing with still
-		// has data, then we're smaller
-		if (compare[index] != 0)
-			return true;		
-	}
-
-	return false;
-}
-
-template< typename T >
-bool StringBase< T >::operator<(const StringBase< T >& compare) const
-{
-	return *this < compare.CString();
-}
-
-template< typename T >
-StringBase< T >& StringBase< T >::operator=(const T* assign)
-{
-	return Assign(assign);
-}
-
-template< typename T >
-StringBase< T >& StringBase< T >::operator=(const StringBase< T >& assign)
-{	
-	StringBase< T >&out = Assign(assign);
-	out.hash = assign.hash;
-	return out;
-}
-
-template< typename T >
-StringBase< T > StringBase< T >::operator+(const T* add) const
-{	
-	StringBase< T > combined(*this);
-	combined.Append(add);	
-	
-	return combined;
-}
-
-template< typename T >
-StringBase< T > StringBase< T >::operator+(const StringBase< T >& add) const
-{	
-	StringBase< T > combined(*this);
-	combined.Append(add);	
-	
-	return combined;
-}
-
-template< typename T >
-StringBase< T >& StringBase< T >::operator+=(const T* add)
-{	
-	return Append(add);
-}
-
-template< typename T >
-StringBase< T >& StringBase< T >::operator+=(const StringBase< T >& add)
-{	
-	return _Append(add.CString(), add.length);
-}
-
-template< typename T >
-StringBase< T >& StringBase< T >::operator+=(const T& add)
-{	
-	return Append(add);
-}
-
-template< typename T >
-const T& StringBase< T >::operator[](size_type index) const
-{
-	ROCKET_ASSERT(index < length);
-	return value[index];
-}
-
-template< typename T >
-T& StringBase< T >::operator[](size_type index)
-{
-	ROCKET_ASSERT(index < length);
-	return value[index];
-}
-
-template< typename T >
-typename StringBase< T >::size_type StringBase< T >::GetLength(const T* string) const
-{	
-	const T* ptr = string;
-
-	while (*ptr)
-	{
-		ptr++;		
-	}
-
-	return ptr - string;
-}
-
-template< typename T >
-void StringBase< T >::Copy(T* target, const T* src, size_type length, bool terminate)
-{
-	// Copy values
-	for (size_type i = 0; i < length; i++)
-	{
-		*target++ = *src++;
-	}
-	
-	if (terminate)
-	{		
-		*target++ = 0;		
-	}
-}
-
-template< typename T >
-typename StringBase< T >::size_type StringBase< T >::_Find(const T* find, size_type find_length, size_type offset) const
-{
-	size_type needle_index = 0;	
-	size_type haystack_index = offset;
-
-	// If the find length is greater than the string we have, it can't be here
-	if (find_length > length)
-		return npos;
-
-	// While there's still data in the haystack loop
-	while (value[haystack_index])
-	{
-		// If the current haystack posize_typeer plus needle offset matches,
-		// advance the needle index
-		if (value[haystack_index + needle_index] == find[needle_index])
-		{
-			needle_index++;
-
-			// If we reach the end of the search term, return the current haystack index
-			if (needle_index == find_length)
-				return haystack_index;
-		}
-		else		
-		{
-			// Advance haystack index by one and reset needle index.
-			haystack_index++;
-			needle_index = 0;
-		}
-	}
-
-	return npos;
-}
-
-template< typename T >
-typename StringBase< T >::size_type StringBase< T >::_RFind(const T* find, size_type find_length, size_type offset) const
-{
-	ROCKET_ASSERT(find_length > 0);
-
-	size_type needle_index = 0;	
-	size_type haystack_index = (offset < length ? offset : length) - find_length;
-
-	// If the find length is greater than the string we have, it can't be here
-	if (find_length > length)
-		return npos;
-
-	// While theres still data in the haystack loop
-	for (;;)
-	{
-		// If the current haystack index plus needle offset matches,
-		// advance the needle index
-		if (value[haystack_index + needle_index] == find[needle_index])
-		{
-			needle_index++;
-
-			// If we reach the end of the search term, return the current haystack index
-			if (find[needle_index] == 0)
-				return haystack_index;
-		}
-		else		
-		{
-			if (haystack_index == 0)
-				return npos;
-
-			// Advance haystack index backwards
-			haystack_index--;
-			needle_index = 0;
-		}
-	}
-}
-
-template< typename T >
-StringBase< T > StringBase< T >::_Replace(const T* find, size_type find_length, const T* replace, size_type replace_length) const
-{
-	StringBase< T > result;
-
-	size_type offset = 0;	
-	// Loop until we reach the end of the string
-	while (offset < Length())
-	{
-		// Look for the next search term
-		size_type pos = _Find(find, find_length, offset);
-
-		// Term not found, add remainder and return
-		if (pos == npos)
-			return result + (Substring(offset).CString());
-
-		// Add the unchanged text and replacement after it
-		result += Substring(offset, pos - offset);
-		result._Append(replace, replace_length);
-
-		// Advance the find position
-		offset = pos + find_length;
-	}
-	
-	hash = 0;
-
-	return result;
-}
-
-template< typename T >
-StringBase< T >& StringBase< T >::_Append(const T* append, size_type append_length, size_type count)
-{	
-	size_type add_length = count < append_length ? count : append_length;
-
-	if (add_length == 0)
-		return *this;
-
-	Reserve(length + add_length);
-	Copy(&value[length], append, add_length, true);
-	length += add_length;
-	
-	hash = 0;
-	
-	return *this;
-}
-
-template< typename T >
-StringBase< T >& StringBase< T >::_Assign(const T* assign, size_type assign_length, size_type count)
-{		
-	size_type new_length = count < assign_length ? count : assign_length;
-
-	if (new_length == 0)
-	{
-		Clear();
-	}
-	else
-	{
-		Reserve(new_length);
-		Copy(value, assign, new_length, true);
-	}
-
-	length = new_length;
-	
-	hash = 0;
-	
-	return *this;
-}
-
-template< typename T >
-void StringBase< T >::_Insert(size_type index, const T* insert, size_type insert_length, size_type count)
-{
-	if (index >= length)
-	{
-		Append(insert, count);
-		return;
-	}
-	
-	size_type add_length = count < insert_length ? count : insert_length;
-
-	Reserve(length + add_length);
-	
-	for (size_type i = length + 1; i > index; i--)
-		value[i + add_length - 1] = value[i - 1];
-
-	Copy(&value[index], insert, add_length);
-	length += add_length;
-	
-	hash = 0;
-}

+ 1 - 1
Include/Rocket/Core/TransformPrimitive.h

@@ -335,7 +335,7 @@ inline String ResolvedPrimitive<N>::ToString(String unit, bool rad_to_deg, bool
 	for (size_t i = 0; i < N; i++) {
 		if (TypeConverter<float, String>::Convert(values[i] * multiplier, tmp))
 			result += tmp;
-		if (!unit.Empty() && (!only_unit_on_last_value || (i == N - 1)))
+		if (!unit.empty() && (!only_unit_on_last_value || (i == N - 1)))
 			result += unit;
 		if (i != N - 1) result += ", ";
 	}

+ 10 - 10
Include/Rocket/Core/TypeConverter.inl

@@ -163,7 +163,7 @@ class TypeConverter< String, type > \
 public: \
 	static bool Convert(const String& src, type& dest) \
 	{ \
-		dest = (type) atof(src.CString()); \
+		dest = (type) atof(src.c_str()); \
 		return true; \
 	} \
 };
@@ -176,7 +176,7 @@ class TypeConverter< String, int >
 public:
 	static bool Convert(const String& src, int& dest)
 	{
-		return sscanf(src.CString(), "%d", &dest) == 1;
+		return sscanf(src.c_str(), "%d", &dest) == 1;
 	}
 };
 
@@ -186,7 +186,7 @@ class TypeConverter< String, unsigned int >
 public:
 	static bool Convert(const String& src, unsigned int& dest)
 	{
-		return sscanf(src.CString(), "%u", &dest) == 1;
+		return sscanf(src.c_str(), "%u", &dest) == 1;
 	}
 };
 
@@ -197,7 +197,7 @@ public:
 	static bool Convert(const String& src, byte& dest)
 	{
 		int value;
-		bool ret = sscanf(src.CString(), "%d", &value) == 1;
+		bool ret = sscanf(src.c_str(), "%d", &value) == 1;
 		dest = (byte) value;
 		return ret && (value <= 255);
 	}
@@ -209,7 +209,7 @@ class TypeConverter< String, bool >
 public:
 	static bool Convert(const String& src, bool& dest)
 	{
-		String lower = src.ToLower();
+		String lower = ToLower(src);
 		if (lower == "1" || lower == "true")
 		{
 			dest = true;
@@ -284,7 +284,7 @@ class TypeConverter< type, String > \
 public: \
 	static bool Convert(const type& src, String& dest) \
 	{ \
-		return dest.FormatString(32, "%.4f", src) > 0; \
+		return FormatString(dest, 32, "%.4f", src) > 0; \
 	} \
 };
 FLOAT_STRING_CONVERTER(float);
@@ -296,7 +296,7 @@ class TypeConverter< int, String >
 public:
 	static bool Convert(const int& src, String& dest)
 	{
-		return dest.FormatString(32, "%d", src) > 0;
+		return FormatString(dest, 32, "%d", src) > 0;
 	}
 };
 
@@ -306,7 +306,7 @@ class TypeConverter< unsigned int, String >
 public:
 	static bool Convert(const unsigned int& src, String& dest)
 	{
-		return dest.FormatString(32, "%u", src) > 0;
+		return FormatString(dest, 32, "%u", src) > 0;
 	}
 };
 
@@ -316,7 +316,7 @@ class TypeConverter< byte, String >
 public:
 	static bool Convert(const byte& src, String& dest)
 	{
-		return dest.FormatString(32, "%u", src) > 0;
+		return FormatString(dest, 32, "%u", src) > 0;
 	}
 };
 
@@ -385,7 +385,7 @@ public:
 			if (TypeConverter< float, String >::Convert(t.duration, tmp)) dest += tmp + "s ";
 			if (t.delay > 0.0f && TypeConverter< float, String >::Convert(t.delay, tmp)) dest += tmp + "s ";
 			if (t.reverse_adjustment_factor > 0.0f && TypeConverter< float, String >::Convert(t.delay, tmp)) dest += tmp;
-			if (dest.Length() > 0) dest.Resize(dest.Length() - 1);
+			if (dest.size() > 0) dest.resize(dest.size() - 1);
 			if (i != src.transitions.size() - 1) dest += ", ";
 		}
 		return true;

+ 1 - 1
Include/Rocket/Core/Types.h

@@ -51,7 +51,7 @@ namespace Core {
 
 // Define commonly used basic types.
 typedef unsigned char byte;
-typedef unsigned short word;
+typedef wchar_t word;
 typedef double Time;
 typedef float TimeDelta;
 typedef unsigned int Hash;

+ 2 - 55
Include/Rocket/Core/WString.h

@@ -30,65 +30,12 @@
 
 #include "Types.h"
 #include "Header.h"
+#include <string>
 
 namespace Rocket {
 namespace Core {
 
-typedef StringBase< word > WStringBase;
-
-/**
-	Stores a string of characters encoded in UCS-2 format (UTF-16 without support for supplementary characters).
-
-	@author Peter Curry
- */
-
-class ROCKETCORE_API WString : public WStringBase
-{
-public:
-	/// Constructs an empty string.
-	WString();
-
-	/// Constructs a string as a copy of another UCS-2 string.
-	WString(const WStringBase& ucs2_string);
-	/// Constructs a string from a sequence of UCS-2 encoded characters.
-	WString(const word* ucs2_string_begin, const word* ucs2_string_end);
-	/// Constructs a string from multiples of a UCS-2 encoded character.
-	WString(WStringBase::size_type count, word ucs2_char);
-
-	/// Constructs a string from a null-terminated sequence of UTF-8 encoded characters.
-	WString(const char* utf8_string);
-	/// Constructs a string from a sequence of UTF-8 encoded characters.
-	WString(const char* utf8_string_begin, const char* utf8_string_end);
-	/// Constructs a string from a sequence of UTF-8 encoded characters.
-	WString(const String& utf8_string);
-
-	/// Destroys the string.
-	~WString();
-
-	/// Converts the string to UTF-8 encoding.
-	String& ToUTF8(String& utf8_string, bool append = false) const;
-
-	/// Assigns a UCS-2 string to this string.
-	WString& operator=(const WStringBase& string);
-	/// Assigns a UCS-2 string to this string.
-	WString& operator=(const WString& string);
-	/// Assigns a null-terminated UCS-2 string to this string.
-	WString& operator=(const word* string);
-	/// Converts a UTF-8 encoded string into UCS-2 and assigns it to this string.
-	WString& operator=(const char* string);
-
-	/// Checks equality between two UCS-2 encoded strings.
-	bool operator==(const WString& string) const;
-	/// Checks equality between this string and another string in UTF-8 encoding.
-	bool operator==(const char* string) const;
-
-	WStringBase::size_type Find(const WString& s, WStringBase::size_type pos = WStringBase::npos) const;
-	WStringBase::size_type Find(const word* s, WStringBase::size_type pos = WStringBase::npos) const;
-	WStringBase::size_type Find(const word& s, WStringBase::size_type pos = WStringBase::npos) const;
-
-	word& operator[](WStringBase::size_type offset);
-	word operator[](WStringBase::size_type offset) const;
-};
+typedef std::wstring WString;
 
 }
 }

+ 3 - 3
Samples/basic/animation/src/main.cpp

@@ -53,7 +53,7 @@ public:
 		if (document != NULL)
 		{
 			{
-				document->GetElementById("title")->SetInnerRML(title);
+				//document->GetElementById("title")->SetInnerRML(title);
 				document->SetProperty("left", Property(position.x, Property::PX));
 				document->SetProperty("top", Property(position.y, Property::PX));
 				//document->Animate("opacity", Property(1.0f, Property::NUMBER), 1.5f, Tween{Tween::Quadratic, Tween::Out}, 1, true, 0.0f);
@@ -149,7 +149,7 @@ public:
 			int route = rand() % 50;
 			int max = (rand() % 40) + 10;
 			int value = rand() % max;
-			Rocket::Core::String rml_row(1000, R"(
+			Rocket::Core::String rml_row = Rocket::Core::CreateString(1000, R"(
 			<div class="row">
 				<div class="col col1"><button class="expand" index="%d">+</button>&nbsp;<a>Route %d</a></div>
 				<div class="col col23"><input type="range" class="assign_range" min="0" max="%d" value="%d"/></div>
@@ -238,7 +238,7 @@ void GameLoop()
 		auto el = window->GetDocument()->GetElementById("fps");
 		float fps = float(count_frames) / dt;
 		count_frames = 0;
-		el->SetInnerRML(Rocket::Core::String{ 20, "FPS: %f", fps });
+		el->SetInnerRML(Rocket::Core::CreateString( 20, "FPS: %f", fps ));
 	}
 
 	window->performance_test();

+ 2 - 2
Samples/shell/src/ShellFileInterface.cpp

@@ -40,12 +40,12 @@ ShellFileInterface::~ShellFileInterface()
 Rocket::Core::FileHandle ShellFileInterface::Open(const Rocket::Core::String& path)
 {
 	// Attempt to open the file relative to the application's root.
-	FILE* fp = fopen((root + path).CString(), "rb");
+	FILE* fp = fopen((root + path).c_str(), "rb");
 	if (fp != NULL)
 		return (Rocket::Core::FileHandle) fp;
 
 	// Attempt to open the file relative to the current working directory.
-	fp = fopen(path.CString(), "rb");
+	fp = fopen(path.c_str(), "rb");
 	return (Rocket::Core::FileHandle) fp;
 }
 

+ 1 - 1
Samples/shell/src/win32/ShellWin32.cpp

@@ -63,7 +63,7 @@ bool Shell::Initialise(const Rocket::Core::String& path)
 		executable_file_name[0] = 0;
 
 	executable_path = Rocket::Core::String(executable_file_name);
-	executable_path = executable_path.Substring(0, executable_path.RFind("\\") + 1);
+	executable_path = executable_path.substr(0, executable_path.rfind("\\") + 1);
 	file_interface = new ShellFileInterface(executable_path + path);
 	Rocket::Core::SetFileInterface(file_interface);
 

+ 4 - 4
Source/Controls/Clipboard.cpp

@@ -83,7 +83,7 @@ Core::WString Clipboard::Get()
 
 		const Rocket::Core::word* clipboard_text = (const Rocket::Core::word*) GlobalLock(clipboard_data);
 		if (clipboard_text)
-			clipboard_content.Assign(clipboard_text);
+			clipboard_content = clipboard_text;
 		GlobalUnlock(clipboard_data);
 
 		CloseClipboard();
@@ -108,11 +108,11 @@ void Clipboard::Set(const Core::WString& _content)
 		EmptyClipboard();
 
 		Rocket::Core::String win32_content;
-		_content.ToUTF8(win32_content);
+		win32_content = Core::ToUTF8(_content);
 
-		HGLOBAL clipboard_data = GlobalAlloc(GMEM_FIXED, win32_content.Length() + 1);
+		HGLOBAL clipboard_data = GlobalAlloc(GMEM_FIXED, win32_content.size() + 1);
 		// Replaced strcpy_s with a simple strcpy, because we know for sure it's big enough.
-		strcpy((char*) clipboard_data, win32_content.CString());
+		strcpy((char*) clipboard_data, win32_content.c_str());
 
 		if (SetClipboardData(CF_TEXT, clipboard_data) == NULL)
 		{

+ 2 - 2
Source/Controls/DataFormatter.cpp

@@ -35,13 +35,13 @@ static DataFormatterMap data_formatters;
 
 DataFormatter::DataFormatter(const Rocket::Core::String& _name)
 {
-	if (!_name.Empty())
+	if (!_name.empty())
 	{
 		name = _name;
 	}
 	else
 	{
-		name.FormatString(64, "%x", this);
+		name = Core::CreateString(64, "%x", this);
 	}
 	data_formatters[name] = this;
 }

+ 1 - 1
Source/Controls/DataQuery.cpp

@@ -100,7 +100,7 @@ void DataQuery::ExecuteQuery(DataSource* _data_source, const Rocket::Core::Strin
 		limit = data_source->GetNumRows(table) - offset;
 	}
 
-	if (!order.Empty())
+	if (!order.empty())
 	{
 		// Fetch the rows from offset to limit.
 		rows.resize(limit);

+ 3 - 3
Source/Controls/DataSource.cpp

@@ -43,13 +43,13 @@ static DataSourceMap data_sources;
 
 DataSource::DataSource(const Rocket::Core::String& _name)
 {
-	if (!_name.Empty())
+	if (!_name.empty())
 	{
 		name = _name;
 	}
 	else
 	{
-		name.FormatString(64, "%x", this);
+		name = Core::CreateString(64, "%x", this);
 	}
 	data_sources[name] = this;
 }
@@ -162,7 +162,7 @@ void DataSource::BuildRowEntries(Rocket::Core::StringList& row, const RowMap& ro
 		else
 		{
 			row[i] = "";
-			Rocket::Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Failed to find required data source column %s", columns[i].CString());
+			Rocket::Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Failed to find required data source column %s", columns[i].c_str());
 		}
 	}
 }

+ 3 - 3
Source/Controls/DataSourceListener.cpp

@@ -84,7 +84,7 @@ void DataSourceListener::OnRowChange(DataSource* ROCKET_UNUSED_PARAMETER(data_so
 // Sets up data source and table from a given string.
 bool DataSourceListener::ParseDataSource(DataSource*& data_source, Rocket::Core::String& table_name, const Rocket::Core::String& data_source_name)
 {
-	if (data_source_name.Length() == 0)
+	if (data_source_name.size() == 0)
 	{
 		data_source = NULL;
 		table_name = "";
@@ -94,11 +94,11 @@ bool DataSourceListener::ParseDataSource(DataSource*& data_source, Rocket::Core:
 	Rocket::Core::StringList data_source_parts;
 	Rocket::Core::StringUtilities::ExpandString(data_source_parts, data_source_name, '.');
 
-	DataSource* new_data_source = DataSource::GetDataSource(data_source_parts[0].CString());
+	DataSource* new_data_source = DataSource::GetDataSource(data_source_parts[0].c_str());
 
 	if (data_source_parts.size() != 2 || !new_data_source)
 	{
-		Rocket::Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Bad data source name %s", data_source_name.CString());
+		Rocket::Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Bad data source name %s", data_source_name.c_str());
 		data_source = NULL;
 		table_name = "";
 		return false;

+ 11 - 11
Source/Controls/ElementDataGrid.cpp

@@ -127,11 +127,11 @@ void ElementDataGrid::AddColumn(const Rocket::Core::String& fields, const Rocket
 		}
 		else if (column.fields[i] != Rocket::Controls::DataSource::DEPTH)
 		{
-			if (!column_fields.Empty())
+			if (!column_fields.empty())
 			{
-				column_fields.Append(",");
+				column_fields += ",";
 			}
-			column_fields.Append(column.fields[i]);
+			column_fields += column.fields[i];
 		}
 	}
 
@@ -225,7 +225,7 @@ void ElementDataGrid::OnUpdate()
 	Core::ElementDocument* document = GetOwnerDocument();
 	document->LockLayout(true);
 	
-	if (!new_data_source.Empty())
+	if (!new_data_source.empty())
 	{
 		root->SetDataSource(new_data_source);
 		new_data_source = "";
@@ -286,18 +286,18 @@ void ElementDataGrid::GetInnerRML(Rocket::Core::String& content) const
 		{
 			if (j != columns[i].fields.size() - 1)
 			{
-				column_fields.Append(",");
+				column_fields += ",";
 			}
-			column_fields.Append(columns[i].fields[j]);
+			column_fields += columns[i].fields[j];
 		}
 		Rocket::Core::String width_attribute = header_element->GetAttribute<Rocket::Core::String>("width", "");
 
-		content.Append(Rocket::Core::String(column_fields.Length() + 32, "<col fields=\"%s\"", column_fields.CString()));
-		if (!width_attribute.Empty())
-			content.Append(Rocket::Core::String(width_attribute.Length() + 32, " width=\"%s\"", width_attribute.CString()));
-		content.Append(">");
+		content += Core::CreateString(column_fields.size() + 32, "<col fields=\"%s\"", column_fields.c_str());
+		if (!width_attribute.empty())
+			content += Core::CreateString(width_attribute.size() + 32, " width=\"%s\"", width_attribute.c_str());
+		content += ">";
 		header_element->GetInnerRML(content);
-		content.Append("</col>");
+		content += "</col>";
 	}
 }
 

+ 6 - 6
Source/Controls/ElementDataGridRow.cpp

@@ -476,7 +476,7 @@ void ElementDataGridRow::Load(const DataQuery& row_information)
 	if (row_information.IsFieldSet(DataSource::CHILD_SOURCE))
 	{
 		Rocket::Core::String data_source = row_information.Get< Rocket::Core::String >(DataSource::CHILD_SOURCE, "");
-		if (!data_source.Empty())
+		if (!data_source.empty())
 		{
 			SetDataSource(data_source);
 		}
@@ -505,11 +505,11 @@ void ElementDataGridRow::Load(const DataQuery& row_information)
 			{
 				if (column->fields[i] == DataSource::DEPTH)
 				{
-					raw_data.push_back(Rocket::Core::String(8, "%d", depth));
+					raw_data.push_back(Rocket::Core::CreateString(8, "%d", depth));
 				}
 				else if (column->fields[i] == DataSource::NUM_CHILDREN)
 				{
-					raw_data.push_back(Rocket::Core::String(8, "%d", children.size()));
+					raw_data.push_back(Rocket::Core::CreateString(8, "%d", children.size()));
 				}
 				else
 				{
@@ -528,9 +528,9 @@ void ElementDataGridRow::Load(const DataQuery& row_information)
 				{
 					if (i > 0)
 					{
-						cell_string.Append(",");
+						cell_string += ",";
 					}
-					cell_string.Append(raw_data[i]);
+					cell_string += raw_data[i];
 				}
 			}
 
@@ -637,7 +637,7 @@ void ElementDataGridRow::LoadChildren(int first_row_to_load, int num_rows_to_loa
 
 		if (!query.NextRow())
 		{
-			Core::Log::Message(Rocket::Core::Log::LT_WARNING, "Failed to load row %d from data source %s", i, data_table.CString());
+			Core::Log::Message(Rocket::Core::Log::LT_WARNING, "Failed to load row %d from data source %s", i, data_table.c_str());
 		}
 
 		// Now load the child with the row in the query.

+ 2 - 2
Source/Controls/ElementForm.cpp

@@ -46,7 +46,7 @@ ElementForm::~ElementForm()
 void ElementForm::Submit(const Rocket::Core::String& name, const Rocket::Core::String& submit_value)
 {
 	Rocket::Core::Dictionary values;
-	if (name.Empty())
+	if (name.empty())
 		values.Set("submit", submit_value);
 	else
 		values.Set(name, submit_value);
@@ -75,7 +75,7 @@ void ElementForm::Submit(const Rocket::Core::String& name, const Rocket::Core::S
 		Rocket::Core::String control_value = control->GetValue();
 
 		// Skip over unnamed form controls.
-		if (control_name.Empty())
+		if (control_name.empty())
 			continue;
 
 		// If the item already exists, append to it.

+ 6 - 6
Source/Controls/ElementFormControlDataSelect.cpp

@@ -167,22 +167,22 @@ void ElementFormControlDataSelect::BuildOptions()
 	DataFormatter* data_formatter = NULL;
 
 	// Process the attributes.
-	if (fields_attribute.Empty())
+	if (fields_attribute.empty())
 	{
-		Core::Log::Message(Rocket::Core::Log::LT_ERROR, "DataQuery failed, no fields specified for %s.", GetTagName().CString());
+		Core::Log::Message(Rocket::Core::Log::LT_ERROR, "DataQuery failed, no fields specified for %s.", GetTagName().c_str());
 		return;
 	}
 
-	if (valuefield_attribute.Empty())
+	if (valuefield_attribute.empty())
 	{
-		valuefield_attribute = fields_attribute.Substring(0, fields_attribute.Find(","));
+		valuefield_attribute = fields_attribute.substr(0, fields_attribute.find(","));
 	}
 
-	if (!data_formatter_attribute.Empty())
+	if (!data_formatter_attribute.empty())
 	{
 		data_formatter = DataFormatter::GetDataFormatter(data_formatter_attribute);
 		if (!data_formatter)
-			Core::Log::Message(Rocket::Core::Log::LT_WARNING, "Unable to find data formatter named '%s', formatting skipped.", data_formatter_attribute.CString());
+			Core::Log::Message(Rocket::Core::Log::LT_WARNING, "Unable to find data formatter named '%s', formatting skipped.", data_formatter_attribute.c_str());
 	}
 
 	// Build a list of attributes

+ 1 - 1
Source/Controls/ElementFormControlTextArea.cpp

@@ -119,7 +119,7 @@ bool ElementFormControlTextArea::GetWordWrap()
 // Returns the control's inherent size, based on the length of the input field and the current font size.
 bool ElementFormControlTextArea::GetIntrinsicDimensions(Rocket::Core::Vector2f& dimensions)
 {
-	dimensions.x = (float) (GetNumColumns() * Core::ElementUtilities::GetStringWidth(this, "m"));
+	dimensions.x = (float) (GetNumColumns() * Core::ElementUtilities::GetStringWidth(this, L"m"));
 	dimensions.y = (float) (GetNumRows() * Core::ElementUtilities::GetLineHeight(this));
 
 	return true;

+ 1 - 1
Source/Controls/InputTypeRange.cpp

@@ -46,7 +46,7 @@ InputTypeRange::~InputTypeRange()
 // Returns a string representation of the current value of the form control.
 Rocket::Core::String InputTypeRange::GetValue() const
 {
-	return Rocket::Core::String(32, "%f", widget->GetValue());
+	return Rocket::Core::CreateString(32, "%f", widget->GetValue());
 }
 
 // Called every update from the host element.

+ 1 - 1
Source/Controls/InputTypeText.cpp

@@ -104,7 +104,7 @@ void InputTypeText::ProcessEvent(Core::Event& ROCKET_UNUSED_PARAMETER(event))
 // Sizes the dimensions to the element's inherent size.
 bool InputTypeText::GetIntrinsicDimensions(Rocket::Core::Vector2f& dimensions)
 {
-	dimensions.x = (float) (size * Core::ElementUtilities::GetStringWidth(element, "m"));
+	dimensions.x = (float) (size * Core::ElementUtilities::GetStringWidth(element, L"m"));
 	dimensions.y = (float) Core::ElementUtilities::GetLineHeight(element) + 2;
 
 	return true;

+ 40 - 43
Source/Controls/WidgetTextInput.cpp

@@ -116,7 +116,7 @@ WidgetTextInput::~WidgetTextInput()
 // Sets the value of the text field.
 void WidgetTextInput::SetValue(const Core::String& value)
 {
-	text_element->SetText(value);
+	text_element->SetText(Core::ToWideString(value));
 	FormatElement();
 
 	UpdateRelativeCursor();
@@ -130,11 +130,11 @@ void WidgetTextInput::SetMaxLength(int _max_length)
 		max_length = _max_length;
 		if (max_length >= 0)
 		{
-			const Core::WString& value = GetElement()->GetAttribute< Rocket::Core::String >("value", "");
-			if ((int) value.Length() > max_length)
+			Core::WString value = Core::ToWideString( GetElement()->GetAttribute< Rocket::Core::String >("value", "") );
+			if ((int) value.size() > max_length)
 			{
 				Rocket::Core::String new_value;
-				Core::WString(value.CString(), value.CString() + max_length).ToUTF8(new_value);
+				new_value = Core::ToUTF8(Core::WString(value.c_str(), value.c_str() + max_length));
 
 				GetElement()->SetAttribute("value", new_value);
 			}
@@ -351,10 +351,10 @@ void WidgetTextInput::ProcessEvent(Core::Event& event)
                 if (ctrl)
                 {
     				const Core::WString clipboard_content = Clipboard::Get();
-    				for (size_t i = 0; i < clipboard_content.Length(); ++i)
+    				for (size_t i = 0; i < clipboard_content.size(); ++i)
     				{
     					if (max_length > 0 &&
-    						(int) Core::WString(GetElement()->GetAttribute< Rocket::Core::String >("value", "")).Length() > max_length)
+    						(int) Core::ToWideString(GetElement()->GetAttribute< Rocket::Core::String >("value", "")).size() > max_length)
     						break;
 
     					AddCharacter(clipboard_content[i]);
@@ -383,7 +383,7 @@ void WidgetTextInput::ProcessEvent(Core::Event& event)
 			event.GetParameter< int >("meta_key", 0) == 0)
 		{
 			Rocket::Core::word character = event.GetParameter< Rocket::Core::word >("data", 0);
-			if (max_length < 0 || (int) Core::String(GetElement()->GetAttribute< Rocket::Core::String >("value", "")).Length() < max_length)
+			if (max_length < 0 || (int) Core::String(GetElement()->GetAttribute< Rocket::Core::String >("value", "")).size() < max_length)
 				AddCharacter(character);
 		}
 
@@ -432,13 +432,12 @@ bool WidgetTextInput::AddCharacter(Rocket::Core::word character)
 	if (selection_length > 0)
 		DeleteSelection();
 
-	Core::WString value = GetElement()->GetAttribute< Rocket::Core::String >("value", "");
-	value.Insert(GetCursorIndex(), Core::WString(1, character), 1);
+	Core::WString value = Core::ToWideString(GetElement()->GetAttribute< Rocket::Core::String >("value", ""));
+	value.insert(GetCursorIndex(), Core::WString(1, character), 1);
 
 	edit_index += 1;
 
-	Rocket::Core::String utf8_value;
-	value.ToUTF8(utf8_value);
+	Rocket::Core::String utf8_value = Core::ToUTF8(value);
 	GetElement()->SetAttribute("value", utf8_value);
 	DispatchChangeEvent();
 
@@ -462,26 +461,25 @@ bool WidgetTextInput::DeleteCharacter(bool back)
 		return true;
 	}
 
-	Core::WString value = GetElement()->GetAttribute< Rocket::Core::String >("value", "");
+	Core::WString value = Core::ToWideString(GetElement()->GetAttribute< Rocket::Core::String >("value", ""));
 
 	if (back)
 	{
 		if (GetCursorIndex() == 0)
 			return false;
 
-		value.Erase(GetCursorIndex() - 1, 1);
+		value.erase(GetCursorIndex() - 1, 1);
 		edit_index -= 1;
 	}
 	else
 	{
-		if (GetCursorIndex() == (int) value.Length())
+		if (GetCursorIndex() == (int) value.size())
 			return false;
 
-		value.Erase(GetCursorIndex(), 1);
+		value.erase(GetCursorIndex(), 1);
 	}
 
-	Rocket::Core::String utf8_value;
-	value.ToUTF8(utf8_value);
+	Rocket::Core::String utf8_value = Core::ToUTF8(value);
 	GetElement()->SetAttribute("value", utf8_value);
 	DispatchChangeEvent();
 
@@ -494,7 +492,7 @@ bool WidgetTextInput::DeleteCharacter(bool back)
 void WidgetTextInput::CopySelection()
 {
 	const Core::String& value = GetElement()->GetAttribute< Rocket::Core::String >("value", "");
-	Clipboard::Set(Core::String(value.Substring(selection_begin_index, selection_length)));
+	Clipboard::Set(Core::ToWideString(value.substr(selection_begin_index, selection_length)));
 }
 
 // Returns the absolute index of the cursor.
@@ -561,8 +559,8 @@ void WidgetTextInput::UpdateAbsoluteCursor()
 
 	for (int i = 0; i < cursor_line_index; i++)
 	{
-		absolute_cursor_index += (int)lines[i].content.Length();
-		edit_index += (int)lines[i].content.Length() + lines[i].extra_characters;
+		absolute_cursor_index += (int)lines[i].content.size();
+		edit_index += (int)lines[i].content.size() + lines[i].extra_characters;
 	}
 }
 
@@ -584,7 +582,7 @@ void WidgetTextInput::UpdateRelativeCursor()
 			return;
 		}
 
-		num_characters += (int) lines[i].content.Length();
+		num_characters += (int) lines[i].content.size();
 		edit_index += lines[i].extra_characters;
 	}
 
@@ -614,7 +612,7 @@ int WidgetTextInput::CalculateCharacterIndex(int line_index, float position)
 
 	while (character_index < lines[line_index].content_length)
 	{
-		float next_line_width = (float) Core::ElementUtilities::GetStringWidth(text_element, lines[line_index].content.Substring(0, character_index));
+		float next_line_width = (float) Core::ElementUtilities::GetStringWidth(text_element, lines[line_index].content.substr(0, character_index));
 		if (next_line_width > position)
 		{
 			if (position - line_width < next_line_width - position)
@@ -763,8 +761,8 @@ Rocket::Core::Vector2f WidgetTextInput::FormatText()
 		// field's bounds.
 		bool soft_return = false;
 		if (!last_line &&
-			(line.content.Empty() ||
-			 line.content[line.content.Length() - 1] != '\n'))
+			(line.content.empty() ||
+			 line.content[line.content.size() - 1] != '\n'))
 		{
 			soft_return = true;
 
@@ -773,26 +771,26 @@ Rocket::Core::Vector2f WidgetTextInput::FormatText()
 			for (int i = 1; i >= 0; --i)
 			{
 				int index = line_begin + line.content_length + i;
-				if (index >= (int) text.Length())
+				if (index >= (int) text.size())
 					continue;
 
 				if (text[index] != ' ')
 				{
-					orphan = "";
+					orphan.clear();
 					continue;
 				}
 
 				int next_index = index + 1;
-				if (!orphan.Empty() ||
-					next_index >= (int) text.Length() ||
+				if (!orphan.empty() ||
+					next_index >= (int) text.size() ||
 					text[next_index] != ' ')
 					orphan += ' ';
 			}
 
-			if (!orphan.Empty())
+			if (!orphan.empty())
 			{
 				line.content += orphan;
-				line.content_length += (int) orphan.Length();
+				line.content_length += (int) orphan.size();
 				line_width += Core::ElementUtilities::GetStringWidth(text_element, orphan);
 			}
 		}
@@ -806,7 +804,7 @@ Rocket::Core::Vector2f WidgetTextInput::FormatText()
 
 		// The pre-selected text is placed, if there is any (if the selection starts on or before
 		// the beginning of this line, then this will be empty).
-		if (!pre_selection.Empty())
+		if (!pre_selection.empty())
 		{
 			text_element->AddLine(line_position, pre_selection);
 			line_position.x += Core::ElementUtilities::GetStringWidth(text_element, pre_selection);
@@ -814,7 +812,7 @@ Rocket::Core::Vector2f WidgetTextInput::FormatText()
 
 		// If there is any selected text on this line, place it in the selected text element and
 		// generate the geometry for its background.
-		if (!selection.Empty())
+		if (!selection.empty())
 		{
 			selected_text_element->AddLine(line_position, selection);
 			int selection_width = Core::ElementUtilities::GetStringWidth(selected_text_element, selection);
@@ -828,7 +826,7 @@ Rocket::Core::Vector2f WidgetTextInput::FormatText()
 
 		// If there is any unselected text after the selection on this line, place it in the
 		// standard text element after the selected text.
-		if (!post_selection.Empty())
+		if (!post_selection.empty())
 			text_element->AddLine(line_position, post_selection);
 
 
@@ -854,8 +852,8 @@ Rocket::Core::Vector2f WidgetTextInput::FormatText()
 
 		// Push the new line into our array of lines, but first check if its content length needs to be truncated to
 		// dodge a trailing endline.
-		if (!line.content.Empty() &&
-			line.content[line.content.Length() - 1] == '\n')
+		if (!line.content.empty() &&
+			line.content[line.content.size() - 1] == '\n')
 			line.content_length -= 1;
 		lines.push_back(line);
 	}
@@ -886,7 +884,7 @@ void WidgetTextInput::UpdateCursorPosition()
 	if (text_element->GetFontFaceHandle() == NULL)
 		return;
 
-	cursor_position.x = (float) Core::ElementUtilities::GetStringWidth(text_element, lines[cursor_line_index].content.Substring(0, cursor_character_index));
+	cursor_position.x = (float) Core::ElementUtilities::GetStringWidth(text_element, lines[cursor_line_index].content.substr(0, cursor_character_index));
 	cursor_position.y = -1 + cursor_line_index * (float) Core::ElementUtilities::GetLineHeight(text_element);
 }
 
@@ -940,10 +938,9 @@ void WidgetTextInput::DeleteSelection()
 {
 	if (selection_length > 0)
 	{
-		const Core::WString& value = GetElement()->GetAttribute< Rocket::Core::String >("value", "");
+		const Core::WString& value = Core::ToWideString( GetElement()->GetAttribute< Rocket::Core::String >("value", "") );
 
-		Rocket::Core::String new_value;
-		Core::WString(value.Substring(0, selection_begin_index) + value.Substring(selection_begin_index + selection_length)).ToUTF8(new_value);
+		Rocket::Core::String new_value = Core::ToUTF8(Core::WString(value.substr(0, selection_begin_index) + value.substr(selection_begin_index + selection_length)));
 		GetElement()->SetAttribute("value", new_value);
 
 		// Move the cursor to the beginning of the old selection.
@@ -961,16 +958,16 @@ void WidgetTextInput::GetLineSelection(Core::WString& pre_selection, Core::WStri
 	// Check if we have any selection at all, and if so if the selection is on this line.
 	if (selection_length <= 0 ||
 		selection_begin_index + selection_length < line_begin ||
-		selection_begin_index > line_begin + (int) line.Length())
+		selection_begin_index > line_begin + (int) line.size())
 	{
 		pre_selection = line;
 		return;
 	}
 
 	// Split the line up into its three parts, depending on the size and placement of the selection.
-	pre_selection = line.Substring(0, Rocket::Core::Math::Max(0, selection_begin_index - line_begin));
-	selection = line.Substring(Rocket::Core::Math::Max(0, selection_begin_index - line_begin), Rocket::Core::Math::Max(0, selection_length + Rocket::Core::Math::Min(0, selection_begin_index - line_begin)));
-	post_selection = line.Substring(selection_begin_index + selection_length - line_begin);
+	pre_selection = line.substr(0, Rocket::Core::Math::Max(0, selection_begin_index - line_begin));
+	selection = line.substr(Rocket::Core::Math::Max(0, selection_begin_index - line_begin), Rocket::Core::Math::Max(0, selection_length + Rocket::Core::Math::Min(0, selection_begin_index - line_begin)));
+	post_selection = line.substr(selection_begin_index + selection_length - line_begin);
 }
 
 void WidgetTextInput::SetKeyboardActive(bool active)

+ 1 - 1
Source/Controls/WidgetTextInputSingleLine.cpp

@@ -65,7 +65,7 @@ void WidgetTextInputSingleLine::LineBreak()
 void WidgetTextInputSingleLine::SanitiseValue(Core::String& value)
 {
 	Core::String new_value;
-	for (Core::String::size_type i = 0; i < value.Length(); ++i)
+	for (Core::String::size_type i = 0; i < value.size(); ++i)
 	{
 		switch (value[i])
 		{

+ 1 - 1
Source/Controls/WidgetTextInputSingleLinePassword.cpp

@@ -44,7 +44,7 @@ void WidgetTextInputSingleLinePassword::SetValue(const Core::String& value)
 {
 	Core::String sanitised_value(value);
 	SanitiseValue(sanitised_value);
-	WidgetTextInput::SetValue(Core::String(sanitised_value.Length(), (Rocket::Core::word) '*'));
+	WidgetTextInput::SetValue(Core::String(sanitised_value.size(), (Rocket::Core::word) '*'));
 }
 
 }

+ 1 - 1
Source/Controls/XMLNodeHandlerDataGrid.cpp

@@ -61,7 +61,7 @@ Core::Element* XMLNodeHandlerDataGrid::ElementStart(Core::XMLParser* parser, con
 			if (element != NULL)
 				element->RemoveReference();
 
-			Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Instancer failed to create data grid for tag %s.", name.CString());
+			Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Instancer failed to create data grid for tag %s.", name.c_str());
 			return NULL;
 		}
 

+ 2 - 2
Source/Controls/XMLNodeHandlerTabSet.cpp

@@ -62,7 +62,7 @@ Core::Element* XMLNodeHandlerTabSet::ElementStart(Core::XMLParser* parser, const
 		{
 			if (element)
 				element->RemoveReference();
-			Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Instancer failed to create element for tag %s.", name.CString());
+			Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Instancer failed to create element for tag %s.", name.c_str());
 			return NULL;
 		}
 
@@ -117,7 +117,7 @@ Core::Element* XMLNodeHandlerTabSet::ElementStart(Core::XMLParser* parser, const
 		Core::Element* element = Core::Factory::InstanceElement(parent, name, name, attributes);
 		if (!element)
 		{
-			Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Instancer failed to create element for tag %s.", name.CString());
+			Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Instancer failed to create element for tag %s.", name.c_str());
 			return NULL;
 		}
 

+ 17 - 17
Source/Core/BaseXMLParser.cpp

@@ -50,8 +50,8 @@ BaseXMLParser::~BaseXMLParser()
 // Registers a tag as containing general character data.
 void BaseXMLParser::RegisterCDATATag(const String& tag)
 {
-	if (!tag.Empty())
-		cdata_tags.insert(tag.ToLower());
+	if (!tag.empty())
+		cdata_tags.insert(ToLower(tag));
 }
 
 // Parses the given stream as an XML file, and calls the handlers when
@@ -155,7 +155,7 @@ void BaseXMLParser::ReadBody()
 	// Check for error conditions
 	if (open_tag_depth > 0)
 	{
-		Log::Message(Log::LT_WARNING, "XML parse error on line %d of %s.", GetLineNumber(), xml_source->GetSourceURL().GetURL().CString());
+		Log::Message(Log::LT_WARNING, "XML parse error on line %d of %s.", GetLineNumber(), xml_source->GetSourceURL().GetURL().c_str());
 	}
 }
 
@@ -165,10 +165,10 @@ bool BaseXMLParser::ReadOpenTag()
 	open_tag_depth++;
 
 	// Opening tag; send data immediately and open the tag.
-	if (!data.Empty())
+	if (!data.empty())
 	{
 		HandleData(data);
-		data.Clear();
+		data.clear();
 	}
 
 	String tag_name;
@@ -223,16 +223,16 @@ bool BaseXMLParser::ReadOpenTag()
 	// Check if this tag needs to processed as CDATA.
 	if (section_opened)
 	{
-		String lcase_tag_name = tag_name.ToLower();
+		String lcase_tag_name = ToLower(tag_name);
 		if (cdata_tags.find(lcase_tag_name) != cdata_tags.end())
 		{
-			if (ReadCDATA(lcase_tag_name.CString()))
+			if (ReadCDATA(lcase_tag_name.c_str()))
 			{
 				open_tag_depth--;
-				if (!data.Empty())
+				if (!data.empty())
 				{
 					HandleData(data);
-					data.Clear();
+					data.clear();
 				}
 				HandleElementEnd(tag_name);
 
@@ -249,10 +249,10 @@ bool BaseXMLParser::ReadOpenTag()
 bool BaseXMLParser::ReadCloseTag()
 {
 	// Closing tag; send data immediately and close the tag.
-	if (!data.Empty())
+	if (!data.empty())
 	{
 		HandleData(data);
-		data.Clear();
+		data.clear();
 	}
 
 	String tag_name;
@@ -299,7 +299,7 @@ bool BaseXMLParser::ReadAttributes(XMLAttributes& attributes)
 			}
 		}
 
- 		attributes.Set(attribute.CString(), value);
+ 		attributes.Set(attribute.c_str(), value);
 
 		// Check for the end of the tag.
 		if (PeekString((const unsigned char*) "/", false) ||
@@ -330,8 +330,8 @@ bool BaseXMLParser::ReadCDATA(const char* terminator)
 				String tag;
 				if (FindString((const unsigned char*) ">", tag))
 				{
-					String tag_name = StringUtilities::StripWhitespace(tag.Substring(tag.Find("/") + 1));
-					if (tag_name.ToLower() == terminator)
+					String tag_name = StringUtilities::StripWhitespace(tag.substr(tag.find("/") + 1));
+					if (ToLower(tag_name) == terminator)
 					{
 						data += cdata;
 						return true;
@@ -366,7 +366,7 @@ bool BaseXMLParser::FindWord(String& word, const char* terminators)
 		// Ignore white space
 		if (StringUtilities::IsWhitespace(*read))
 		{
-			if (word.Empty())
+			if (word.empty())
 			{
 				read++;
 				continue;
@@ -378,7 +378,7 @@ bool BaseXMLParser::FindWord(String& word, const char* terminators)
 		// Check for termination condition
 		if (terminators && strchr(terminators, *read))
 		{
-			return !word.Empty();
+			return !word.empty();
 		}
 
 		word += *read;
@@ -412,7 +412,7 @@ bool BaseXMLParser::FindString(const unsigned char* string, String& data)
 		{
 			if (index > 0)
 			{
-				data.Append((const char*) string, index);
+				data += String((const char*)string, index);
 				index = 0;
 			}
 

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

@@ -69,7 +69,7 @@ Rocket::Core::FontFaceHandle* FontFace::GetHandle(const String& _raw_charset, in
 		// Check all the handles if their charsets contain the requested charset.
 		if (!UnicodeRange::BuildList(charset, raw_charset))
 		{
-			Log::Message(Log::LT_ERROR, "Invalid font charset '%s'.", _raw_charset.CString());
+			Log::Message(Log::LT_ERROR, "Invalid font charset '%s'.", _raw_charset.c_str());
 			return NULL;
 		}
 

+ 6 - 6
Source/Core/BitmapFont/FontFaceHandle.cpp

@@ -75,10 +75,10 @@ bool FontFaceHandle::Initialise(BitmapFontDefinitions *bm_face, const String& _c
 	// Construct proper path to texture
 	URL fnt_source = bm_face->Face.Source;
 	URL bitmap_source = bm_face->Face.BitmapSource;
-	if(bitmap_source.GetPath().Empty())
+	if(bitmap_source.GetPath().empty())
 	{
 		texture_source = fnt_source.GetPath() + bitmap_source.GetFileName();
-		if(!bitmap_source.GetExtension().Empty())
+		if(!bitmap_source.GetExtension().empty())
 		{
 			texture_source += "." + bitmap_source.GetExtension();
 		}
@@ -90,7 +90,7 @@ bool FontFaceHandle::Initialise(BitmapFontDefinitions *bm_face, const String& _c
 
 	if (!UnicodeRange::BuildList(charset, raw_charset))
 	{
-		Log::Message(Log::LT_ERROR, "Invalid font charset '%s'.", raw_charset.CString());
+		Log::Message(Log::LT_ERROR, "Invalid font charset '%s'.", raw_charset.c_str());
 		return false;
 	}
 
@@ -114,7 +114,7 @@ int FontFaceHandle::GetStringWidth(const WString& string, word prior_character)
 {
 	int width = 0;
 
-	for (size_t i = 0; i < string.Length(); i++)
+	for (size_t i = 0; i < string.size(); i++)
 	{
 		word character_code = string[i];
 
@@ -247,8 +247,8 @@ int FontFaceHandle::GenerateString(GeometryList& geometry, const WString& string
 		line_width = 0;
 		word prior_character = 0;
 
-		const word* string_iterator = string.CString();
-		const word* string_end = string.CString() + string.Length();
+		const word* string_iterator = string.c_str();
+		const word* string_end = string.c_str() + string.size();
 
 		for (; string_iterator != string_end; string_iterator++)
 		{

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

@@ -83,7 +83,7 @@ bool FontProvider::LoadFontFace(const String& file_name)
 
 	if (bm_font == NULL)
 	{
-		Log::Message(Log::LT_ERROR, "Failed to load font face from %s.", file_name.CString());
+		Log::Message(Log::LT_ERROR, "Failed to load font face from %s.", file_name.c_str());
 		return false;
 	}
 
@@ -92,12 +92,12 @@ bool FontProvider::LoadFontFace(const String& file_name)
 
 	if (instance->AddFace(bm_font, bm_font->Face.FamilyName, style, weight, true))
 	{
-		Log::Message(Log::LT_INFO, "Loaded font face %s (from %s).", bm_font->Face.FamilyName.CString(), file_name.CString());
+		Log::Message(Log::LT_INFO, "Loaded font face %s (from %s).", bm_font->Face.FamilyName.c_str(), file_name.c_str());
 		return true;
 	}
 	else
 	{
-		Log::Message(Log::LT_ERROR, "Failed to load font face %s (from %s).", bm_font->Face.FamilyName.CString(), file_name.CString());
+		Log::Message(Log::LT_ERROR, "Failed to load font face %s (from %s).", bm_font->Face.FamilyName.c_str(), file_name.c_str());
 		return false;
 	}
 
@@ -110,18 +110,18 @@ bool FontProvider::LoadFontFace(const String& file_name, const String& family, F
 	BitmapFontDefinitions *bm_font = (BitmapFontDefinitions*) instance->LoadFace(file_name);
 	if (bm_font == NULL)
 	{
-		Log::Message(Log::LT_ERROR, "Failed to load font face from %s.", file_name.CString());
+		Log::Message(Log::LT_ERROR, "Failed to load font face from %s.", file_name.c_str());
 		return false;
 	}
 
 	if (instance->AddFace(bm_font, family, style, weight, true))
 	{
-		Log::Message(Log::LT_INFO, "Loaded font face %s (from %s).", bm_font->Face.FamilyName.CString(), file_name.CString());
+		Log::Message(Log::LT_INFO, "Loaded font face %s (from %s).", bm_font->Face.FamilyName.c_str(), file_name.c_str());
 		return true;
 	}
 	else
 	{
-		Log::Message(Log::LT_ERROR, "Failed to load font face %s (from %s).", bm_font->Face.FamilyName.CString(), file_name.CString());
+		Log::Message(Log::LT_ERROR, "Failed to load font face %s (from %s).", bm_font->Face.FamilyName.c_str(), file_name.c_str());
 		return false;
 	}
 

+ 5 - 5
Source/Core/Context.cpp

@@ -173,7 +173,7 @@ bool Context::Update()
 		ElementDocument* document = root->GetChild(i)->GetOwnerDocument();
 		if (document != NULL && document->lock_layout != 0)
 		{
-			Log::Message(Log::LT_WARNING, "Layout lock leak. Document '%s' had lock layout value: %d", document->title.CString(), document->lock_layout);
+			Log::Message(Log::LT_WARNING, "Layout lock leak. Document '%s' had lock layout value: %d", document->title.c_str(), document->lock_layout);
 			document->lock_layout = 0;
 		}
 	}
@@ -228,14 +228,14 @@ ElementDocument* Context::CreateDocument(const String& tag)
 	Element* element = Factory::InstanceElement(NULL, tag, "body", XMLAttributes());
 	if (element == NULL)
 	{
-		Log::Message(Log::LT_ERROR, "Failed to instance document on tag '%s', instancer returned NULL.", tag.CString());
+		Log::Message(Log::LT_ERROR, "Failed to instance document on tag '%s', instancer returned NULL.", tag.c_str());
 		return NULL;
 	}
 
 	ElementDocument* document = dynamic_cast< ElementDocument* >(element);
 	if (document == NULL)
 	{
-		Log::Message(Log::LT_ERROR, "Failed to instance document on tag '%s', Found type '%s', was expecting derivative of ElementDocument.", tag.CString(), typeid(element).name());
+		Log::Message(Log::LT_ERROR, "Failed to instance document on tag '%s', Found type '%s', was expecting derivative of ElementDocument.", tag.c_str(), typeid(element).name());
 
 		element->RemoveReference();
 		return NULL;
@@ -295,7 +295,7 @@ ElementDocument* Context::LoadDocument(Stream* stream)
 ElementDocument* Context::LoadDocumentFromMemory(const String& string)
 {
 	// Open the stream based on the string contents.
-	StreamMemory* stream = new StreamMemory((byte*)string.CString(), string.Length());
+	StreamMemory* stream = new StreamMemory((byte*)string.c_str(), string.size());
 	stream->SetSourceURL("[document from memory]");
 
 	// Load the document from the stream.
@@ -519,7 +519,7 @@ bool Context::ProcessTextInput(const String& string)
 {
 	bool consumed = true;
 
-	for (size_t i = 0; i < string.Length(); ++i)
+	for (size_t i = 0; i < string.size(); ++i)
 	{
 		// Generate the parameters for the key event.
 		Dictionary parameters;

+ 4 - 4
Source/Core/Core.cpp

@@ -123,7 +123,7 @@ void Shutdown()
 
 	// Release all remaining contexts.
 	for (ContextMap::iterator itr = contexts.begin(); itr != contexts.end(); ++itr)
-		Core::Log::Message(Log::LT_WARNING, "Context '%s' still active on shutdown.", (*itr).first.CString());
+		Core::Log::Message(Log::LT_WARNING, "Context '%s' still active on shutdown.", (*itr).first.c_str());
 	contexts.clear();
 
 	TemplateCache::Shutdown();
@@ -226,20 +226,20 @@ Context* CreateContext(const String& name, const Vector2i& dimensions, RenderInt
 	if (custom_render_interface == NULL &&
 		render_interface == NULL)
 	{
-		Log::Message(Log::LT_WARNING, "Failed to create context '%s', no render interface specified and no default render interface exists.", name.CString());
+		Log::Message(Log::LT_WARNING, "Failed to create context '%s', no render interface specified and no default render interface exists.", name.c_str());
 		return NULL;
 	}
 
 	if (GetContext(name) != NULL)
 	{
-		Log::Message(Log::LT_WARNING, "Failed to create context '%s', context already exists.", name.CString());
+		Log::Message(Log::LT_WARNING, "Failed to create context '%s', context already exists.", name.c_str());
 		return NULL;
 	}
 
 	Context* new_context = Factory::InstanceContext(name);
 	if (new_context == NULL)
 	{
-		Log::Message(Log::LT_WARNING, "Failed to instance context '%s', instancer returned NULL.", name.CString());
+		Log::Message(Log::LT_WARNING, "Failed to instance context '%s', instancer returned NULL.", name.c_str());
 		return NULL;
 	}
 

+ 1 - 1
Source/Core/DecoratorTiledBox.cpp

@@ -65,7 +65,7 @@ bool DecoratorTiledBox::Initialise(const Tile* _tiles, const String* _texture_na
 	// Load the textures.
 	for (int i = 0; i < 9; i++)
 	{
-		if (!_texture_names[i].Empty())
+		if (!_texture_names[i].empty())
 		{
 			tiles[i] = _tiles[i];
 			tiles[i].texture_index = LoadTexture(_texture_names[i], _rcss_paths[i]);

+ 1 - 1
Source/Core/DecoratorTiledHorizontal.cpp

@@ -65,7 +65,7 @@ bool DecoratorTiledHorizontal::Initialise(const Tile* _tiles, const String* _tex
 	// Load the textures.
 	for (int i = 0; i < 3; i++)
 	{
-		if (!_texture_names[i].Empty())
+		if (!_texture_names[i].empty())
 		{
 			tiles[i] = _tiles[i];
 			tiles[i].texture_index = LoadTexture(_texture_names[i], _rcss_paths[i]);

+ 16 - 16
Source/Core/DecoratorTiledInstancer.cpp

@@ -39,37 +39,37 @@ DecoratorTiledInstancer::~DecoratorTiledInstancer()
 // Adds the property declarations for a tile.
 void DecoratorTiledInstancer::RegisterTileProperty(const String& name, bool register_repeat_modes)
 {
-	RegisterProperty(String(32, "%s-src", name.CString()), "").AddParser("string");
-	RegisterProperty(String(32, "%s-s-begin", name.CString()), "0").AddParser("length");
-	RegisterProperty(String(32, "%s-s-end", name.CString()), "1").AddParser("length");
-	RegisterProperty(String(32, "%s-t-begin", name.CString()), "0").AddParser("length");
-	RegisterProperty(String(32, "%s-t-end", name.CString()), "1").AddParser("length");
-	RegisterShorthand(String(32, "%s-s", name.CString()), String(64, "%s-s-begin, %s-s-end", name.CString(), name.CString()));
-	RegisterShorthand(String(32, "%s-t", name.CString()), String(64, "%s-t-begin, %s-t-end", name.CString(), name.CString()));
+	RegisterProperty(CreateString(32, "%s-src", name.c_str()), "").AddParser("string");
+	RegisterProperty(CreateString(32, "%s-s-begin", name.c_str()), "0").AddParser("length");
+	RegisterProperty(CreateString(32, "%s-s-end", name.c_str()), "1").AddParser("length");
+	RegisterProperty(CreateString(32, "%s-t-begin", name.c_str()), "0").AddParser("length");
+	RegisterProperty(CreateString(32, "%s-t-end", name.c_str()), "1").AddParser("length");
+	RegisterShorthand(CreateString(32, "%s-s", name.c_str()), CreateString(64, "%s-s-begin, %s-s-end", name.c_str(), name.c_str()));
+	RegisterShorthand(CreateString(32, "%s-t", name.c_str()), CreateString(64, "%s-t-begin, %s-t-end", name.c_str(), name.c_str()));
 
 	if (register_repeat_modes)
 	{
-		RegisterProperty(String(32, "%s-repeat", name.CString()), "stretch")
+		RegisterProperty(CreateString(32, "%s-repeat", name.c_str()), "stretch")
 			.AddParser("keyword", "stretch, clamp-stretch, clamp-truncate, repeat-stretch, repeat-truncate");
-		RegisterShorthand(name, String(256, "%s-src, %s-repeat, %s-s-begin, %s-t-begin, %s-s-end, %s-t-end", name.CString(), name.CString(), name.CString(), name.CString(), name.CString(), name.CString()));
+		RegisterShorthand(name, CreateString(256, "%s-src, %s-repeat, %s-s-begin, %s-t-begin, %s-s-end, %s-t-end", name.c_str(), name.c_str(), name.c_str(), name.c_str(), name.c_str(), name.c_str()));
 	}
 	else
-		RegisterShorthand(name, String(256, "%s-src, %s-s-begin, %s-t-begin, %s-s-end, %s-t-end", name.CString(), name.CString(), name.CString(), name.CString(), name.CString()));
+		RegisterShorthand(name, CreateString(256, "%s-src, %s-s-begin, %s-t-begin, %s-s-end, %s-t-end", name.c_str(), name.c_str(), name.c_str(), name.c_str(), name.c_str()));
 }
 
 // Retrieves all the properties for a tile from the property dictionary.
 void DecoratorTiledInstancer::GetTileProperties(DecoratorTiled::Tile& tile, String& texture_name, String& rcss_path, const PropertyDictionary& properties, const String& name)
 {
-	LoadTexCoord(properties, String(32, "%s-s-begin", name.CString()), tile.texcoords[0].x, tile.texcoords_absolute[0][0]);
-	LoadTexCoord(properties, String(32, "%s-t-begin", name.CString()), tile.texcoords[0].y, tile.texcoords_absolute[0][1]);
-	LoadTexCoord(properties, String(32, "%s-s-end", name.CString()), tile.texcoords[1].x, tile.texcoords_absolute[1][0]);
-	LoadTexCoord(properties, String(32, "%s-t-end", name.CString()), tile.texcoords[1].y, tile.texcoords_absolute[1][1]);
+	LoadTexCoord(properties, CreateString(32, "%s-s-begin", name.c_str()), tile.texcoords[0].x, tile.texcoords_absolute[0][0]);
+	LoadTexCoord(properties, CreateString(32, "%s-t-begin", name.c_str()), tile.texcoords[0].y, tile.texcoords_absolute[0][1]);
+	LoadTexCoord(properties, CreateString(32, "%s-s-end", name.c_str()), tile.texcoords[1].x, tile.texcoords_absolute[1][0]);
+	LoadTexCoord(properties, CreateString(32, "%s-t-end", name.c_str()), tile.texcoords[1].y, tile.texcoords_absolute[1][1]);
 
-	const Property* repeat_property = properties.GetProperty(String(32, "%s-repeat", name.CString()));
+	const Property* repeat_property = properties.GetProperty(CreateString(32, "%s-repeat", name.c_str()));
 	if (repeat_property != NULL)
 		tile.repeat_mode = (DecoratorTiled::TileRepeatMode) repeat_property->value.Get< int >();
 
-	const Property* texture_property = properties.GetProperty(String(32, "%s-src", name.CString()));
+	const Property* texture_property = properties.GetProperty(CreateString(32, "%s-src", name.c_str()));
 	texture_name = texture_property->Get< String >();
 	rcss_path = texture_property->source;
 }

+ 1 - 1
Source/Core/DecoratorTiledVertical.cpp

@@ -66,7 +66,7 @@ bool DecoratorTiledVertical::Initialise(const Tile* _tiles, const String* _textu
 	// Load the textures.
 	for (int i = 0; i < 3; i++)
 	{
-		if (!_texture_names[i].Empty())
+		if (!_texture_names[i].empty())
 		{
 			tiles[i] = _tiles[i];
 			tiles[i].texture_index = LoadTexture(_texture_names[i], _rcss_paths[i]);

+ 13 - 13
Source/Core/Dictionary.cpp

@@ -171,7 +171,7 @@ namespace Core {
  equally good collision statistics, needed less code & used less memory.
  */
 
-static String dummy_key = String(128, "###DUMMYROCKETDICTKEY%d###", &dummy_key);
+static String dummy_key = CreateString(128, "###DUMMYROCKETDICTKEY%d###", &dummy_key);
 
 Dictionary::Dictionary() 
 { 
@@ -237,7 +237,7 @@ Dictionary::DictionaryEntry* Dictionary::Retrieve(const String& key, Hash hash)
 		
 	i = hash & mask;
 	ep = &ep0[i];
-	if (ep->key.Empty() || ep->key == key)
+	if (ep->key.empty() || ep->key == key)
 		return ep;
 	if (ep->key == dummy_key)
 		freeslot = ep;
@@ -253,7 +253,7 @@ Dictionary::DictionaryEntry* Dictionary::Retrieve(const String& key, Hash hash)
 	for (perturb = hash; ; perturb >>= PERTURB_SHIFT) {
 		i = (i << 2) + i + perturb + 1;
 		ep = &ep0[i & mask];
-		if (ep->key.Empty())    
+		if (ep->key.empty())    
 			return freeslot == NULL ? ep : freeslot;
 		/*if (ep->me_key == key
 		    || (ep->me_hash == hash
@@ -282,7 +282,7 @@ void Dictionary::Insert(const String& key, Hash hash, const Variant& value)
 	} 
 	else 
 	{
-		if (ep->key.Empty())
+		if (ep->key.empty())
 		{
 			num_full++;
 		}
@@ -379,7 +379,7 @@ bool Dictionary::Reserve(int minused)
 			
 			//delete[] ep->key;
 		}
-		else if (!ep->key.Empty()) {	/* dummy_key entry */
+		else if (!ep->key.empty()) {	/* dummy_key entry */
 			--i;
 			ROCKET_ASSERT(ep->key == dummy_key);
 		}
@@ -396,10 +396,10 @@ Variant* Dictionary::Get(const String& key) const
 	Hash hash;
 	
 	DICTIONARY_DEBUG_CODE( Log::Message(LC_CORE, Log::LT_ALWAYS, "Dictionary::Get %s", key); );
-	hash = StringUtilities::FNVHash( key.CString() );
+	hash = StringUtilities::FNVHash( key.c_str() );
 	
 	DictionaryEntry* result = Retrieve(key, hash);
-	if (!result || result->key.Empty() || result->key == dummy_key)
+	if (!result || result->key.empty() || result->key == dummy_key)
 	{
 		return NULL;
 	}
@@ -420,7 +420,7 @@ Variant* Dictionary::operator[](const String& key) const
 */
 void Dictionary::Set(const String& key, const Variant &value)
 {
-	if (key.Empty())
+	if (key.empty())
 	{
 		Log::Message(Log::LT_WARNING, "Unable to set value on dictionary, empty key specified.");
 		return;
@@ -430,7 +430,7 @@ void Dictionary::Set(const String& key, const Variant &value)
 	unsigned int n_used;  
 	
 	DICTIONARY_DEBUG_CODE( Log::Message(LC_CORE, Log::LT_ALWAYS, "Dictionary::Set %s", key); );
-	hash = StringUtilities::FNVHash( key.CString() );
+	hash = StringUtilities::FNVHash( key.c_str() );
 	
 	ROCKET_ASSERT(num_full <= mask);  /* at least one empty slot */
 	n_used = num_used;  
@@ -458,7 +458,7 @@ bool Dictionary::Remove(const String& key)
 	DictionaryEntry *ep;  
 	
 	DICTIONARY_DEBUG_CODE( Log::Message(LC_CORE, Log::LT_ALWAYS, "Dictionary::Remove %s", key) );
-	hash = StringUtilities::FNVHash( key.CString() );
+	hash = StringUtilities::FNVHash( key.c_str() );
 	
 	ep = Retrieve(key, hash);
 	
@@ -494,9 +494,9 @@ void Dictionary::Clear()
 		ROCKET_ASSERT(i < n);
 		++i;
 
-		if (!ep->key.Empty()) {
+		if (!ep->key.empty()) {
 			--n_full;
-			ep->key.Clear();		
+			ep->key.clear();		
 			ep->value.Clear();
 		} else {
 			ROCKET_ASSERT(ep->value.GetType() == Variant::NONE);
@@ -593,7 +593,7 @@ void Dictionary::ResetToMinimumSize()
 	for ( size_t i = 0; i < DICTIONARY_MINSIZE; i++ )
 	{		
 		small_table[i].hash = 0;
-		small_table[i].key.Clear();
+		small_table[i].key.clear();
 		small_table[i].value.Clear();
 	}
 	num_used = 0;

+ 4 - 4
Source/Core/DocumentHeader.cpp

@@ -36,10 +36,10 @@ namespace Core {
 void DocumentHeader::MergeHeader(const DocumentHeader& header)
 {
 	// Copy the title across if ours is empty
-	if (title.Empty())
+	if (title.empty())
 		title = header.title;
 	// Copy the url across if ours is empty
-	if (source.Empty())
+	if (source.empty())
 		source = header.source;
 
 	// Combine internal data	
@@ -57,9 +57,9 @@ void DocumentHeader::MergePaths(StringList& target, const StringList& source, co
 	for (size_t i = 0; i < source.size(); i++)
 	{
 		String joined_path;
-		Rocket::Core::GetSystemInterface()->JoinPath(joined_path, source_path.Replace("|", ":"), source[i].Replace("|", ":"));
+		Rocket::Core::GetSystemInterface()->JoinPath(joined_path, Replace(source_path, "|", ":"), Replace(source[i], "|", ":"));
 
-		target.push_back(joined_path.Replace(":", "|"));
+		target.push_back(Replace(joined_path, ":", "|"));
 	}
 }
 

+ 16 - 16
Source/Core/Element.cpp

@@ -81,7 +81,7 @@ public:
 Element::Element(const String& _tag) : relative_offset_base(0, 0), relative_offset_position(0, 0), absolute_offset(0, 0), scroll_offset(0, 0), boxes(1), 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)
 {
-	tag = _tag.ToLower();
+	tag = ToLower(_tag);
 	parent = NULL;
 	focus = NULL;
 	instancer = NULL;
@@ -278,16 +278,16 @@ String Element::GetAddress(bool include_pseudo_classes) const
 	String address(tag);
 
 	// Add the ID if we have one.
-	if (!id.Empty())
+	if (!id.empty())
 	{
 		address += "#";
 		address += id;
 	}
 
 	String classes = style->GetClassNames();
-	if (!classes.Empty())
+	if (!classes.empty())
 	{
-		classes = classes.Replace(".", " ");
+		classes = Replace(classes, ".", " ");
 		address += ".";
 		address += classes;
 	}
@@ -304,7 +304,7 @@ String Element::GetAddress(bool include_pseudo_classes) const
 
 	if (parent)
 	{
-		address.Append(" < ");
+		address += " < ";
 		return address + parent->GetAddress(true);
 	}
 	else
@@ -2019,7 +2019,7 @@ void Element::OnReferenceDeactivate()
 	{
 		// Hopefully we can just delete ourselves.
 		//delete this;
-		Log::Message(Log::LT_WARNING, "Leak detected: element %s not instanced via Rocket Factory. Unable to release.", GetAddress().CString());
+		Log::Message(Log::LT_WARNING, "Leak detected: element %s not instanced via Rocket Factory. Unable to release.", GetAddress().c_str());
 	}
 }
 
@@ -2071,32 +2071,32 @@ void Element::GetRML(String& content)
 {
 	// First we start the open tag, add the attributes then close the open tag.
 	// Then comes the children in order, then we add our close tag.
-	content.Append("<");
-	content.Append(tag);
+	content += "<";
+	content += tag;
 
 	int index = 0;
 	String name;
 	String value;
 	while (IterateAttributes(index, name, value))	
 	{
-		size_t length = name.Length() + value.Length() + 8;
-		String attribute(length, " %s=\"%s\"", name.CString(), value.CString());
-		content.Append(attribute);
+		size_t length = name.size() + value.size() + 8;
+		String attribute = CreateString(length, " %s=\"%s\"", name.c_str(), value.c_str());
+		content += attribute;
 	}
 
 	if (HasChildNodes())
 	{
-		content.Append(">");
+		content += ">";
 
 		GetInnerRML(content);
 
-		content.Append("</");
-		content.Append(tag);
-		content.Append(">");
+		content += "</";
+		content += tag;
+		content += ">";
 	}
 	else
 	{
-		content.Append(" />");
+		content += " />";
 	}
 }
 

+ 2 - 2
Source/Core/ElementAnimation.cpp

@@ -371,7 +371,7 @@ ElementAnimation::ElementAnimation(const String& property_name, const Property&
 {
 	if (!current_value.definition)
 	{
-		Log::Message(Log::LT_WARNING, "Property in animation key did not have a definition (while adding key '%s').", current_value.ToString().CString());
+		Log::Message(Log::LT_WARNING, "Property in animation key did not have a definition (while adding key '%s').", current_value.ToString().c_str());
 	}
 	InternalAddKey(AnimationKey{ 0.0f, current_value, Tween{} });
 }
@@ -382,7 +382,7 @@ bool ElementAnimation::InternalAddKey(AnimationKey key)
 
 	if (!(key.property.unit & valid_properties))
 	{
-		Log::Message(Log::LT_WARNING, "Property '%s' is not a valid target for interpolation.", key.property.ToString().CString());
+		Log::Message(Log::LT_WARNING, "Property '%s' is not a valid target for interpolation.", key.property.ToString().c_str());
 		return false;
 	}
 

+ 9 - 9
Source/Core/ElementDefinition.cpp

@@ -347,11 +347,11 @@ void ElementDefinition::BuildPropertyGroup(PropertyGroupMap& groups, const Strin
 	for (PropertyMap::const_iterator property_iterator = element_properties.GetProperties().begin(); property_iterator != element_properties.GetProperties().end(); ++property_iterator)
 	{
 		const String& property_name = (*property_iterator).first;
-		if (property_name.Length() > property_suffix.Length() &&
-			strcasecmp(property_name.CString() + (property_name.Length() - property_suffix.Length()), property_suffix.CString()) == 0)
+		if (property_name.size() > property_suffix.size() &&
+			strcasecmp(property_name.c_str() + (property_name.size() - property_suffix.size()), property_suffix.c_str()) == 0)
 		{
 			// We've found a group declaration!
-			String group_name = property_name.Substring(0, property_name.Length() - (group_type.Length() + 1));
+			String group_name = property_name.substr(0, property_name.size() - (group_type.size() + 1));
 			String group_class = (*property_iterator).second.value.Get< String >();
 			PropertyDictionary* group_properties = NULL;		
 
@@ -416,11 +416,11 @@ int ElementDefinition::BuildPropertyGroupDictionary(PropertyDictionary& group_pr
 	for (PropertyMap::const_iterator property_iterator = element_properties.GetProperties().begin(); property_iterator != element_properties.GetProperties().end(); ++property_iterator)
 	{
 		const String& full_property_name = (*property_iterator).first;
-		if (full_property_name.Length() > group_name.Length() + 1 &&
-			strncasecmp(full_property_name.CString(), group_name.CString(), group_name.Length()) == 0 &&
-			full_property_name[group_name.Length()] == '-')
+		if (full_property_name.size() > group_name.size() + 1 &&
+			strncasecmp(full_property_name.c_str(), group_name.c_str(), group_name.size()) == 0 &&
+			full_property_name[group_name.size()] == '-')
 		{
-			String property_name = full_property_name.Substring(group_name.Length() + 1);
+			String property_name = full_property_name.substr(group_name.size() + 1);
 //			if (property_name == group_type)
 //				continue;
 
@@ -457,7 +457,7 @@ bool ElementDefinition::InstanceDecorator(const String& name, const String& type
 	Decorator* decorator = Factory::InstanceDecorator(type, properties);
 	if (decorator == NULL)
 	{
-		Log::Message(Log::LT_WARNING, "Failed to instance decorator '%s' of type '%s'.", name.CString(), type.CString());
+		Log::Message(Log::LT_WARNING, "Failed to instance decorator '%s' of type '%s'.", name.c_str(), type.c_str());
 		return false;
 	}
 
@@ -508,7 +508,7 @@ bool ElementDefinition::InstanceFontEffect(const String& name, const String& typ
 	FontEffect* font_effect = FontDatabase::GetFontEffect(type, properties);
 	if (font_effect == NULL)
 	{
-		Log::Message(Log::LT_WARNING, "Failed to instance font effect '%s' of type '%s'.", name.CString(), type.CString());
+		Log::Message(Log::LT_WARNING, "Failed to instance font effect '%s' of type '%s'.", name.c_str(), type.c_str());
 		return false;
 	}
 

+ 4 - 4
Source/Core/ElementDocument.cpp

@@ -79,7 +79,7 @@ void ElementDocument::ProcessHeader(const DocumentHeader* document_header)
 		if (merge_template)
 			header.MergeHeader(*merge_template->GetHeader());
 		else
-			Log::Message(Log::LT_WARNING, "Template %s not found", header.template_resources[i].CString());
+			Log::Message(Log::LT_WARNING, "Template %s not found", header.template_resources[i].c_str());
 	}
 
 	// Merge the document's header last, as it is the most overriding.
@@ -100,7 +100,7 @@ void ElementDocument::ProcessHeader(const DocumentHeader* document_header)
 		for (size_t i = 0;i < header.rcss_inline.size(); i++)
 		{			
 			StyleSheet* new_sheet = new StyleSheet();
-			StreamMemory* stream = new StreamMemory((const byte*) header.rcss_inline[i].CString(), header.rcss_inline[i].Length());
+			StreamMemory* stream = new StreamMemory((const byte*) header.rcss_inline[i].c_str(), header.rcss_inline[i].size());
 			stream->SetSourceURL(document_header->source);
 
 			if (new_sheet->LoadStyleSheet(stream))
@@ -142,7 +142,7 @@ void ElementDocument::ProcessHeader(const DocumentHeader* document_header)
 	// Load internal scripts.
 	for (size_t i = 0; i < header.scripts_inline.size(); i++)
 	{
-		StreamMemory* stream = new StreamMemory((const byte*) header.scripts_inline[i].CString(), header.scripts_inline[i].Length());
+		StreamMemory* stream = new StreamMemory((const byte*) header.scripts_inline[i].c_str(), header.scripts_inline[i].size());
 		LoadScript(stream, "");
 		stream->RemoveReference();
 	}
@@ -282,7 +282,7 @@ ElementText* ElementDocument::CreateTextNode(const String& text)
 	}
 	
 	// Set the text
-	element_text->SetText(text);
+	element_text->SetText(ToWideString(text));
 
 	return element_text;
 }

+ 2 - 2
Source/Core/ElementHandle.cpp

@@ -73,11 +73,11 @@ void ElementHandle::ProcessEvent(Event& event)
 		if (!initialised && GetOwnerDocument())
 		{
 			String move_target_name = GetAttribute<String>("move_target", "");
-			if (!move_target_name.Empty())
+			if (!move_target_name.empty())
 				move_target = GetElementById(move_target_name);
 
 			String size_target_name = GetAttribute<String>("size_target", "");
-			if (!size_target_name.Empty())
+			if (!size_target_name.empty())
 				size_target = GetElementById(size_target_name);
 
 			initialised = true;

+ 4 - 4
Source/Core/ElementImage.cpp

@@ -122,19 +122,19 @@ void ElementImage::OnAttributeChange(const Rocket::Core::AttributeNameList& chan
 
 			if (coords_list.size() != 4)
 			{
-				Rocket::Core::Log::Message(Log::LT_WARNING, "Element '%s' has an invalid 'coords' attribute; coords requires 4 values, found %d.", GetAddress().CString(), coords_list.size());
+				Rocket::Core::Log::Message(Log::LT_WARNING, "Element '%s' has an invalid 'coords' attribute; coords requires 4 values, found %d.", GetAddress().c_str(), coords_list.size());
 				ResetCoords();
 			}
 			else
 			{
 				for (size_t i = 0; i < 4; ++i)
-					coords[i] = atoi(coords_list[i].CString());
+					coords[i] = atoi(coords_list[i].c_str());
 
 				// Check for the validity of the coordinates.
 				if (coords[0] < 0 || coords[2] < coords[0] ||
 					coords[1] < 0 || coords[3] < coords[1])
 				{
-					Rocket::Core::Log::Message(Log::LT_WARNING, "Element '%s' has an invalid 'coords' attribute; invalid coordinate values specified.", GetAddress().CString());
+					Rocket::Core::Log::Message(Log::LT_WARNING, "Element '%s' has an invalid 'coords' attribute; invalid coordinate values specified.", GetAddress().c_str());
 					ResetCoords();
 				}
 				else
@@ -228,7 +228,7 @@ bool ElementImage::LoadTexture()
 
 	// Get the source URL for the image.
 	String image_source = GetAttribute< String >("src", "");
-	if (image_source.Empty())
+	if (image_source.empty())
 		return false;
 
 	geometry_dirty = true;

+ 3 - 3
Source/Core/ElementStyle.cpp

@@ -337,9 +337,9 @@ String ElementStyle::GetClassNames() const
 	{
 		if (i != 0)
 		{
-			class_names.Append(" ");
+			class_names += " ";
 		}
-		class_names.Append(classes[i]);
+		class_names += classes[i];
 	}
 
 	return class_names;
@@ -358,7 +358,7 @@ bool ElementStyle::SetProperty(const String& name, const String& value)
 	}
 	else
 	{
-		Log::Message(Log::LT_WARNING, "Syntax error parsing inline property declaration '%s: %s;'.", name.CString(), value.CString());
+		Log::Message(Log::LT_WARNING, "Syntax error parsing inline property declaration '%s: %s;'.", name.c_str(), value.c_str());
 		return false;
 	}
 }

+ 17 - 19
Source/Core/ElementTextDefault.cpp

@@ -147,7 +147,7 @@ bool ElementTextDefault::GenerateToken(float& token_width, int line_begin)
 	// Bail if we don't have a valid font face.
 	FontFaceHandle* font_face_handle = GetFontFaceHandle();
 	if (font_face_handle == NULL ||
-		line_begin >= (int) text.Length())
+		line_begin >= (int) text.size())
 		return 0;
 
 	// Determine how we are processing white-space while formatting the text.
@@ -159,13 +159,13 @@ bool ElementTextDefault::GenerateToken(float& token_width, int line_begin)
 							white_space_property == WHITE_SPACE_PRE_WRAP ||
 							white_space_property == WHITE_SPACE_PRE_LINE;
 
-	const word* token_begin = text.CString() + line_begin;
+	const word* token_begin = text.c_str() + line_begin;
 	WString token;
 
-	BuildToken(token, token_begin, text.CString() + text.Length(), true, collapse_white_space, break_at_endline, GetTextTransform());
+	BuildToken(token, token_begin, text.c_str() + text.size(), true, collapse_white_space, break_at_endline, GetTextTransform());
 	token_width = (float) font_face_handle->GetStringWidth(token, 0);
 
-	return LastToken(token_begin, text.CString() + text.Length(), collapse_white_space, break_at_endline);
+	return LastToken(token_begin, text.c_str() + text.size(), collapse_white_space, break_at_endline);
 }
 
 // Generates a line of text rendered from this element
@@ -174,7 +174,7 @@ bool ElementTextDefault::GenerateLine(WString& line, int& line_length, float& li
 	FontFaceHandle* font_face_handle = GetFontFaceHandle();
 
 	// Initialise the output variables.
-	line.Clear();
+	line.clear();
 	line_length = 0;
 	line_width = 0;
 
@@ -202,21 +202,21 @@ bool ElementTextDefault::GenerateLine(WString& line, int& line_length, float& li
 	// white-space parsing parameters. Each section is then appended to the line if it can fit. If not, or if an
 	// endline is found (and we're processing them), then the line is ended. kthxbai!
 
-	const word* token_begin = text.CString() + line_begin;
-	const word* string_end = text.CString() + text.Length();
+	const word* token_begin = text.c_str() + line_begin;
+	const word* string_end = text.c_str() + text.size();
 	while (token_begin != string_end)
 	{
 		WString token;
 		const word* next_token_begin = token_begin;
 
 		// Generate the next token and determine its pixel-length.
-		bool break_line = BuildToken(token, next_token_begin, string_end, line.Empty() && trim_whitespace_prefix, collapse_white_space, break_at_endline, text_transform_property);
-		int token_width = font_face_handle->GetStringWidth(token, line.Empty() ? 0 : line[line.Length() - 1]);
+		bool break_line = BuildToken(token, next_token_begin, string_end, line.empty() && trim_whitespace_prefix, collapse_white_space, break_at_endline, text_transform_property);
+		int token_width = font_face_handle->GetStringWidth(token, line.empty() ? 0 : line[line.size() - 1]);
 
 		// If we're breaking to fit a line box, check if the token can fit on the line before we add it.
 		if (break_at_line)
 		{
-			if (!line.Empty() &&
+			if (!line.empty() &&
 				(line_width + token_width > maximum_line_width ||
 				 LastToken(next_token_begin, string_end, collapse_white_space, break_at_endline) && line_width + token_width > maximum_line_width - right_spacing_width))
 			{
@@ -354,7 +354,7 @@ void ElementTextDefault::OnPropertyChange(const PropertyNameList& changed_proper
 // Returns the RML of this element
 void ElementTextDefault::GetRML(String& content)
 {
-	text.ToUTF8(content, true);
+	content += ToUTF8(text);
 }
 
 // Forces a reevaluation of applicable font effects.
@@ -434,7 +434,7 @@ static bool BuildToken(WString& token, const word*& token_begin, const word* str
 {
 	ROCKET_ASSERT(token_begin != string_end);
 
-	token.Reserve(string_end - token_begin + token.Length());
+	token.reserve(string_end - token_begin + token.size());
 
 	// Check what the first character of the token is; all we need to know is if it is white-space or not.
 	bool parsing_white_space = StringUtilities::IsWhitespace(*token_begin);
@@ -470,18 +470,16 @@ static bool BuildToken(WString& token, const word*& token_begin, const word* str
 			else
 			{
 				WString ucs2_escape_code(escape_begin + 1, token_begin);
-				String escape_code;
-				ucs2_escape_code.ToUTF8(escape_code);
 
-				if (ucs2_escape_code == "lt")
+				if (ucs2_escape_code == L"lt")
 					character = '<';
-				else if (ucs2_escape_code == "gt")
+				else if (ucs2_escape_code == L"gt")
 					character = '>';
-				else if (ucs2_escape_code == "amp")
+				else if (ucs2_escape_code == L"amp")
 					character = '&';
-				else if (ucs2_escape_code == "quot")
+				else if (ucs2_escape_code == L"quot")
 					character = '"';
-				else if (ucs2_escape_code == "nbsp")
+				else if (ucs2_escape_code == L"nbsp")
 				{
 					character = ' ';
 					force_non_whitespace = true;

+ 1 - 1
Source/Core/ElementUtilities.cpp

@@ -193,7 +193,7 @@ void ElementUtilities::BindEventAttributes(Element* element)
 	// Check for and instance the on* events
 	while(element->IterateAttributes(index, name, value))
 	{
-		if (name.Substring(0, 2) == "on")
+		if (name.substr(0, 2) == "on")
 		{
 			EventListener* listener = Factory::InstanceEventListener(value, element);
 			if (listener)

+ 3 - 3
Source/Core/EventDispatcher.cpp

@@ -168,11 +168,11 @@ String EventDispatcher::ToString() const
 	String result;
 	for (auto nvp : events)
 	{
-		result += String(nvp.first.Length() + 32, "%s (%d), ", nvp.first.CString(), static_cast<int>(nvp.second.size()));
+		result += CreateString(nvp.first.size() + 32, "%s (%d), ", nvp.first.c_str(), static_cast<int>(nvp.second.size()));
 	}
-	if (result.Length() > 2) 
+	if (result.size() > 2) 
 	{
-		result.Resize(result.Length() - 2);
+		result.resize(result.size() - 2);
 	}
 	return result;
 }

+ 10 - 10
Source/Core/Factory.cpp

@@ -177,7 +177,7 @@ Context* Factory::InstanceContext(const String& name)
 
 ElementInstancer* Factory::RegisterElementInstancer(const String& name, ElementInstancer* instancer)
 {
-	String lower_case_name = name.ToLower();
+	String lower_case_name = ToLower(name);
 	instancer->AddReference();
 
 	// Check if an instancer for this tag is already defined, if so release it
@@ -240,9 +240,9 @@ bool Factory::InstanceElementText(Element* parent, const String& text)
 	String translated_data;
 	if (system_interface != NULL &&
 		(system_interface->TranslateString(translated_data, text) > 0 ||
-		 translated_data.Find("<") != String::npos))
+		 translated_data.find("<") != String::npos))
 	{
-		StreamMemory* stream = new StreamMemory(translated_data.Length() + 32);
+		StreamMemory* stream = new StreamMemory(translated_data.size() + 32);
 		stream->Write("<body>", 6);
 		stream->Write(translated_data);
 		stream->Write("</body>", 7);
@@ -255,7 +255,7 @@ bool Factory::InstanceElementText(Element* parent, const String& text)
 	{
 		// Check if this text node contains only white-space; if so, we don't want to construct it.
 		bool only_white_space = true;
-		for (size_t i = 0; i < translated_data.Length(); ++i)
+		for (size_t i = 0; i < translated_data.size(); ++i)
 		{
 			if (!StringUtilities::IsWhitespace(translated_data[i]))
 			{
@@ -272,7 +272,7 @@ bool Factory::InstanceElementText(Element* parent, const String& text)
 		Element* element = Factory::InstanceElement(parent, "#text", "#text", attributes);
 		if (!element)
 		{
-			Log::Message(Log::LT_ERROR, "Failed to instance text element '%s', instancer returned NULL.", translated_data.CString());
+			Log::Message(Log::LT_ERROR, "Failed to instance text element '%s', instancer returned NULL.", translated_data.c_str());
 			return false;
 		}
 
@@ -280,12 +280,12 @@ bool Factory::InstanceElementText(Element* parent, const String& text)
 		ElementText* text_element = dynamic_cast< ElementText* >(element);
 		if (text_element == NULL)
 		{
-			Log::Message(Log::LT_ERROR, "Failed to instance text element '%s'. Found type '%s', was expecting a derivative of ElementText.", translated_data.CString(), typeid(element).name());
+			Log::Message(Log::LT_ERROR, "Failed to instance text element '%s'. Found type '%s', was expecting a derivative of ElementText.", translated_data.c_str(), typeid(element).name());
 			element->RemoveReference();
 			return false;
 		}
 
-		text_element->SetText(translated_data);
+		text_element->SetText(ToWideString(translated_data));
 
 		// Add to active node.
 		parent->AppendChild(element);
@@ -334,7 +334,7 @@ ElementDocument* Factory::InstanceDocumentStream(Rocket::Core::Context* context,
 // Registers an instancer that will be used to instance decorators.
 DecoratorInstancer* Factory::RegisterDecoratorInstancer(const String& name, DecoratorInstancer* instancer)
 {
-	String lower_case_name = name.ToLower();
+	String lower_case_name = ToLower(name);
 	instancer->AddReference();
 
 	// Check if an instancer for this tag is already defined. If so, release it.
@@ -387,7 +387,7 @@ Decorator* Factory::InstanceDecorator(const String& name, const PropertyDictiona
 // Registers an instancer that will be used to instance font effects.
 FontEffectInstancer* Factory::RegisterFontEffectInstancer(const String& name, FontEffectInstancer* instancer)
 {
-	String lower_case_name = name.ToLower();
+	String lower_case_name = ToLower(name);
 	instancer->AddReference();
 
 	// Check if an instancer for this tag is already defined. If so, release it.
@@ -496,7 +496,7 @@ FontEffect* Factory::InstanceFontEffect(const String& name, const PropertyDictio
 // Creates a style sheet containing the passed in styles.
 StyleSheet* Factory::InstanceStyleSheetString(const String& string)
 {
-	StreamMemory* memory_stream = new StreamMemory((const byte*) string.CString(), string.Length());
+	StreamMemory* memory_stream = new StreamMemory((const byte*) string.c_str(), string.size());
 	StyleSheet* style_sheet = InstanceStyleSheetStream(memory_stream);
 	memory_stream->RemoveReference();
 	return style_sheet;

+ 1 - 1
Source/Core/FileInterfaceDefault.cpp

@@ -40,7 +40,7 @@ FileInterfaceDefault::~FileInterfaceDefault()
 // Opens a file.
 FileHandle FileInterfaceDefault::Open(const String& path)
 {
-	return (FileHandle)fopen(path.CString(), "rb");	
+	return (FileHandle)fopen(path.c_str(), "rb");	
 }
 
 // Closes a previously opened file.

+ 1 - 1
Source/Core/FontDatabase.cpp

@@ -150,7 +150,7 @@ bool FontDatabase::LoadFontFace(FontProviderType font_provider_type, const byte*
 
 FontDatabase::FontProviderType FontDatabase::GetFontProviderType(const String& file_name)
 {
-    if(file_name.Find(".fnt") != String::npos)
+    if(file_name.find(".fnt") != String::npos)
     {
         return BitmapFont;
     }

+ 1 - 1
Source/Core/FontEffectInstancer.cpp

@@ -49,7 +49,7 @@ const PropertySpecification& FontEffectInstancer::GetPropertySpecification() con
 PropertyDefinition& FontEffectInstancer::RegisterProperty(const String& property_name, const String& default_value, bool affects_generation)
 {
 	if (affects_generation)
-		volatile_properties.insert(property_name.ToLower());
+		volatile_properties.insert(ToLower(property_name));
 
 	return properties.RegisterProperty(property_name, default_value, false, false);
 }

+ 3 - 3
Source/Core/FontFaceHandle.cpp

@@ -108,7 +108,7 @@ int FontFaceHandle::GetStringWidth(const WString& string, word prior_character)
 {
 	int width = 0;
 
-	for (size_t i = 0; i < string.Length(); i++)
+	for (size_t i = 0; i < string.size(); i++)
 	{
 		word character_code = string[i];
 
@@ -241,8 +241,8 @@ int FontFaceHandle::GenerateString(GeometryList& geometry, const WString& string
 		line_width = 0;
 		word prior_character = 0;
 
-		const word* string_iterator = string.CString();
-		const word* string_end = string.CString() + string.Length();
+		const word* string_iterator = string.c_str();
+		const word* string_end = string.c_str() + string.size();
 
 		for (; string_iterator != string_end; string_iterator++)
 		{

+ 1 - 1
Source/Core/FontFaceLayer.cpp

@@ -150,7 +150,7 @@ bool FontFaceLayer::Initialise(const FontFaceHandle* _handle, FontEffect* _effec
 		for (int i = 0; i < texture_layout.GetNumTextures(); ++i)
 		{
 			Texture texture;
-			if (!texture.Load(String(64, "?font::%p/%p/%d", handle, effect, i)))
+			if (!texture.Load(CreateString(64, "?font::%p/%p/%d", handle, effect, i)))
 				return false;
 
 			textures.push_back(texture);

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

@@ -69,7 +69,7 @@ Rocket::Core::FontFaceHandle* FontFace::GetHandle(const String& _raw_charset, in
 		// Check all the handles if their charsets contain the requested charset.
 		if (!UnicodeRange::BuildList(charset, raw_charset))
 		{
-			Log::Message(Log::LT_ERROR, "Invalid font charset '%s'.", _raw_charset.CString());
+			Log::Message(Log::LT_ERROR, "Invalid font charset '%s'.", _raw_charset.c_str());
 			return NULL;
 		}
 

+ 4 - 4
Source/Core/FreeType/FontFaceHandle.cpp

@@ -62,7 +62,7 @@ bool FontFaceHandle::Initialise(FT_Face ft_face, const String& _charset, int _si
 	raw_charset = _charset;
 	if (!UnicodeRange::BuildList(charset, raw_charset))
 	{
-		Log::Message(Log::LT_ERROR, "Invalid font charset '%s'.", raw_charset.CString());
+		Log::Message(Log::LT_ERROR, "Invalid font charset '%s'.", raw_charset.c_str());
 		return false;
 	}
 
@@ -103,7 +103,7 @@ int FontFaceHandle::GetStringWidth(const WString& string, word prior_character)
 {
 	int width = 0;
 
-	for (size_t i = 0; i < string.Length(); i++)
+	for (size_t i = 0; i < string.size(); i++)
 	{
 		word character_code = string[i];
 
@@ -236,8 +236,8 @@ int FontFaceHandle::GenerateString(GeometryList& geometry, const WString& string
 		line_width = 0;
 		word prior_character = 0;
 
-		const word* string_iterator = string.CString();
-		const word* string_end = string.CString() + string.Length();
+		const word* string_iterator = string.c_str();
+		const word* string_end = string.c_str() + string.size();
 
 		for (; string_iterator != string_end; string_iterator++)
 		{

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

@@ -97,7 +97,7 @@ bool FontProvider::LoadFontFace(const String& file_name)
 	FT_Face ft_face = (FT_Face) instance->LoadFace(file_name);
 	if (ft_face == NULL)
 	{
-		Log::Message(Log::LT_ERROR, "Failed to load font face from %s.", file_name.CString());
+		Log::Message(Log::LT_ERROR, "Failed to load font face from %s.", file_name.c_str());
 		return false;
 	}
 
@@ -106,12 +106,12 @@ bool FontProvider::LoadFontFace(const String& file_name)
 
 	if (instance->AddFace(ft_face, ft_face->family_name, style, weight, true))
 	{
-		Log::Message(Log::LT_INFO, "Loaded font face %s %s (from %s).", ft_face->family_name, ft_face->style_name, file_name.CString());
+		Log::Message(Log::LT_INFO, "Loaded font face %s %s (from %s).", ft_face->family_name, ft_face->style_name, file_name.c_str());
 		return true;
 	}
 	else
 	{
-		Log::Message(Log::LT_ERROR, "Failed to load font face %s %s (from %s).", ft_face->family_name, ft_face->style_name, file_name.CString());
+		Log::Message(Log::LT_ERROR, "Failed to load font face %s %s (from %s).", ft_face->family_name, ft_face->style_name, file_name.c_str());
 		return false;
 	}
 }
@@ -122,18 +122,18 @@ bool FontProvider::LoadFontFace(const String& file_name, const String& family, F
 	FT_Face ft_face = (FT_Face) instance->LoadFace(file_name);
 	if (ft_face == NULL)
 	{
-		Log::Message(Log::LT_ERROR, "Failed to load font face from %s.", file_name.CString());
+		Log::Message(Log::LT_ERROR, "Failed to load font face from %s.", file_name.c_str());
 		return false;
 	}
 
 	if (instance->AddFace(ft_face, family, style, weight, true))
 	{
-		Log::Message(Log::LT_INFO, "Loaded font face %s %s (from %s).", ft_face->family_name, ft_face->style_name, file_name.CString());
+		Log::Message(Log::LT_INFO, "Loaded font face %s %s (from %s).", ft_face->family_name, ft_face->style_name, file_name.c_str());
 		return true;
 	}
 	else
 	{
-		Log::Message(Log::LT_ERROR, "Failed to load font face %s %s (from %s).", ft_face->family_name, ft_face->style_name, file_name.CString());
+		Log::Message(Log::LT_ERROR, "Failed to load font face %s %s (from %s).", ft_face->family_name, ft_face->style_name, file_name.c_str());
 		return false;
 	}
 }
@@ -228,7 +228,7 @@ void* FontProvider::LoadFace(const byte* data, int data_length, const String& so
 	int error = FT_New_Memory_Face(ft_library, (const FT_Byte*) data, data_length, 0, &face);
 	if (error != 0)
 	{
-		Log::Message(Log::LT_ERROR, "FreeType error %d while loading face from %s.", error, source.CString());
+		Log::Message(Log::LT_ERROR, "FreeType error %d while loading face from %s.", error, source.c_str());
 		if (local_data)
 			delete[] data;
 
@@ -241,7 +241,7 @@ void* FontProvider::LoadFace(const byte* data, int data_length, const String& so
 		FT_Select_Charmap(face, FT_ENCODING_APPLE_ROMAN);
 		if (face->charmap == NULL)
 		{
-			Log::Message(Log::LT_ERROR, "Font face (from %s) does not contain a Unicode or Apple Roman character map.", source.CString());
+			Log::Message(Log::LT_ERROR, "Font face (from %s) does not contain a Unicode or Apple Roman character map.", source.c_str());
 			FT_Done_Face(face);
 			if (local_data)
 				delete[] data;

+ 1 - 1
Source/Core/LayoutInlineBoxText.cpp

@@ -155,7 +155,7 @@ void LayoutInlineBoxText::BuildWordBox()
 		baseline = 0;
 
 		// For unknown reasons, this gets triggered during document load. Seems to cause no trouble, remove warning.
-		Log::Message(Log::LT_WARNING, "No font face defined on element %s. Please specify a font-family in your RCSS.", text_element->GetAddress().CString());
+		Log::Message(Log::LT_WARNING, "No font face defined on element %s. Please specify a font-family in your RCSS.", text_element->GetAddress().c_str());
 		return;
 	}
 

+ 3 - 3
Source/Core/Log.cpp

@@ -84,14 +84,14 @@ void Log::ParseError(const String& filename, int line_number, const char* fmt, .
 	va_end(argument_list);
 
 	if (line_number >= 0)
-		Message(Log::LT_ERROR, "%s:%d: %s", filename.CString(), line_number, buffer);
+		Message(Log::LT_ERROR, "%s:%d: %s", filename.c_str(), line_number, buffer);
 	else
-		Message(Log::LT_ERROR, "%s: %s", filename.CString(), buffer);
+		Message(Log::LT_ERROR, "%s: %s", filename.c_str(), buffer);
 }
 
 bool Assert(const char* msg, const char* file, int line)
 {
-	Rocket::Core::String message(1024, "%s\n%s:%d", msg, file, line);
+	Rocket::Core::String message = CreateString(1024, "%s\n%s:%d", msg, file, line);
 	return GetSystemInterface()->LogMessage(Log::LT_ASSERT, message);
 }
 

+ 15 - 15
Source/Core/PropertyDefinition.cpp

@@ -53,12 +53,12 @@ PropertyDefinition& PropertyDefinition::AddParser(const String& parser_name, con
 	new_parser.parser = StyleSheetSpecification::GetParser(parser_name);
 	if (new_parser.parser == NULL)
 	{
-		Log::Message(Log::LT_ERROR, "Property was registered with invalid parser '%s'.", parser_name.CString());
+		Log::Message(Log::LT_ERROR, "Property was registered with invalid parser '%s'.", parser_name.c_str());
 		return *this;
 	}
 
 	// Split the parameter list, and set up the map.
-	if (!parser_parameters.Empty())
+	if (!parser_parameters.empty())
 	{
 		StringList parameter_list;
 		StringUtilities::ExpandString(parameter_list, parser_parameters);
@@ -128,22 +128,22 @@ bool PropertyDefinition::GetValue(String& value, const Property& property) const
 		case Property::COLOUR:
 		{
 			Colourb colour = property.value.Get< Colourb >();
-			value.FormatString(32, "rgb(%d,%d,%d,%d)", colour.red, colour.green, colour.blue, colour.alpha);
+			value = CreateString(32, "rgb(%d,%d,%d,%d)", colour.red, colour.green, colour.blue, colour.alpha);
 		}
 		break;
 
-		case Property::PX:		value.Append("px"); break;
-		case Property::DEG:		value.Append("deg"); break;
-		case Property::RAD:		value.Append("rad"); break;
-		case Property::DP:		value.Append("dp"); break;
-		case Property::EM:		value.Append("em"); break;
-		case Property::REM:		value.Append("rem"); break;
-		case Property::PERCENT:	value.Append("%"); break;
-		case Property::INCH:	value.Append("in"); break;
-		case Property::CM:		value.Append("cm"); break;
-		case Property::MM:		value.Append("mm"); break;
-		case Property::PT:		value.Append("pt"); break;
-		case Property::PC:		value.Append("pc"); break;
+		case Property::PX:		value += "px"; break;
+		case Property::DEG:		value += "deg"; break;
+		case Property::RAD:		value += "rad"; break;
+		case Property::DP:		value += "dp"; break;
+		case Property::EM:		value += "em"; break;
+		case Property::REM:		value += "rem"; break;
+		case Property::PERCENT:	value += "%"; break;
+		case Property::INCH:	value += "in"; break;
+		case Property::CM:		value += "cm"; break;
+		case Property::MM:		value += "mm"; break;
+		case Property::PT:		value += "pt"; break;
+		case Property::PC:		value += "pc"; break;
 		default:					break;
 	}
 

+ 6 - 6
Source/Core/PropertyParserAnimation.cpp

@@ -128,7 +128,7 @@ static bool ParseAnimation(Property & property, const StringList& animation_valu
 
 		for (auto& argument : arguments)
 		{
-			if (argument.Empty())
+			if (argument.empty())
 				continue;
 
 			// See if we have a <keyword> or <tween> specifier as defined in keywords
@@ -167,7 +167,7 @@ static bool ParseAnimation(Property & property, const StringList& animation_valu
 				float number = 0.0f;
 				int count = 0;
 
-				if (sscanf(argument.CString(), "%fs%n", &number, &count) == 1)
+				if (sscanf(argument.c_str(), "%fs%n", &number, &count) == 1)
 				{
 					// Found a number, if there was an 's' unit, count will be positive
 					if (count > 0)
@@ -207,7 +207,7 @@ static bool ParseAnimation(Property & property, const StringList& animation_valu
 		}
 
 		// Validate the parsed transition
-		if (animation.name.Empty() || animation.duration <= 0.0f || (animation.num_iterations < -1 || animation.num_iterations == 0))
+		if (animation.name.empty() || animation.duration <= 0.0f || (animation.num_iterations < -1 || animation.num_iterations == 0))
 		{
 			return false;
 		}
@@ -241,7 +241,7 @@ static bool ParseTransition(Property & property, const StringList& transition_va
 
 		for (auto& argument : arguments)
 		{
-			if (argument.Empty())
+			if (argument.empty())
 				continue;
 
 			// See if we have a <keyword> or <tween> specifier as defined in keywords
@@ -272,7 +272,7 @@ static bool ParseTransition(Property & property, const StringList& transition_va
 				float number = 0.0f;
 				int count = 0;
 
-				if (sscanf(argument.CString(), "%fs%n", &number, &count) == 1)
+				if (sscanf(argument.c_str(), "%fs%n", &number, &count) == 1)
 				{
 					// Found a number, if there was an 's' unit, count will be positive
 					if (count > 0)
@@ -350,7 +350,7 @@ bool PropertyParserAnimation::ParseValue(Property & property, const String & val
 {
 	StringList list_of_values;
 	{
-		auto lowercase_value = value.ToLower();
+		auto lowercase_value = ToLower(value);
 		StringUtilities::ExpandString(list_of_values, lowercase_value, ',');
 	}
 

+ 10 - 10
Source/Core/PropertyParserColour.cpp

@@ -63,7 +63,7 @@ bool PropertyParserColour::ParseValue(Property& property, const String& value, c
 {
 	ROCKET_UNUSED(parameters);
 
-	if (value.Empty())
+	if (value.empty())
 		return false;
 
 	Colourb colour;
@@ -76,7 +76,7 @@ bool PropertyParserColour::ParseValue(Property& property, const String& value, c
 								  {'f', 'f'},
 								  {'f', 'f'} };
 
-		switch (value.Length())
+		switch (value.size())
 		{
 			// Single hex digit per channel, RGB and alpha.
 			case 5:		hex_values[3][0] = hex_values[3][1] = value[4];
@@ -92,7 +92,7 @@ bool PropertyParserColour::ParseValue(Property& property, const String& value, c
 						hex_values[3][1] = value[8];
 
 			// Two hex digits per channel, RGB only.
-			case 7:		memcpy(hex_values, &value.CString()[1], sizeof(char) * 6);
+			case 7:		memcpy(hex_values, &value.c_str()[1], sizeof(char) * 6);
 						break;
 
 			default:
@@ -111,15 +111,15 @@ bool PropertyParserColour::ParseValue(Property& property, const String& value, c
 			colour[i] = (byte) (tens * 16 + ones);
 		}
 	}
-	else if (value.Substring(0, 3) == "rgb")
+	else if (value.substr(0, 3) == "rgb")
 	{
 		StringList values;
 
-		int find = (int)value.Find("(") + 1;
-		StringUtilities::ExpandString(values, value.Substring(find, value.RFind(")") - find), ',');
+		int find = (int)value.find("(") + 1;
+		StringUtilities::ExpandString(values, value.substr(find, value.rfind(")") - find), ',');
 
 		// Check if we're parsing an 'rgba' or 'rgb' colour declaration.
-		if (value.Length() > 3 && value[3] == 'a')
+		if (value.size() > 3 && value[3] == 'a')
 		{
 			if (values.size() != 4)
 				return false;
@@ -138,11 +138,11 @@ bool PropertyParserColour::ParseValue(Property& property, const String& value, c
 			int component;
 
 			// We're parsing a percentage value.
-			if (values[i].Length() > 0 && values[i][values[i].Length() - 1] == '%')
-				component = Math::RealToInteger((float) (atof(values[i].Substring(0, values[i].Length() - 1).CString()) / 100.0f) * 255.0f);
+			if (values[i].size() > 0 && values[i][values[i].size() - 1] == '%')
+				component = Math::RealToInteger((float) (atof(values[i].substr(0, values[i].size() - 1).c_str()) / 100.0f) * 255.0f);
 			// We're parsing a 0 -> 255 integer value.
 			else
-				component = atoi(values[i].CString());
+				component = atoi(values[i].c_str());
 
 			colour[i] = (byte) (Math::Clamp(component, 0, 255));
 		}

+ 7 - 7
Source/Core/PropertyParserNumber.cpp

@@ -98,16 +98,16 @@ bool PropertyParserNumber::ParseValue(Property& property, const String& value, c
 	property.unit = Property::NUMBER;
 
 	// Check for a unit declaration at the end of the number.
-	size_t unit_pos =  value.Length();
+	size_t unit_pos =  value.size();
 	for (size_t i = 0; i < unit_suffixes.size(); i++)
 	{
 		const UnitSuffix& unit_suffix = unit_suffixes[i];
 
-		if (value.Length() < unit_suffix.second.Length())
+		if (value.size() < unit_suffix.second.size())
 			continue;
 
-		size_t test_unit_pos = value.Length() - unit_suffix.second.Length();
-		if (strcasecmp(value.CString() + test_unit_pos, unit_suffix.second.CString()) == 0)
+		size_t test_unit_pos = value.size() - unit_suffix.second.size();
+		if (strcasecmp(value.c_str() + test_unit_pos, unit_suffix.second.c_str()) == 0)
 		{
 			unit_pos = test_unit_pos;
 			property.unit = unit_suffix.first;
@@ -119,7 +119,7 @@ bool PropertyParserNumber::ParseValue(Property& property, const String& value, c
 	{
 		// Detected unit not allowed (this can only apply to NUMBER, i.e., when no unit was found but one is required).
 		// However, we allow values of "0" if zero_unit is set.
-		bool result = (zero_unit != Property::UNKNOWN && (value.Length() == 1 && value[0] == '0'));
+		bool result = (zero_unit != Property::UNKNOWN && (value.size() == 1 && value[0] == '0'));
 		if(result)
 		{
 			property.unit = zero_unit;
@@ -129,8 +129,8 @@ bool PropertyParserNumber::ParseValue(Property& property, const String& value, c
 	}
 
 	float float_value;
-	String str_value( value.CString(), value.CString() + unit_pos );
-	if (sscanf(str_value.CString(), "%f", &float_value) == 1)
+	String str_value( value.c_str(), value.c_str() + unit_pos );
+	if (sscanf(str_value.c_str(), "%f", &float_value) == 1)
 	{
 		property.value = Variant(float_value);
 		return true;

+ 1 - 1
Source/Core/PropertyParserTransform.cpp

@@ -55,7 +55,7 @@ bool PropertyParserTransform::ParseValue(Property& property, const String& value
 
 	auto transform = std::make_unique<Transform>();
 
-	char const* next = value.CString();
+	char const* next = value.c_str();
 
 	Transforms::NumericValue args[16];
 

+ 34 - 34
Source/Core/PropertySpecification.cpp

@@ -52,7 +52,7 @@ PropertySpecification::~PropertySpecification()
 // Registers a property with a new definition.
 PropertyDefinition& PropertySpecification::RegisterProperty(const String& property_name, const String& default_value, bool inherited, bool forces_layout)
 {
-	String lower_case_name = property_name.ToLower();
+	String lower_case_name = ToLower(property_name);
 
 	// Create the property and validate the default value.
 	PropertyDefinition* property_definition = new PropertyDefinition(default_value, inherited, forces_layout);
@@ -102,12 +102,12 @@ const PropertyNameList& PropertySpecification::GetRegisteredInheritedProperties(
 bool PropertySpecification::RegisterShorthand(const String& shorthand_name, const String& property_names, ShorthandType type)
 {
 	StringList properties;
-	StringUtilities::ExpandString(properties, property_names.ToLower());
+	StringUtilities::ExpandString(properties, ToLower(property_names));
 
 	if (properties.empty())
 		return false;
 
-	String lower_case_name = shorthand_name.ToLower();
+	String lower_case_name = ToLower(shorthand_name);
 
 	// Construct the new shorthand definition and resolve its properties.
 	PropertyShorthandDefinition* property_shorthand = new PropertyShorthandDefinition();
@@ -125,7 +125,7 @@ bool PropertySpecification::RegisterShorthand(const String& shorthand_name, cons
 
 		if (property == NULL && !shorthand_found)
 		{
-			Log::Message(Log::LT_ERROR, "Shorthand property '%s' was registered with invalid property '%s'.", shorthand_name.CString(), properties[i].CString());
+			Log::Message(Log::LT_ERROR, "Shorthand property '%s' was registered with invalid property '%s'.", shorthand_name.c_str(), properties[i].c_str());
 			delete property_shorthand;
 
 			return false;
@@ -136,10 +136,10 @@ bool PropertySpecification::RegisterShorthand(const String& shorthand_name, cons
 	if (type == AUTO)
 	{
 		if (properties.size() == 4 &&
-			properties[0].Find("-top") != String::npos &&
-			properties[1].Find("-right") != String::npos &&
-			properties[2].Find("-bottom") != String::npos &&
-			properties[3].Find("-left") != String::npos)
+			properties[0].find("-top") != String::npos &&
+			properties[1].find("-right") != String::npos &&
+			properties[2].find("-bottom") != String::npos &&
+			properties[3].find("-left") != String::npos)
 			property_shorthand->type = BOX;
 		else
 			property_shorthand->type = FALL_THROUGH;
@@ -164,7 +164,7 @@ const PropertyShorthandDefinition* PropertySpecification::GetShorthand(const Str
 // Parses a property declaration, setting any parsed and validated properties on the given dictionary.
 bool PropertySpecification::ParsePropertyDeclaration(PropertyDictionary& dictionary, const String& property_name, const String& property_value, const String& source_file, int source_line_number) const
 {
-	String lower_case_name = property_name.ToLower();
+	String lower_case_name = ToLower(property_name);
 
 	// Attempt to parse as a single property.
 	const PropertyDefinition* property_definition = GetProperty(lower_case_name);
@@ -351,7 +351,7 @@ bool PropertySpecification::ParsePropertyValues(StringList& values_list, const S
 
 	size_t character_index = 0;
 	char previous_character = 0;
-	while (character_index < values.Length())
+	while (character_index < values.size())
 	{
 		char character = values[character_index];
 		character_index++;
@@ -363,10 +363,10 @@ bool PropertySpecification::ParsePropertyValues(StringList& values_list, const S
 				if (character == ';')
 				{
 					value = StringUtilities::StripWhitespace(value);
-					if (value.Length() > 0)
+					if (value.size() > 0)
 					{
 						values_list.push_back(value);
-						value.Clear();
+						value.clear();
 					}
 				}
 				else if (StringUtilities::IsWhitespace(character))
@@ -374,42 +374,42 @@ bool PropertySpecification::ParsePropertyValues(StringList& values_list, const S
 					if (split_values)
 					{
 						value = StringUtilities::StripWhitespace(value);
-						if (value.Length() > 0)
+						if (value.size() > 0)
 						{
 							values_list.push_back(value);
-							value.Clear();
+							value.clear();
 						}
 					}
 					else
-						value.Append(character);
+						value += character;
 				}
 				else if (character == '"')
 				{
 					if (split_values)
 					{
 						value = StringUtilities::StripWhitespace(value);
-						if (value.Length() > 0)
+						if (value.size() > 0)
 						{
 							values_list.push_back(value);
-							value.Clear();
+							value.clear();
 						}
 						state = VALUE_QUOTE;
 					}
 					else
 					{
-						value.Append(' ');
+						value += ' ';
 						state = VALUE_QUOTE;
 					}
 				}
 				else if (character == '(')
 				{
 					open_parentheses = 1;
-					value.Append(character);
+					value += character;
 					state = VALUE_PARENTHESIS;
 				}
 				else
 				{
-					value.Append(character);
+					value += character;
 				}
 			}
 			break;
@@ -419,11 +419,11 @@ bool PropertySpecification::ParsePropertyValues(StringList& values_list, const S
 				if (previous_character == '/')
 				{
 					if (character == ')' || character == '(')
-						value.Append(character);
+						value += character;
 					else
 					{
-						value.Append('/');
-						value.Append(character);
+						value += '/';
+						value += character;
 					}
 				}
 				else
@@ -431,18 +431,18 @@ bool PropertySpecification::ParsePropertyValues(StringList& values_list, const S
 					if (character == '(')
 					{
 						open_parentheses++;
-						value.Append(character);
+						value += character;
 					}
 					else if (character == ')')
 					{
 						open_parentheses--;
-						value.Append(character);
+						value += character;
 						if (open_parentheses == 0)
 							state = VALUE;
 					}
 					else if (character != '/')
 					{
-						value.Append(character);
+						value += character;
 					}
 				}
 			}
@@ -453,11 +453,11 @@ bool PropertySpecification::ParsePropertyValues(StringList& values_list, const S
 				if (previous_character == '/')
 				{
 					if (character == '"')
-						value.Append(character);
+						value += character;
 					else
 					{
-						value.Append('/');
-						value.Append(character);
+						value += '/';
+						value += character;
 					}
 				}
 				else
@@ -467,19 +467,19 @@ bool PropertySpecification::ParsePropertyValues(StringList& values_list, const S
 						if (split_values)
 						{
 							value = StringUtilities::StripWhitespace(value);
-							if (value.Length() > 0)
+							if (value.size() > 0)
 							{
 								values_list.push_back(value);
-								value.Clear();
+								value.clear();
 							}
 						}
 						else
-							value.Append(' ');
+							value += ' ';
 						state = VALUE;
 					}
 					else if (character != '/')
 					{
-						value.Append(character);
+						value += character;
 					}
 				}
 			}
@@ -491,7 +491,7 @@ bool PropertySpecification::ParsePropertyValues(StringList& values_list, const S
 	if (state == VALUE)
 	{
 		value = StringUtilities::StripWhitespace(value);
-		if (value.Length() > 0)
+		if (value.size() > 0)
 			values_list.push_back(value);
 	}
 

+ 4 - 4
Source/Core/Stream.cpp

@@ -93,11 +93,11 @@ size_t Stream::Read(Stream* stream, size_t bytes) const
 // Read from one stream into another
 size_t Stream::Read(String& string, size_t bytes) const
 {
-	size_t string_size = string.Length();
-	string.Resize(string_size + bytes + 1);
+	size_t string_size = string.size();
+	string.resize(string_size + bytes + 1);
 	size_t read = Read(&string[string_size], bytes);
 	string[string_size + read] = '\0';
-	string.Resize(string_size + read);
+	string.resize(string_size + read);
 	return read;
 }
 
@@ -114,7 +114,7 @@ size_t Stream::Write(const char* string)
 
 size_t Stream::Write(const String& string)
 {
-	return Write(string.CString(), string.Length());
+	return Write(string.c_str(), string.size());
 }
 
 // Push onto the front of the stream

+ 3 - 3
Source/Core/StreamFile.cpp

@@ -48,18 +48,18 @@ StreamFile::~StreamFile()
 /// Attempts to open the stream pointing at a given URL.
 bool StreamFile::Open(const String& path)
 {
-	String url_safe_path = path.Replace(":", "|");
+	String url_safe_path = Replace(path, ":", "|");
 	SetStreamDetails(URL(url_safe_path), Stream::MODE_READ);
 
 	if (file_handle)
 		Close();
 
 	// Fix the path if a leading colon has been replaced with a pipe.
-	String fixed_path = path.Replace("|", ":");
+	String fixed_path = Replace(path, "|", ":");
 	file_handle = GetFileInterface()->Open(fixed_path);
 	if (!file_handle)
 	{
-		Log::Message(Log::LT_WARNING, "Unable to open file %s.", fixed_path.CString());
+		Log::Message(Log::LT_WARNING, "Unable to open file %s.", fixed_path.c_str());
 		return false;
 	}
 

+ 51 - 192
Source/Core/String.cpp

@@ -28,11 +28,14 @@
 #include "precompiled.h"
 #include "../../Include/Rocket/Core/String.h"
 #include "../../Include/Rocket/Core/StringBase.h"
+#include <codecvt>
+#include <algorithm>
 
 namespace Rocket {
 namespace Core {
 
-int ROCKETCORE_API RocketStringFormatString(StringBase<char>& string, int max_size, const char* format, va_list argument_list)
+
+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];
@@ -43,12 +46,12 @@ int ROCKETCORE_API RocketStringFormatString(StringBase<char>& string, int max_si
 
 	int length = vsnprintf(buffer_ptr, max_size, format, argument_list);
 	buffer_ptr[length >= 0 ? length : max_size] = '\0';
-	#ifdef ROCKET_DEBUG
-		if (length == -1)
-		{
-			Log::Message(Log::LT_WARNING, "String::sprintf: String truncated to %d bytes when processing %s", max_size, format);
-		}
-	#endif
+#ifdef ROCKET_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;
 
@@ -58,207 +61,63 @@ int ROCKETCORE_API RocketStringFormatString(StringBase<char>& string, int max_si
 	return length;
 }
 
-template <>
-StringBase<char>::StringBase(StringBase<char>::size_type max_size, const char* fmt, ...) : value(local_buffer), buffer_size(LOCAL_BUFFER_SIZE), length(0), hash(0) 
+int FormatString(String& string, size_t max_size, const char* format, ...)
 {
 	va_list argument_list;
-	va_start(argument_list, fmt);
-
-	RocketStringFormatString(*this, (int)max_size, fmt, argument_list);
-
+	va_start(argument_list, format);
+	int result = FormatString(string, (int)max_size, format, argument_list);
 	va_end(argument_list);
+	return result;
 }
-
-template <>
-int StringBase<char>::FormatString(StringBase<char>::size_type max_size, const char* fmt, ...)
+String CreateString(size_t max_size, const char* format, ...)
 {
+	String result;
+	result.reserve(max_size);
 	va_list argument_list;
-	va_start(argument_list, fmt);
-
-	int length = RocketStringFormatString(*this, (int)max_size, fmt, argument_list);
-
+	va_start(argument_list, format);
+	FormatString(result, max_size, format, argument_list);
 	va_end(argument_list);
-
-	return length;
+	return result;
 }
 
-String operator+(const char* cstring, const String& string)
-{
-	return String(cstring) + string;
+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;
 }
 
-//#define ENABLE_STRING_TESTS
-#ifdef ENABLE_STRING_TESTS
-#include <string>
-#include "Rocket/Core/SystemInterface.h"
-ROCKETCORE_API void StringTests()
-{
-	SystemInterface* sys = Rocket::Core::GetSystemInterface();
-	
-	std::string ss = "test";
-	String es = "test";
-
-	es = "hello";
-	es.Resize(100);
-	es.Erase(4);
-	es.Erase(2,100);
-	es += "y";
-
-	String sub1 = es.Replace("lo", "l");
-	sub1 = sub1.Replace("h", "!");
-	ROCKET_ASSERT(sub1 == "!el");
-
-	Time start;
-
-	{
-		// Create a few free buffers
-		String tempstring("buffer");
-		String tempstring1("buffer1");
-		String tempstring2("buffer2");
-	}	
-
-	start = sys->GetElapsedTime();
-	for (int i = 0; i < 100000; i++)
-	{
-		std::string str("test");	
-	}
-	printf( "SS Assign Short: %f\n", sys->GetElapsedTime() - start);
-	
-	start = sys->GetElapsedTime();	
-	for (int i = 0; i < 100000; i++)
-	{
-		String str("test");
-	}
-	printf( "ES Assign Short: %f\n", sys->GetElapsedTime() - start);
-
-	start = sys->GetElapsedTime();
-	for (int i = 0; i < 100000; i++)
-	{
-		std::string str("test this really long string that won't fit in a local buffer");	
-	}
-	printf( "SS Assign Long: %f\n", sys->GetElapsedTime() - start);
-	
-	start = sys->GetElapsedTime();	
-	for (int i = 0; i < 100000; i++)
-	{
-		String str("test this really long string that won't fit in a local buffer");
-	}
-	printf( "ES Assign Long: %f\n", sys->GetElapsedTime() - start);
-
-	start = sys->GetElapsedTime();
-	for (int i = 0; i < 100000; i++)
-	{
-		if (ss == "hello")
-		{
-			int bob = 10;
-		}
-	}
-	printf( "SS Compare: %f (char*)\n", sys->GetElapsedTime() - start);
 
-	ss = "bo1";
-	std::string oss = ss;
-	std::string nss = "bob";
-	start = sys->GetElapsedTime();
-	for (int i = 0; i < 100000; i++)
-	{
-		//if (ss == oss)
-		{
-			int bob = 10;
-		}
-		if (ss == nss)
-		{
-			int bob = 10;
-		}
-	}
-	printf( "SS Compare: %f (std::string)\n", sys->GetElapsedTime() - start);
-
-	start = sys->GetElapsedTime();
-	for (int i = 0; i < 100000; i++)
-	{
-		if (es == "hello")
-		{
-			int bob = 10;
-		}
-	}
-	printf( "ES Compare: %f (char*)\n", sys->GetElapsedTime() - start);
-	
-	es = "bo1";
-	String oes = es;
-	String nes = "bob";
-	start = sys->GetElapsedTime();
-	for (int i = 0; i < 100000; i++)
-	{
-		//if (es == oes)
-		{
-			int bob = 10;
-		}
-		
-		if (nes == oes)
-		{
-			int bob = 10;
-		}
-	}
-	printf( "ES Compare: %f (String)\n", sys->GetElapsedTime() - start);
-
-	start = sys->GetElapsedTime();
-	std::string ss_concat = "hello";
-	for (int i = 0; i < 100000; i++)
-	{
-		ss_concat += "y";
-	}
-	printf( "SS +=: %f\n", sys->GetElapsedTime() - start);
+std::wstring ToWideString(const std::string& str)
+{
+	std::vector< word > result;
+	StringUtilities::UTF8toUCS2(str, result);
+	return std::wstring(result.data(), result.size());
 
-	String es_concat = "hello";
-	start = sys->GetElapsedTime();
-	for (int i = 0; i < 100000; i++)
-	{
-		if (i == 42)
-		{
-			int bob = 10;
-		}
-		es_concat += "y";
-	}
-	printf( "ES +=: %f\n", sys->GetElapsedTime() - start);
+	//using convert_typeX = std::codecvt_utf8<wchar_t>;
+	//std::wstring_convert<convert_typeX, wchar_t> converterX;
+	//return converterX.from_bytes(str);
+}
 
-	const char* x1 = "bob";
-	String s;
-	String t;
-	String u;
-	s = "hello";
-	t = "hell";
-	u = "hello";
-	if (s == t)
-	{
-		int bob = 10;
-	}
-	if (s == u)
-	{
-		int bob = 10;
-	}
+std::string ToUTF8(const std::wstring& wstr)
+{
+	std::string result;
+	StringUtilities::UCS2toUTF8(wstr.c_str(), wstr.size(), result);
+	return result;
+	//using convert_typeX = std::codecvt_utf8<wchar_t>;
+	//std::wstring_convert<convert_typeX, wchar_t> converterX;
+	//return converterX.to_bytes(wstr);
+}
 
-	t = s + u;
-	if (t == "hellohello")
-	{
-		int bob = 10;
-	}
-	if (t == "x")
-	{
-		int bob = 10;
+std::string Replace(std::string subject, const std::string& search, const std::string& replace)
+{
+	size_t pos = 0;
+	while ((pos = subject.find(search, pos)) != std::string::npos) {
+		subject.replace(pos, search.length(), replace);
+		pos += replace.length();
 	}
-
-	t += u;
-
-
-	size_t x = s.Find("e");
-	size_t y = s.Find("z");
-	
-	String sub = t.Replace("lo", "l");
-	sub = sub.Replace("h", "!");
-
-	sub.FormatString(128, "%s", "hello");
-	int bob = 10;
+	return subject;
 }
-#endif
+
 
 }
 }
@@ -267,7 +126,7 @@ ROCKETCORE_API void StringTests()
 
 ROCKETCORE_API size_t hash< String >::operator()(const String& string) const
 {
-	return StringUtilities::FNVHash(string.CString());
+	return StringUtilities::FNVHash(string.c_str());
 }
 
 }*/

+ 10 - 10
Source/Core/StringUtilities.cpp

@@ -38,7 +38,7 @@ void StringUtilities::ExpandString(StringList& string_list, const String& string
 {	
 	char quote = 0;
 	bool last_char_delimiter = true;
-	const char* ptr = string.CString();
+	const char* ptr = string.c_str();
 	const char* start_ptr = NULL;
 	const char* end_ptr = ptr;
 
@@ -89,7 +89,7 @@ void StringUtilities::JoinString(String& string, const StringList& string_list,
 	{
 		string += string_list[i];
 		if (delimiter != '\0' && i < string_list.size() - 1)
-			string.Append(delimiter);
+			string += delimiter;
 	}
 }
 	
@@ -158,14 +158,14 @@ static int __utf8_forbidden(unsigned char octet)
 // Converts a character array in UTF-8 encoding to a vector of words.
 bool StringUtilities::UTF8toUCS2(const String& input, std::vector< word >& output)
 {
-	if (input.Empty())
+	if (input.empty())
 		return true;
 	
-	unsigned char* p = (unsigned char*) input.CString();
-	unsigned char* lim = p + input.Length();
+	unsigned char* p = (unsigned char*) input.c_str();
+	unsigned char* lim = p + input.size();
 	
 	// Skip the UTF-8 byte order marker if it exists.
-	if (input.Substring(0, 3) == "\xEF\xBB\xBF")
+	if (input.substr(0, 3) == "\xEF\xBB\xBF")
 		p += 3;
 	
 	int num_bytes;
@@ -334,7 +334,7 @@ bool StringUtilities::UCS2toUTF8(const word* input, size_t input_size, String& o
 				break;
 		}
 		
-		//Log::Message(LC_CORE, Log::LT_ALWAYS, "Converting...%c(%d) %d -> %d", *w, *w, w - input, output.Length());
+		//Log::Message(LC_CORE, Log::LT_ALWAYS, "Converting...%c(%d) %d -> %d", *w, *w, w - input, output.size());
 	}
 	
 	return true;
@@ -343,8 +343,8 @@ bool StringUtilities::UCS2toUTF8(const word* input, size_t input_size, String& o
 // Strip whitespace characters from the beginning and end of a string.
 String StringUtilities::StripWhitespace(const String& string)
 {
-	const char* start = string.CString();
-	const char* end = start + string.Length();
+	const char* start = string.c_str();
+	const char* end = start + string.size();
 	
 	while (start < end && IsWhitespace(*start))
 		start++;
@@ -361,7 +361,7 @@ String StringUtilities::StripWhitespace(const String& string)
 // Operators for STL containers using strings.
 bool StringUtilities::StringComparei::operator()(const String& lhs, const String& rhs) const
 {
-	return strcasecmp(lhs.CString(), rhs.CString()) < 0;
+	return strcasecmp(lhs.c_str(), rhs.c_str()) < 0;
 }
 
 }

+ 2 - 2
Source/Core/StyleSheet.cpp

@@ -192,9 +192,9 @@ ElementDefinition* StyleSheet::GetElementDefinition(const Element* element) cons
 	// element with a different address but an identical output definition.
 	String node_ids;
 	for (size_t i = 0; i < applicable_nodes.size(); i++)
-		node_ids += String(10, "%x ", applicable_nodes[i]);
+		node_ids += CreateString(10, "%x ", applicable_nodes[i]);
 	for (PseudoClassList::iterator i = volatile_pseudo_classes.begin(); i != volatile_pseudo_classes.end(); ++i)
-		node_ids += String(32, ":%s", (*i).CString());
+		node_ids += CreateString(32, ":%s", (*i).c_str());
 
 	cache_iterator = node_cache.find(node_ids);
 	if (cache_iterator != node_cache.end())

+ 3 - 3
Source/Core/StyleSheetFactory.cpp

@@ -149,7 +149,7 @@ StyleSheet* StyleSheetFactory::GetStyleSheet(const StringList& sheets)
 				sheet = sub_sheet;
 		}
 		else
-			Log::Message(Log::LT_ERROR, "Failed to load style sheet %s.", sheets[i].CString());
+			Log::Message(Log::LT_ERROR, "Failed to load style sheet %s.", sheets[i].c_str());
 	}
 
 	if (sheet == NULL)
@@ -177,8 +177,8 @@ void StyleSheetFactory::ClearStyleSheetCache()
 // Returns one of the available node selectors.
 StyleSheetNodeSelector* StyleSheetFactory::GetSelector(const String& name)
 {
-	size_t index = name.Find("(");
-	SelectorMap::iterator i = instance->selectors.find(name.Substring(0, index));
+	size_t index = name.find("(");
+	SelectorMap::iterator i = instance->selectors.find(name.substr(0, index));
 	if (i == instance->selectors.end())
 		return NULL;
 	return (*i).second;

+ 13 - 13
Source/Core/StyleSheetNode.cpp

@@ -107,7 +107,7 @@ void StyleSheetNode::Write(Stream* stream)
 			hierarchy = hierarchy->parent;
 		}
 
-		stream->Write(String(1024, "%s /* specificity: %d */\n", StringUtilities::StripWhitespace(rule).CString(), specificity));
+		stream->Write(CreateString(1024, "%s /* specificity: %d */\n", StringUtilities::StripWhitespace(rule).c_str(), specificity));
 		stream->Write("{\n");
 
 		const Rocket::Core::PropertyMap& property_map = properties.GetProperties();
@@ -116,7 +116,7 @@ void StyleSheetNode::Write(Stream* stream)
 			const String& name = i->first;
 			const Rocket::Core::Property& property = i->second;
 
-			stream->Write(String(1024, "\t%s: %s; /* specificity: %d */\n", name.CString(), property.value.Get< String >().CString(), property.specificity));
+			stream->Write(CreateString(1024, "\t%s: %s; /* specificity: %d */\n", name.c_str(), property.value.Get< String >().c_str(), property.specificity));
 		}
 
 		stream->Write("}\n\n");
@@ -338,7 +338,7 @@ bool StyleSheetNode::IsApplicable(const Element* element) const
 	for (const Element* ancestor_element = element->GetParentNode(); ancestor_element != NULL; ancestor_element = ancestor_element->GetParentNode())
 	{
 		// Skip this ancestor if the name of the next style node doesn't match its tag name, and one was specified.
-		if (!parent_node->name.Empty() 
+		if (!parent_node->name.empty() 
 			&& parent_node->name != ancestor_element->GetTagName())
 			continue;
 
@@ -503,12 +503,12 @@ StyleSheetNode* StyleSheetNode::CreateStructuralChild(const String& child_name)
 	int child_a = 1;
 	int child_b = 0;
 
-	size_t parameter_start = child_name.Find("(");
-	size_t parameter_end = child_name.Find(")");
+	size_t parameter_start = child_name.find("(");
+	size_t parameter_end = child_name.find(")");
 	if (parameter_start != String::npos &&
 		parameter_end != String::npos)
 	{
-		String parameters = child_name.Substring(parameter_start + 1, parameter_end - (parameter_start + 1));
+		String parameters = child_name.substr(parameter_start + 1, parameter_end - (parameter_start + 1));
 
 		// Check for 'even' or 'odd' first.
 		if (parameters == "even")
@@ -524,12 +524,12 @@ StyleSheetNode* StyleSheetNode::CreateStructuralChild(const String& child_name)
 		else
 		{
 			// Alrighty; we've got an equation in the form of [[+/-]an][(+/-)b]. So, foist up, we split on 'n'.
-			size_t n_index = parameters.Find("n");
+			size_t n_index = parameters.find("n");
 			if (n_index != String::npos)
 			{
 				// The equation is 0n + b. So a = 0, and we only have to parse b.
 				child_a = 0;
-				child_b = atoi(parameters.CString());
+				child_b = atoi(parameters.c_str());
 			}
 			else
 			{
@@ -537,17 +537,17 @@ StyleSheetNode* StyleSheetNode::CreateStructuralChild(const String& child_name)
 					child_a = 1;
 				else
 				{
-					String a_parameter = parameters.Substring(0, n_index);
+					String a_parameter = parameters.substr(0, n_index);
 					if (StringUtilities::StripWhitespace(a_parameter) == "-")
 						child_a = -1;
 					else
-						child_a = atoi(a_parameter.CString());
+						child_a = atoi(a_parameter.c_str());
 				}
 
-				if (n_index == parameters.Length() - 1)
+				if (n_index == parameters.size() - 1)
 					child_b = 0;
 				else
-					child_b = atoi(parameters.Substring(n_index + 1).CString());
+					child_b = atoi(parameters.substr(n_index + 1).c_str());
 			}
 		}
 	}
@@ -578,7 +578,7 @@ int StyleSheetNode::CalculateSpecificity()
 	{
 		case TAG:
 		{
-			if (!name.Empty())
+			if (!name.empty())
 				specificity = 10000;
 		}
 		break;

+ 43 - 43
Source/Core/StyleSheetParser.cpp

@@ -51,10 +51,10 @@ StyleSheetParser::~StyleSheetParser()
 
 static bool IsValidIdentifier(const String& str)
 {
-	if (str.Empty())
+	if (str.empty())
 		return false;
 
-	for (int i = 0; i < str.Length(); i++)
+	for (int i = 0; i < str.size(); i++)
 	{
 		char c = str[i];
 		bool valid = (
@@ -103,7 +103,7 @@ bool StyleSheetParser::ParseKeyframeBlock(KeyframesMap& keyframes_map, const Str
 {
 	if (!IsValidIdentifier(identifier))
 	{
-		Log::Message(Log::LT_WARNING, "Invalid keyframes identifier '%s' at %s:%d", identifier.CString(), stream_file_name.CString(), line_number);
+		Log::Message(Log::LT_WARNING, "Invalid keyframes identifier '%s' at %s:%d", identifier.c_str(), stream_file_name.c_str(), line_number);
 		return false;
 	}
 	if (properties.GetNumProperties() == 0)
@@ -119,19 +119,19 @@ bool StyleSheetParser::ParseKeyframeBlock(KeyframesMap& keyframes_map, const Str
 	{
 		float value = 0.0f;
 		int count = 0;
-		rule = rule.ToLower();
+		rule = ToLower(rule);
 		if (rule == "from")
 			rule_values.push_back(0.0f);
 		else if (rule == "to")
 			rule_values.push_back(1.0f);
-		else if(sscanf(rule.CString(), "%f%%%n", &value, &count) == 1)
+		else if(sscanf(rule.c_str(), "%f%%%n", &value, &count) == 1)
 			if(count > 0 && value >= 0.0f && value <= 100.0f)
 				rule_values.push_back(0.01f * value);
 	}
 
 	if (rule_values.empty())
 	{
-		Log::Message(Log::LT_WARNING, "Invalid keyframes rule(s) '%s' at %s:%d", rules.CString(), stream_file_name.CString(), line_number);
+		Log::Message(Log::LT_WARNING, "Invalid keyframes rule(s) '%s' at %s:%d", rules.c_str(), stream_file_name.c_str(), line_number);
 		return false;
 	}
 
@@ -162,7 +162,7 @@ int StyleSheetParser::Parse(StyleSheetNode* node, KeyframesMap& keyframes, Strea
 	int rule_count = 0;
 	line_number = 0;
 	stream = _stream;
-	stream_file_name = stream->GetSourceURL().GetURL().Replace("|", ":");
+	stream_file_name = Replace(stream->GetSourceURL().GetURL(), "|", ":");
 
 	enum class State { Global, KeyframesIdentifier, KeyframesRules, Invalid };
 	State state = State::Global;
@@ -201,7 +201,7 @@ int StyleSheetParser::Parse(StyleSheetNode* node, KeyframesMap& keyframes, Strea
 				}
 				else
 				{
-					Log::Message(Log::LT_WARNING, "Invalid character '%c' found while parsing stylesheet at %s:%d. Trying to proceed.", token, stream_file_name.CString(), line_number);
+					Log::Message(Log::LT_WARNING, "Invalid character '%c' found while parsing stylesheet at %s:%d. Trying to proceed.", token, stream_file_name.c_str(), line_number);
 				}
 			}
 			break;
@@ -209,16 +209,16 @@ int StyleSheetParser::Parse(StyleSheetNode* node, KeyframesMap& keyframes, Strea
 			{
 				if (token == '{')
 				{
-					keyframes_identifier.Clear();
-					if (pre_token_str.Substring(0, KEYFRAMES.Length()) == KEYFRAMES)
+					keyframes_identifier.clear();
+					if (pre_token_str.substr(0, KEYFRAMES.size()) == KEYFRAMES)
 					{
-						keyframes_identifier = StringUtilities::StripWhitespace(pre_token_str.Substring(KEYFRAMES.Length()));
+						keyframes_identifier = StringUtilities::StripWhitespace(pre_token_str.substr(KEYFRAMES.size()));
 					}
 					state = State::KeyframesRules;
 				}
 				else
 				{
-					Log::Message(Log::LT_WARNING, "Invalid character '%c' found while parsing keyframes identifier in stylesheet at %s:%d", token, stream_file_name.CString(), line_number);
+					Log::Message(Log::LT_WARNING, "Invalid character '%c' found while parsing keyframes identifier in stylesheet at %s:%d", token, stream_file_name.c_str(), line_number);
 					state = State::Invalid;
 				}
 			}
@@ -242,7 +242,7 @@ int StyleSheetParser::Parse(StyleSheetNode* node, KeyframesMap& keyframes, Strea
 				}
 				else
 				{
-					Log::Message(Log::LT_WARNING, "Invalid character '%c' found while parsing keyframes in stylesheet at %s:%d", token, stream_file_name.CString(), line_number);
+					Log::Message(Log::LT_WARNING, "Invalid character '%c' found while parsing keyframes in stylesheet at %s:%d", token, stream_file_name.c_str(), line_number);
 					state = State::Invalid;
 				}
 			}
@@ -268,7 +268,7 @@ int StyleSheetParser::Parse(StyleSheetNode* node, KeyframesMap& keyframes, Strea
 
 bool StyleSheetParser::ParseProperties(PropertyDictionary& parsed_properties, const String& properties)
 {
-	stream = new StreamMemory((const byte*)properties.CString(), properties.Length());
+	stream = new StreamMemory((const byte*)properties.c_str(), properties.size());
 	bool success = ReadProperties(parsed_properties);
 	stream->RemoveReference();
 	stream = NULL;
@@ -297,17 +297,17 @@ bool StyleSheetParser::ReadProperties(PropertyDictionary& properties)
 				if (character == ';')
 				{
 					name = StringUtilities::StripWhitespace(name);
-					if (!name.Empty())
+					if (!name.empty())
 					{
-						Log::Message(Log::LT_WARNING, "Found name with no value parsing property declaration '%s' at %s:%d", name.CString(), stream_file_name.CString(), line_number);
-						name.Clear();
+						Log::Message(Log::LT_WARNING, "Found name with no value parsing property declaration '%s' at %s:%d", name.c_str(), stream_file_name.c_str(), line_number);
+						name.clear();
 					}
 				}
 				else if (character == '}')
 				{
 					name = StringUtilities::StripWhitespace(name);
-					if (!StringUtilities::StripWhitespace(name).Empty())
-						Log::Message(Log::LT_WARNING, "End of rule encountered while parsing property declaration '%s' at %s:%d", name.CString(), stream_file_name.CString(), line_number);
+					if (!StringUtilities::StripWhitespace(name).empty())
+						Log::Message(Log::LT_WARNING, "End of rule encountered while parsing property declaration '%s' at %s:%d", name.c_str(), stream_file_name.c_str(), line_number);
 					return true;
 				}
 				else if (character == ':')
@@ -316,7 +316,7 @@ bool StyleSheetParser::ReadProperties(PropertyDictionary& properties)
 					state = VALUE;
 				}
 				else
-					name.Append(character);
+					name += character;
 			}
 			break;
 			
@@ -327,20 +327,20 @@ bool StyleSheetParser::ReadProperties(PropertyDictionary& properties)
 					value = StringUtilities::StripWhitespace(value);
 
 					if (!StyleSheetSpecification::ParsePropertyDeclaration(properties, name, value, stream_file_name, rule_line_number))
-						Log::Message(Log::LT_WARNING, "Syntax error parsing property declaration '%s: %s;' in %s: %d.", name.CString(), value.CString(), stream_file_name.CString(), line_number);
+						Log::Message(Log::LT_WARNING, "Syntax error parsing property declaration '%s: %s;' in %s: %d.", name.c_str(), value.c_str(), stream_file_name.c_str(), line_number);
 
-					name.Clear();
-					value.Clear();
+					name.clear();
+					value.clear();
 					state = NAME;
 				}
 				else if (character == '}')
 				{
-					Log::Message(Log::LT_WARNING, "End of rule encountered while parsing property declaration '%s: %s;' in %s: %d.", name.CString(), value.CString(), stream_file_name.CString(), line_number);
+					Log::Message(Log::LT_WARNING, "End of rule encountered while parsing property declaration '%s: %s;' in %s: %d.", name.c_str(), value.c_str(), stream_file_name.c_str(), line_number);
 					return true;
 				}
 				else
 				{
-					value.Append(character);
+					value += character;
 					if (character == '"')
 						state = QUOTE;
 				}
@@ -349,7 +349,7 @@ bool StyleSheetParser::ReadProperties(PropertyDictionary& properties)
 
 			case QUOTE:
 			{
-				value.Append(character);
+				value += character;
 				if (character == '"' && previous_character != '/')
 					state = VALUE;
 			}
@@ -359,8 +359,8 @@ bool StyleSheetParser::ReadProperties(PropertyDictionary& properties)
 		previous_character = character;
 	}
 
-	if (!name.Empty() || !value.Empty())
-		Log::Message(Log::LT_WARNING, "Invalid property declaration '%s':'%s' at %s:%d", name.CString(), value.CString(), stream_file_name.CString(), line_number);
+	if (!name.empty() || !value.empty())
+		Log::Message(Log::LT_WARNING, "Invalid property declaration '%s':'%s' at %s:%d", name.c_str(), value.c_str(), stream_file_name.c_str(), line_number);
 	
 	return true;
 }
@@ -386,28 +386,28 @@ bool StyleSheetParser::ImportProperties(StyleSheetNode* node, const String& name
 		StringList structural_pseudo_classes;
 
 		size_t index = 0;
-		while (index < name.Length())
+		while (index < name.size())
 		{
 			size_t start_index = index;
 			size_t end_index = index + 1;
 
 			// Read until we hit the next identifier.
-			while (end_index < name.Length() &&
+			while (end_index < name.size() &&
 				   name[end_index] != '#' &&
 				   name[end_index] != '.' &&
 				   name[end_index] != ':')
 				end_index++;
 
-			String identifier = name.Substring(start_index, end_index - start_index);
-			if (!identifier.Empty())
+			String identifier = name.substr(start_index, end_index - start_index);
+			if (!identifier.empty())
 			{
 				switch (identifier[0])
 				{
-					case '#':	id = identifier.Substring(1); break;
-					case '.':	classes.push_back(identifier.Substring(1)); break;
+					case '#':	id = identifier.substr(1); break;
+					case '.':	classes.push_back(identifier.substr(1)); break;
 					case ':':
 					{
-						String pseudo_class_name = identifier.Substring(1);
+						String pseudo_class_name = identifier.substr(1);
 						if (StyleSheetFactory::GetSelector(pseudo_class_name) != NULL)
 							structural_pseudo_classes.push_back(pseudo_class_name);
 						else
@@ -432,7 +432,7 @@ bool StyleSheetParser::ImportProperties(StyleSheetNode* node, const String& name
 		leaf_node = leaf_node->GetChildNode(tag, StyleSheetNode::TAG);
 		tag_node = leaf_node;
 
-		if (!id.Empty())
+		if (!id.empty())
 			leaf_node = leaf_node->GetChildNode(id, StyleSheetNode::ID);
 
 		for (size_t j = 0; j < classes.size(); ++j)
@@ -453,7 +453,7 @@ bool StyleSheetParser::ImportProperties(StyleSheetNode* node, const String& name
 
 char StyleSheetParser::FindToken(String& buffer, const char* tokens, bool remove_token)
 {
-	buffer.Clear();
+	buffer.clear();
 	char character;
 	while (ReadCharacter(character))
 	{
@@ -465,7 +465,7 @@ char StyleSheetParser::FindToken(String& buffer, const char* tokens, bool remove
 		}
 		else
 		{
-			buffer.Append(character);
+			buffer += character;
 			parse_buffer_pos++;
 		}
 	}
@@ -482,7 +482,7 @@ bool StyleSheetParser::ReadCharacter(char& buffer)
 	// stream or we find the requested token
 	do
 	{
-		while (parse_buffer_pos < parse_buffer.Length())
+		while (parse_buffer_pos < parse_buffer.size())
 		{
 			if (parse_buffer[parse_buffer_pos] == '\n')
 				line_number++;
@@ -492,7 +492,7 @@ bool StyleSheetParser::ReadCharacter(char& buffer)
 				if (parse_buffer[parse_buffer_pos] == '*')
 				{
 					parse_buffer_pos++;
-					if (parse_buffer_pos >= parse_buffer.Length())
+					if (parse_buffer_pos >= parse_buffer.size())
 					{
 						if (!FillBuffer())
 							return false;
@@ -508,7 +508,7 @@ bool StyleSheetParser::ReadCharacter(char& buffer)
 				if (parse_buffer[parse_buffer_pos] == '/')
 				{
 					parse_buffer_pos++;
-					if (parse_buffer_pos >= parse_buffer.Length())
+					if (parse_buffer_pos >= parse_buffer.size())
 					{
 						if (!FillBuffer())
 						{
@@ -524,7 +524,7 @@ bool StyleSheetParser::ReadCharacter(char& buffer)
 					{
 						buffer = '/';
 						if (parse_buffer_pos == 0)
-							parse_buffer.Insert(parse_buffer_pos, '/');
+							parse_buffer.insert(parse_buffer.begin() + parse_buffer_pos, '/');
 						else
 							parse_buffer_pos--;
 						return true;
@@ -556,7 +556,7 @@ bool StyleSheetParser::FillBuffer()
 
 	// Read in some data (4092 instead of 4096 to avoid the buffer growing when we have to add back
 	// a character after a failed comment parse.)
-	parse_buffer.Clear();
+	parse_buffer.clear();
 	bool read = stream->Read(parse_buffer, 4092) > 0;
 	parse_buffer_pos = 0;
 

+ 14 - 14
Source/Core/SystemInterface.cpp

@@ -50,14 +50,14 @@ bool SystemInterface::LogMessage(Log::Type logtype, const String& message)
 	// By default we just send a platform message
 	if (logtype == Log::LT_ASSERT)
 	{
-		Core::String message(1024, "%s\nWould you like to interrupt execution?", message.CString());	
+		String message = CreateString(1024, "%s\nWould you like to interrupt execution?", message.c_str());	
 
 		// Return TRUE if the user presses NO (continue execution)
-		return (IDNO == MessageBoxA(NULL, message.CString(), "Assertion Failure", MB_YESNO | MB_ICONSTOP | MB_DEFBUTTON2 | MB_TASKMODAL));
+		return (IDNO == MessageBoxA(NULL, message.c_str(), "Assertion Failure", MB_YESNO | MB_ICONSTOP | MB_DEFBUTTON2 | MB_TASKMODAL));
 	}
 	else
 	{
-		OutputDebugStringA(message.CString());
+		OutputDebugStringA(message.c_str());
 		OutputDebugStringA("\r\n");
 	}
 	return true;
@@ -67,7 +67,7 @@ bool SystemInterface::LogMessage(Log::Type ROCKET_UNUSED_PARAMETER(logtype), con
 {
 	ROCKET_UNUSED(logtype);
 
-	fprintf(stderr,"%s\n", message.CString());
+	fprintf(stderr,"%s\n", message.c_str());
 	return true;
 }
 #endif	
@@ -86,15 +86,15 @@ int SystemInterface::TranslateString(String& translated, const String& input)
 void SystemInterface::JoinPath(String& translated_path, const String& document_path, const String& path)
 {
 	// If the path is absolute, strip the leading / and return it.
-	if (path.Substring(0, 1) == "/")
+	if (path.substr(0, 1) == "/")
 	{
-		translated_path = path.Substring(1);
+		translated_path = path.substr(1);
 		return;
 	}
 
 	// If the path is a Windows-style absolute path, return it directly.
-	size_t drive_pos = path.Find(":");
-	size_t slash_pos = Math::Min(path.Find("/"), path.Find("\\"));
+	size_t drive_pos = path.find(":");
+	size_t slash_pos = Math::Min(path.find("/"), path.find("\\"));
 	if (drive_pos != String::npos &&
 		drive_pos < slash_pos)
 	{
@@ -104,16 +104,16 @@ void SystemInterface::JoinPath(String& translated_path, const String& document_p
 
 	// Strip off the referencing document name.
 	translated_path = document_path;
-	translated_path = translated_path.Replace("\\", "/");
-	size_t file_start = translated_path.RFind("/");
+	translated_path = Replace(translated_path, "\\", "/");
+	size_t file_start = translated_path.rfind("/");
 	if (file_start != String::npos)
-		translated_path.Resize(file_start + 1);
+		translated_path.resize(file_start + 1);
 	else
-		translated_path.Clear();
+		translated_path.clear();
 
 	// Append the paths and send through URL to removing any '..'.
-	URL url(translated_path.Replace(":", "|") + path.Replace("\\", "/"));
-	translated_path = url.GetPathedFileName().Replace("|", ":");
+	URL url(Replace(translated_path, ":", "|") + Replace(path, "\\", "/"));
+	translated_path = Replace(url.GetPathedFileName(), "|", ":");
 }
 	
 // Activate keyboard (for touchscreen devices)

+ 3 - 3
Source/Core/Template.cpp

@@ -58,7 +58,7 @@ bool Template::Load(Stream* stream)
 	stream->Read(buffer, stream->Length());
 
 	// Pull out the header
-	const char* head_start = XMLParseTools::FindTag("head", buffer.CString());
+	const char* head_start = XMLParseTools::FindTag("head", buffer.c_str());
 	if (!head_start)	
 		return false;
 
@@ -83,7 +83,7 @@ bool Template::Load(Stream* stream)
 	// storing the ones we're interested in.
 	String attribute_name;
 	String attribute_value;
-	const char* ptr = XMLParseTools::FindTag("template", buffer.CString());
+	const char* ptr = XMLParseTools::FindTag("template", buffer.c_str());
 	if (!ptr)
 		return false;
 
@@ -123,7 +123,7 @@ Element* Template::ParseTemplate(Element* element)
 
 	// If theres an inject attribute on the template, 
 	// attempt to find the required element
-	if (!content.Empty())
+	if (!content.empty())
 	{
 		Element* content_element = ElementUtilities::GetElementById(element, content);
 		if (content_element)

+ 4 - 4
Source/Core/TemplateCache.cpp

@@ -79,13 +79,13 @@ Template* TemplateCache::LoadTemplate(const String& name)
 		new_template = new Template();
 		if (!new_template->Load(stream))
 		{
-			Log::Message(Log::LT_ERROR, "Failed to load template %s.", name.CString());
+			Log::Message(Log::LT_ERROR, "Failed to load template %s.", name.c_str());
 			delete new_template;
 			new_template = NULL;
 		}
-		else if (new_template->GetName().Empty())
+		else if (new_template->GetName().empty())
 		{
-			Log::Message(Log::LT_ERROR, "Failed to load template %s, template is missing its name.", name.CString());
+			Log::Message(Log::LT_ERROR, "Failed to load template %s, template is missing its name.", name.c_str());
 			delete new_template;
 			new_template = NULL;
 		}
@@ -97,7 +97,7 @@ Template* TemplateCache::LoadTemplate(const String& name)
 	}
 	else
 	{
-		Log::Message(Log::LT_ERROR, "Failed to open template file %s.", name.CString());		
+		Log::Message(Log::LT_ERROR, "Failed to open template file %s.", name.c_str());		
 	}
 	stream->RemoveReference();
 

+ 2 - 2
Source/Core/TextureDatabase.cpp

@@ -62,10 +62,10 @@ void TextureDatabase::Shutdown()
 TextureResource* TextureDatabase::Fetch(const String& source, const String& source_directory)
 {
 	String path;
-	if (source.Substring(0, 1) == "?")
+	if (source.substr(0, 1) == "?")
 		path = source;
 	else
-		GetSystemInterface()->JoinPath(path, source_directory.Replace("|", ":"), source);
+		GetSystemInterface()->JoinPath(path, Replace(source_directory, "|", ":"), source);
 
 	TextureMap::iterator iterator = instance->textures.find(path);
 	if (iterator != instance->textures.end())

+ 5 - 5
Source/Core/TextureResource.cpp

@@ -116,7 +116,7 @@ void TextureResource::Release(RenderInterface* render_interface)
 bool TextureResource::Load(RenderInterface* render_interface) const
 {
 	// Check for special loader tokens.
-	if (!source.Empty() &&
+	if (!source.empty() &&
 		source[0] == '?')
 	{
 		Vector2i dimensions;
@@ -125,7 +125,7 @@ bool TextureResource::Load(RenderInterface* render_interface) const
 		const byte* data = NULL;
 
 		// Find the generation protocol and generate the data accordingly.
-		String protocol = source.Substring(1, source.Find("::") - 1);
+		String protocol = source.substr(1, source.find("::") - 1);
 		if (protocol == "font")
 		{
 			// The requested texture is a font layer.
@@ -135,7 +135,7 @@ bool TextureResource::Load(RenderInterface* render_interface) const
 			FontEffect* layer_id;
 			int texture_id;
 			
-			if (sscanf(source.CString(), "?font::%p/%p/%d", &handle, &layer_id, &texture_id) == 3)
+			if (sscanf(source.c_str(), "?font::%p/%p/%d", &handle, &layer_id, &texture_id) == 3)
 			{
 				handle->GenerateLayerTexture(data,
 											 dimensions,
@@ -161,7 +161,7 @@ bool TextureResource::Load(RenderInterface* render_interface) const
 			}
 			else
 			{
-				Log::Message(Log::LT_WARNING, "Failed to generate internal texture %s.", source.CString());
+				Log::Message(Log::LT_WARNING, "Failed to generate internal texture %s.", source.c_str());
 				texture_data[render_interface] = TextureData(0, Vector2i(0, 0));
 
 				return false;
@@ -173,7 +173,7 @@ bool TextureResource::Load(RenderInterface* render_interface) const
 	Vector2i dimensions;
 	if (!render_interface->LoadTexture(handle, dimensions, source))
 	{
-		Log::Message(Log::LT_WARNING, "Failed to load texture from %s.", source.CString());
+		Log::Message(Log::LT_WARNING, "Failed to load texture from %s.", source.c_str());
 		texture_data[render_interface] = TextureData(0, Vector2i(0, 0));
 
 		return false;

+ 61 - 61
Source/Core/URL.cpp

@@ -67,31 +67,31 @@ bool URL::SetURL(const String& _url)
 	url = _url;
 
 	// Make sure an Empty URL is completely Empty.
-	if (url.Empty())
+	if (url.empty())
 	{
-		protocol.Clear();
-		login.Clear();
-		password.Clear();
-		host.Clear();
+		protocol.clear();
+		login.clear();
+		password.clear();
+		host.clear();
 		port = 0;
-		path.Clear();
-		file_name.Clear();
-		extension.Clear();
+		path.clear();
+		file_name.clear();
+		extension.clear();
 
 		return true;
 	}
 
 	// Find the protocol. This consists of the string appearing before the
 	// '://' token (ie, file://, http://).
-	const char* host_begin = strchr(_url.CString(), ':');
+	const char* host_begin = strchr(_url.c_str(), ':');
 	if (NULL != host_begin)
 	{
-		protocol.Assign(_url.CString(), host_begin);
+		protocol = String(_url.c_str(), host_begin);
 		if (0 != strncmp(host_begin, "://", 3))
 		{
 			char malformed_terminator[4] = {0, 0, 0, 0};
 			strncpy(malformed_terminator, host_begin, 3);
-			Log::Message(Log::LT_ERROR, "Malformed protocol identifier found in URL %s; expected %s://, found %s%s.\n", _url.CString(), protocol.CString(), protocol.CString(), malformed_terminator);
+			Log::Message(Log::LT_ERROR, "Malformed protocol identifier found in URL %s; expected %s://, found %s%s.\n", _url.c_str(), protocol.c_str(), protocol.c_str(), malformed_terminator);
 
 			return false;
 		}
@@ -100,13 +100,13 @@ bool URL::SetURL(const String& _url)
 	else
 	{
 		protocol = DEFAULT_PROTOCOL;
-		host_begin = _url.CString();
+		host_begin = _url.c_str();
 	}
 
 
 	// We only want to look for a host if a protocol was specified.
 	const char* path_begin;
-	if (host_begin != _url.CString())
+	if (host_begin != _url.c_str())
 	{
 		// Find the host. This is the string appearing after the protocol or after
 		// the username:password combination, and terminated either with a colon, 
@@ -117,14 +117,14 @@ bool URL::SetURL(const String& _url)
 		if ( at_symbol )
 		{
 			String login_password;
-			login_password.Assign( host_begin, at_symbol );			
+			login_password = String( host_begin, at_symbol );			
 			host_begin = at_symbol + 1;
 
-			const char* password_ptr = strchr( login_password.CString(), ':' );
+			const char* password_ptr = strchr( login_password.c_str(), ':' );
 			if ( password_ptr )
 			{
-				login.Assign( login_password.CString(), password_ptr );
-				password.Assign( password_ptr + 1 );
+				login = String( login_password.c_str(), password_ptr );
+				password = String( password_ptr + 1 );
 			}
 			else
 			{
@@ -140,11 +140,11 @@ bool URL::SetURL(const String& _url)
 		{
 			if (1 != sscanf(port_begin, ":%d", &port))
 			{
-				Log::Message(Log::LT_ERROR, "Malformed port number found in URL %s.\n", _url.CString());
+				Log::Message(Log::LT_ERROR, "Malformed port number found in URL %s.\n", _url.c_str());
 				return false;
 			}
 
-			host.Assign(host_begin, port_begin);
+			host = String(host_begin, port_begin);
 
 			// Don't continue if there is no path.
 			if (NULL == path_begin)
@@ -168,14 +168,14 @@ bool URL::SetURL(const String& _url)
 			{
 				// Assign the host name, then increment the path string past the
 				// trailing slash.
-				host.Assign(host_begin, path_begin);
+				host = String(host_begin, path_begin);
 				++path_begin;
 			}
 		}
 	}
 	else
 	{
-		path_begin = _url.CString();
+		path_begin = _url.c_str();
 	}
 	
 	// Check for parameters
@@ -184,8 +184,8 @@ bool URL::SetURL(const String& _url)
 	if ( parameters )
 	{
 		// Pull the path segment out, so further processing doesn't read the parameters
-		path_segment.Assign(path_begin, parameters);
-		path_begin = path_segment.CString();
+		path_segment = String(path_begin, parameters);
+		path_begin = path_segment.c_str();
 		
 		// Loop through all parameters, loading them
 		StringList parameter_list;
@@ -217,20 +217,20 @@ bool URL::SetURL(const String& _url)
 	else
 	{
 		// Copy the path including the trailing slash.
-		path.Assign(path_begin, ++file_name_begin);
+		path = String(path_begin, ++file_name_begin);
 
 		// Normalise the path, stripping any ../'s from it
 		size_t parent_dir_pos = String::npos;
-		while ((parent_dir_pos = path.Find("/..")) != String::npos)
+		while ((parent_dir_pos = path.find("/..")) != String::npos)
 		{
 			// If we found a /.. we should be able to find the start of the parent
 			// directory, if we can't something wierd has happend, bail
-			size_t parent_dir_start_pos = path.RFind("/", parent_dir_pos);
+			size_t parent_dir_start_pos = path.rfind("/", parent_dir_pos);
 			if (parent_dir_start_pos == String::npos)
 				break;
 
 			// Strip out the parent dir and the /..
-			path.Erase(parent_dir_start_pos, parent_dir_pos - parent_dir_start_pos + 3);
+			path.erase(parent_dir_start_pos, parent_dir_pos - parent_dir_start_pos + 3);
 
 			// We've altered the URL, mark it dirty
 			url_dirty = true;
@@ -248,7 +248,7 @@ bool URL::SetURL(const String& _url)
 	}
 	else
 	{
-		file_name.Assign(file_name_begin, extension_begin);
+		file_name = String(file_name_begin, extension_begin);
 		extension = extension_begin + 1;
 	}
 	
@@ -350,8 +350,8 @@ bool URL::SetPath(const String& _path)
 bool URL::PrefixPath(const String& prefix)
 {
 	// If there's no trailing slash on the end of the prefix, add one.
-	if (!prefix.Empty() &&
-		prefix[prefix.Length() - 1] != '/')
+	if (!prefix.empty() &&
+		prefix[prefix.size() - 1] != '/')
 		path = prefix + "/" + path;
 	else
 		path = prefix + path;
@@ -432,9 +432,9 @@ String URL::GetPathedFileName() const
 	pathed_file_name += file_name;
 	
 	// Append the extension.
-	if (!extension.Empty())
+	if (!extension.empty())
 	{
-		pathed_file_name.Append(".");
+		pathed_file_name += ".";
 		pathed_file_name += extension;
 	}
 	
@@ -476,46 +476,46 @@ void URL::ConstructURL() const
 	url = "";
 
 	// Append the protocol.
-	if (!protocol.Empty() && !host.Empty())	
+	if (!protocol.empty() && !host.empty())	
 	{
 		url = protocol;
-		url.Append("://");
+		url += "://";
 	}
 
 	// Append login and password
-	if (!login.Empty())
+	if (!login.empty())
 	{
-		url.Append( login );
-		if (!password.Empty())
+		url +=  login ;
+		if (!password.empty())
 		{		
-			url.Append( ":" );
-			url.Append( password );
+			url +=  ":" ;
+			url +=  password ;
 		}
-		url.Append( "@" );
+		url +=  "@" ;
 	}
-	ROCKET_ASSERTMSG( password.Empty() || ( !password.Empty() && !login.Empty() ), "Can't have a password without a login!" );
+	ROCKET_ASSERTMSG( password.empty() || ( !password.empty() && !login.empty() ), "Can't have a password without a login!" );
 
 	// Append the host.
 	url += host;
 	
 	// Only check ports if there is some host/protocol part
-	if ( !url.Empty() )
+	if ( !url.empty() )
 	{		
 		if (port > 0)
 		{
-			ROCKET_ASSERTMSG( !host.Empty(), "Can't have a port without a host!" );
+			ROCKET_ASSERTMSG( !host.empty(), "Can't have a port without a host!" );
 			char port_string[16];
 			sprintf(port_string, ":%d/", port);
-			url.Append(port_string);
+			url += port_string;
 		}
 		else
 		{
-			url.Append("/");
+			url += "/";
 		}
 	}
 
 	// Append the path.
-	if (!path.Empty())
+	if (!path.empty())
 	{
 		url += path;
 	}
@@ -524,9 +524,9 @@ void URL::ConstructURL() const
 	url += file_name;
 
 	// Append the extension.
-	if (!extension.Empty())
+	if (!extension.empty())
 	{
-		url.Append(".");
+		url += ".";
 		url += extension;
 	}
 	
@@ -545,18 +545,18 @@ String URL::UrlEncode(const String &value)
 	String encoded;
 	char hex[4] = {0,0,0,0};
 
-	encoded.Clear();
+	encoded.clear();
 
-	const char *value_c = value.CString();
+	const char *value_c = value.c_str();
 	for (String::size_type i = 0; value_c[i]; i++) 
 	{
 		char c = value_c[i];
 		if (IsUnreservedChar(c))
-			encoded.Append(c);
+			encoded += c;
 		else
 		{
 			sprintf(hex, "%%%02X", c);
-			encoded.Append(hex);
+			encoded += hex;
 		}
 	}
 
@@ -567,31 +567,31 @@ String URL::UrlDecode(const String &value)
 {
 	String decoded;
 
-	decoded.Clear();
+	decoded.clear();
 
-	const char *value_c = value.CString();
-	String::size_type value_len = value.Length();
+	const char *value_c = value.c_str();
+	String::size_type value_len = value.size();
 	for (String::size_type i = 0; i < value_len; i++) 
 	{
 		char c = value_c[i];
 		if (c == '+')
 		{
-			decoded.Append(' ' );
+			decoded += ' ';
 		}
 		else if (c == '%')
 		{
 			char *endp;
-			String t = value.Substring(i+1, 2);
-			int ch = strtol(t.CString(), &endp, 16);
+			String t = value.substr(i+1, 2);
+			int ch = strtol(t.c_str(), &endp, 16);
 			if (*endp == '\0')
-				decoded.Append(char(ch));
+				decoded += char(ch);
 			else
-				decoded.Append(t);
+				decoded += t;
 			i += 2;
 		}
 		else
 		{
-			decoded.Append(c);
+			decoded += c;
 		}
 	}
 

+ 15 - 15
Source/Core/UnicodeRange.cpp

@@ -49,47 +49,47 @@ UnicodeRange::UnicodeRange(int _min_codepoint, int _max_codepoint)
 bool UnicodeRange::Initialise(const String& unicode_range)
 {
 	// Check for a 'U+' at the start.
-	if (unicode_range.Length() < 2 ||
+	if (unicode_range.size() < 2 ||
 		unicode_range[0] != 'U' ||
 		unicode_range[1] != '+')
 		return false;
 
 	// Check if there's a '-' sign; if so, we've got a range.
-	String::size_type separator_index = unicode_range.Find("-", 2);
+	String::size_type separator_index = unicode_range.find("-", 2);
 	if (separator_index != String::npos)
 	{
-		const char* end = unicode_range.CString() + separator_index;
-		min_codepoint = strtoul(unicode_range.CString() + 2, (char **) &end, 16);
+		const char* end = unicode_range.c_str() + separator_index;
+		min_codepoint = strtoul(unicode_range.c_str() + 2, (char **) &end, 16);
 
-		end = unicode_range.CString() + unicode_range.Length();
-		max_codepoint = strtoul(unicode_range.CString() + separator_index + 1, (char **) &end, 16);
+		end = unicode_range.c_str() + unicode_range.size();
+		max_codepoint = strtoul(unicode_range.c_str() + separator_index + 1, (char **) &end, 16);
 
 		return min_codepoint <= max_codepoint;
 	}
 
 	// No range! Check if we have any wildcards.
-	String::size_type wildcard_index = unicode_range.Find("?", 2);
+	String::size_type wildcard_index = unicode_range.find("?", 2);
 	if (wildcard_index != String::npos)
 	{
-		String range_min(unicode_range.CString() + 2, unicode_range.CString() + wildcard_index);
+		String range_min(unicode_range.c_str() + 2, unicode_range.c_str() + wildcard_index);
 		String range_max(range_min);
 
-		for (String::size_type i = 0; i < unicode_range.Length() - wildcard_index; ++i)
+		for (String::size_type i = 0; i < unicode_range.size() - wildcard_index; ++i)
 		{
 			range_min += "0";
 			range_max += "F";
 		}
 
-		const char* end = range_min.CString() + range_min.Length();
-		min_codepoint = strtoul(range_min.CString(), (char**) &end, 16);
-		end = range_max.CString() + range_max.Length();
-		max_codepoint = strtoul(range_max.CString(), (char**) &end, 16);
+		const char* end = range_min.c_str() + range_min.size();
+		min_codepoint = strtoul(range_min.c_str(), (char**) &end, 16);
+		end = range_max.c_str() + range_max.size();
+		max_codepoint = strtoul(range_max.c_str(), (char**) &end, 16);
 
 		return true;
 	}
 
-	const char* end = unicode_range.CString() + unicode_range.Length();
-	min_codepoint = strtoul(unicode_range.CString() + 2, (char**) &end, 16);
+	const char* end = unicode_range.c_str() + unicode_range.size();
+	min_codepoint = strtoul(unicode_range.c_str() + 2, (char**) &end, 16);
 	max_codepoint = min_codepoint;
 
 	return true;

+ 1 - 1
Source/Core/Variant.cpp

@@ -154,7 +154,7 @@ void Variant::Set(const String& value)
 {
 	if (type == STRING)
 	{
-		((String*)data)->Assign(value);
+		(*(String*)data) = value;
 	}
 	else
 	{

+ 0 - 139
Source/Core/WString.cpp

@@ -31,144 +31,5 @@
 namespace Rocket {
 namespace Core {
 
-// Constructs an empty string.
-WString::WString()
-{
-}
-
-// Constructs a string as a copy of another UCS-2 string.
-WString::WString(const WStringBase& ucs2_string) : WStringBase(ucs2_string)
-{
-}
-
-// Constructs a string from a sequence of UCS-2 encoded characters.
-WString::WString(const word* ucs2_string_begin, const word* ucs2_string_end) : WStringBase(ucs2_string_begin, ucs2_string_end)
-{
-}
-
-// Constructs a string from multiples of a UCS-2 encoded character.
-WString::WString(WStringBase::size_type count, word ucs2_char) : WStringBase(count, ucs2_char)
-{
-}
-
-// Constructs a string from a sequence of UTF-8 encoded characters.
-WString::WString(const char* utf8_string)
-{
-	std::vector< word > ucs2_string;
-	StringUtilities::UTF8toUCS2(utf8_string, ucs2_string);
-
-	if (ucs2_string.size() > 1)
-		Assign(&ucs2_string[0], &ucs2_string[ucs2_string.size() - 1]);
-}
-
-// Constructs a string from a sequence of UTF-8 encoded characters.
-	WString::WString(const char* utf8_string_begin, const char* utf8_string_end)
-{
-	std::vector< word > ucs2_string;
-	StringUtilities::UTF8toUCS2(String(utf8_string_begin, utf8_string_end), ucs2_string);
-
-	if (ucs2_string.size() > 1)
-		Assign(&ucs2_string[0], &ucs2_string[ucs2_string.size() - 1]);
-}
-
-// Constructs a string from a sequence of UTF-8 encoded characters.
-	WString::WString(const String& utf8_string)
-{
-	std::vector< word > ucs2_string;
-	StringUtilities::UTF8toUCS2(utf8_string, ucs2_string);
-
-	if (ucs2_string.size() > 1)
-		Assign(&ucs2_string[0], &ucs2_string[ucs2_string.size() - 1]);
-}
-
-// Destroys the string.
-WString::~WString()
-{
-}
-
-// Converts the string to UTF-8 encoding.
-String& WString::ToUTF8(String& utf8_string, bool append) const
-{
-	if (!append)
-	{
-		utf8_string.Clear();
-	}
-	StringUtilities::UCS2toUTF8(CString(), Length(), utf8_string);
-	return utf8_string;
-}
-
-/// Assigns a UCS-2 string to this string.
-WString& WString::operator=(const WStringBase& string)
-{
-	WStringBase::operator=(string);
-	return *this;
-}
-
-// Assigns a UCS-2 string to this string.
-WString& WString::operator=(const WString& string)
-{
-	WStringBase::operator=(string);
-	return *this;
-}
-
-// Assigns a null-terminated UCS-2 string to this string.
-WString& WString::operator=(const word* string)
-{
-	WStringBase::operator=(string);
-	return *this;
-}
-
-// Converts a UTF-8 encoded string into UCS-2 and assigns it to this string.
-WString& WString::operator=(const char* string)
-{
-	std::vector< word > ucs2_string;
-	StringUtilities::UTF8toUCS2(string, ucs2_string);
-
-	if (ucs2_string.size() > 1)
-		Assign(&ucs2_string[0], &ucs2_string[ucs2_string.size() - 1]);
-	else
-		Clear();
-
-	return *this;
-}
-
-// Checks equality between two UCS-2 encoded strings.
-bool WString::operator==(const WString& string) const
-{
-	return WStringBase::operator==(string);
-}
-
-// Checks equality between this string and another string in UTF-8 encoded.
-bool WString::operator==(const char* _string) const
-{
-	return WStringBase::operator==(WString(_string));
-}
-
-WStringBase::size_type WString::Find(const WString& s, size_type pos) const
-{
-	return WStringBase::Find(s, pos);
-}
-
-WStringBase::size_type WString::Find(const word* s, size_type pos) const
-{
-	return WStringBase::Find(s, pos);
-}
-
-WStringBase::size_type WString::Find(const word& s, size_type pos) const
-{
-	word buffer[2] = { s, 0 };
-	return WStringBase::Find(buffer, pos);
-}
-
-word& WString::operator[](size_type offset)
-{
-	return WStringBase::operator[](offset);
-}
-
-word WString::operator[](size_type offset) const
-{
-	return WStringBase::operator[](offset);
-}
-
 }
 }

+ 1 - 1
Source/Core/XMLNodeHandlerBody.cpp

@@ -50,7 +50,7 @@ Element* XMLNodeHandlerBody::ElementStart(XMLParser* parser, const String& ROCKE
 
 	// Check for and apply any template
 	String template_name = attributes.Get<String>("template", "");
-	if (!template_name.Empty())
+	if (!template_name.empty())
 	{
 		element = XMLParseTools::ParseTemplate(element, template_name);
 	}

+ 1 - 1
Source/Core/XMLNodeHandlerDefault.cpp

@@ -53,7 +53,7 @@ Element* XMLNodeHandlerDefault::ElementStart(XMLParser* parser, const String& na
 	Element* element = Factory::InstanceElement(parent, name, name, attributes);
 	if (!element)
 	{
-		Log::Message(Log::LT_ERROR, "Failed to create element for tag %s, instancer returned NULL.", name.CString());
+		Log::Message(Log::LT_ERROR, "Failed to create element for tag %s, instancer returned NULL.", name.c_str());
 		return NULL;
 	}
 

+ 6 - 6
Source/Core/XMLNodeHandlerHead.cpp

@@ -54,10 +54,10 @@ Element* XMLNodeHandlerHead::ElementStart(XMLParser* parser, const String& name,
 	else if (name == "link")
 	{
 		// Lookup the type and href
-		String type = attributes.Get<String>("type", "").ToLower();
+		String type = ToLower(attributes.Get<String>("type", ""));
 		String href = attributes.Get<String>("href", "");
 
-		if (!type.Empty() && !href.Empty())
+		if (!type.empty() && !href.empty())
 		{
 			// If its RCSS (... or CSS!), add to the RCSS fields.
 			if (type == "text/rcss" ||
@@ -74,7 +74,7 @@ Element* XMLNodeHandlerHead::ElementStart(XMLParser* parser, const String& name,
 
 			else
 			{
-				Log::ParseError(parser->GetSourceURL().GetURL(), parser->GetLineNumber(), "Invalid link type '%s'", type.CString());
+				Log::ParseError(parser->GetSourceURL().GetURL(), parser->GetLineNumber(), "Invalid link type '%s'", type.c_str());
 			}
 		}
 		else
@@ -88,7 +88,7 @@ Element* XMLNodeHandlerHead::ElementStart(XMLParser* parser, const String& name,
 	{
 		// Check if its an external string
 		String src = attributes.Get<String>("src", "");
-		if (src.Length() > 0)
+		if (src.size() > 0)
 		{
 			parser->GetDocumentHeader()->scripts_external.push_back(src);
 		}
@@ -127,11 +127,11 @@ bool XMLNodeHandlerHead::ElementData(XMLParser* parser, const String& data)
 	}
 
 	// Store an inline script
-	if (tag == "script" && data.Length() > 0)
+	if (tag == "script" && data.size() > 0)
 		parser->GetDocumentHeader()->scripts_inline.push_back(data);
 
 	// Store an inline style
-	if (tag == "style" && data.Length() > 0)
+	if (tag == "style" && data.size() > 0)
 		parser->GetDocumentHeader()->rcss_inline.push_back(data);
 
 	return true;

+ 1 - 1
Source/Core/XMLParseTools.cpp

@@ -144,7 +144,7 @@ Element* XMLParseTools::ParseTemplate(Element* element, const String& template_n
 	Template* parse_template = TemplateCache::GetTemplate(template_name);
 	if (!parse_template)
 	{
-		Log::ParseError(element->GetOwnerDocument()->GetSourceURL(), -1, "Failed to find template '%s'.", template_name.CString());
+		Log::ParseError(element->GetOwnerDocument()->GetSourceURL(), -1, "Failed to find template '%s'.", template_name.c_str());
 		return element;
 	}
 

+ 7 - 7
Source/Core/XMLParser.cpp

@@ -63,10 +63,10 @@ XMLParser::~XMLParser()
 // Registers a custom node handler to be used to a given tag.
 XMLNodeHandler* XMLParser::RegisterNodeHandler(const String& _tag, XMLNodeHandler* handler)
 {
-	String tag = _tag.ToLower();
+	String tag = ToLower(_tag);
 
 	// Check for a default node registration.
-	if (tag.Empty())
+	if (tag.empty())
 	{
 		if (default_node_handler != NULL)
 			default_node_handler->RemoveReference();
@@ -119,7 +119,7 @@ void XMLParser::PushDefaultHandler()
 
 bool XMLParser::PushHandler(const String& tag)
 {
-	NodeHandlers::iterator i = node_handlers.find(tag.ToLower());
+	NodeHandlers::iterator i = node_handlers.find(ToLower(tag));
 	if (i == node_handlers.end())
 		return false;
 
@@ -136,7 +136,7 @@ const XMLParser::ParseFrame* XMLParser::GetParseFrame() const
 /// Called when the parser finds the beginning of an element tag.
 void XMLParser::HandleElementStart(const String& _name, const XMLAttributes& _attributes)
 {
-	String name = _name.ToLower();
+	String name = ToLower(_name);
 	XMLAttributes attributes;
 	
 	String key;
@@ -144,7 +144,7 @@ void XMLParser::HandleElementStart(const String& _name, const XMLAttributes& _at
 	int pos = 0;
 	while (_attributes.Iterate(pos, key, value))
 	{
-		attributes.Set(key.ToLower(), *value);
+		attributes.Set(ToLower(key), *value);
 	}
 
 	// Check for a specific handler that will override the child handler.
@@ -175,7 +175,7 @@ void XMLParser::HandleElementStart(const String& _name, const XMLAttributes& _at
 /// Called when the parser finds the end of an element tag.
 void XMLParser::HandleElementEnd(const String& _name)
 {
-	String name = _name.ToLower();
+	String name = ToLower(_name);
 
 	// Copy the top of the stack
 	ParseFrame frame = stack.top();
@@ -187,7 +187,7 @@ void XMLParser::HandleElementEnd(const String& _name)
 	// Check frame names
 	if (name != frame.tag)
 	{
-		Log::Message(Log::LT_ERROR, "Closing tag '%s' mismatched on %s:%d was expecting '%s'.", name.CString(), GetSourceURL().GetURL().CString(), GetLineNumber(), frame.tag.CString());
+		Log::Message(Log::LT_ERROR, "Closing tag '%s' mismatched on %s:%d was expecting '%s'.", name.c_str(), GetSourceURL().GetURL().c_str(), GetLineNumber(), frame.tag.c_str());
 	}
 
 	// Call element end handler

+ 46 - 46
Source/Debugger/ElementInfo.cpp

@@ -149,7 +149,7 @@ void ElementInfo::ProcessEvent(Core::Event& event)
 				else
 				{
 					int element_index;
-					if (sscanf(target_element->GetId().CString(), "a %d", &element_index) == 1)
+					if (sscanf(target_element->GetId().c_str(), "a %d", &element_index) == 1)
 					{
 						Core::Element* new_source_element = source_element;
 						for (int i = 0; i < element_index; i++)
@@ -159,7 +159,7 @@ void ElementInfo::ProcessEvent(Core::Event& event)
 						}
 						SetSourceElement(new_source_element);
 					}
-					else if (sscanf(target_element->GetId().CString(), "c %d", &element_index) == 1)
+					else if (sscanf(target_element->GetId().c_str(), "c %d", &element_index) == 1)
 					{
 						if (source_element != NULL)
 							SetSourceElement(source_element->GetChild(element_index));
@@ -188,7 +188,7 @@ void ElementInfo::ProcessEvent(Core::Event& event)
 			{
 				// Check if the id is in the form "a %d" or "c %d" - these are the ancestor or child labels.
 				int element_index;
-				if (sscanf(target_element->GetId().CString(), "a %d", &element_index) == 1)
+				if (sscanf(target_element->GetId().c_str(), "a %d", &element_index) == 1)
 				{
 					hover_element = source_element;
 					for (int i = 0; i < element_index; i++)
@@ -197,14 +197,14 @@ void ElementInfo::ProcessEvent(Core::Event& event)
 							hover_element = hover_element->GetParentNode();
 					}
 				}
-				else if (sscanf(target_element->GetId().CString(), "c %d", &element_index) == 1)
+				else if (sscanf(target_element->GetId().c_str(), "c %d", &element_index) == 1)
 				{
 					if (source_element != NULL)
 						hover_element = source_element->GetChild(element_index);
 				}
 			}
 			// Otherwise we just want to focus on the clicked element (unless it's on a debug element)
-			else if (owner_document != NULL && owner_document->GetId().Find("rkt-debug-") != 0)
+			else if (owner_document != NULL && owner_document->GetId().find("rkt-debug-") != 0)
 			{
 				hover_element = target_element;
 			}
@@ -248,23 +248,23 @@ void ElementInfo::UpdateSourceElement()
 			{
 				name = "id";
 				value = source_element->GetId();
-				if (!value.Empty())
-					attributes.Append(Core::String(name.Length() + value.Length() + 32, "%s: <em>%s</em><br />", name.CString(), value.CString()));
+				if (!value.empty())
+					attributes += Core::CreateString(name.size() + value.size() + 32, "%s: <em>%s</em><br />", name.c_str(), value.c_str());
 			}
 			{
 				name = "class";
 				value = source_element->GetClassNames();
-				if (!value.Empty())
-					attributes.Append(Core::String(name.Length() + value.Length() + 32, "%s: <em>%s</em><br />", name.CString(), value.CString()));
+				if (!value.empty())
+					attributes += Core::CreateString(name.size() + value.size() + 32, "%s: <em>%s</em><br />", name.c_str(), value.c_str());
 			}
 			{
 				// Not actually an attribute, but may be useful
 				name = "pseudo";
-				value.Clear();
+				value.clear();
 				for (auto str : source_element->GetActivePseudoClasses())
 					value += " :" + str;
-				if (!value.Empty())
-					attributes.Append(Core::String(name.Length() + value.Length() + 32, "%s: <em>%s</em><br />", name.CString(), value.CString()));
+				if (!value.empty())
+					attributes += Core::CreateString(name.size() + value.size() + 32, "%s: <em>%s</em><br />", name.c_str(), value.c_str());
 			}
 			{
 				name = "style";
@@ -276,21 +276,21 @@ void ElementInfo::UpdateSourceElement()
 					{
 						auto& prop_name = nvp.first;
 						auto prop_value = nvp.second.ToString();
-						value.Append(Core::String(prop_name.Length() + prop_value.Length() + 12, "%s: %s; ", prop_name.CString(), prop_value.CString()));
+						value += Core::CreateString(prop_name.size() + prop_value.size() + 12, "%s: %s; ", prop_name.c_str(), prop_value.c_str());
 					}
 				}
-				if (!value.Empty())
-					attributes.Append(Core::String(name.Length() + value.Length() + 32, "%s: <em>%s</em><br />", name.CString(), value.CString()));
+				if (!value.empty())
+					attributes += Core::CreateString(name.size() + value.size() + 32, "%s: <em>%s</em><br />", name.c_str(), value.c_str());
 			}
 
 			while (source_element->IterateAttributes(index, name, value))
 			{
 				if(name != "class" && name != "style" && name != "id") 
-					attributes.Append(Core::String(name.Length() + value.Length() + 32, "%s: <em>%s</em><br />", name.CString(), value.CString()));
+					attributes += Core::CreateString(name.size() + value.size() + 32, "%s: <em>%s</em><br />", name.c_str(), value.c_str());
 			}
 		}
 
-		if (attributes.Empty())
+		if (attributes.empty())
 		{
 			while (attributes_content->HasChildNodes())
 				attributes_content->RemoveChild(attributes_content->GetChild(0));
@@ -307,7 +307,7 @@ void ElementInfo::UpdateSourceElement()
 		if (source_element != NULL)
 			BuildElementPropertiesRML(properties, source_element, source_element);
 
-		if (properties.Empty())
+		if (properties.empty())
 		{
 			while (properties_content->HasChildNodes())
 				properties_content->RemoveChild(properties_content->GetChild(0));
@@ -327,7 +327,7 @@ void ElementInfo::UpdateSourceElement()
 			events = source_element->GetEventDispatcherSummary();
 		}
 
-		if (events.Empty())
+		if (events.empty())
 		{
 			while (events_content->HasChildNodes())
 				events_content->RemoveChild(events_content->GetChild(0));
@@ -347,10 +347,10 @@ void ElementInfo::UpdateSourceElement()
 			Core::Vector2f element_size = source_element->GetBox().GetSize(Core::Box::BORDER);
 
 			Core::String positions;
-			positions.Append(Core::String(64, "left: <em>%.0fpx</em><br />", element_offset.x));
-			positions.Append(Core::String(64, "top: <em>%.0fpx</em><br />", element_offset.y));
-			positions.Append(Core::String(64, "width: <em>%.0fpx</em><br />", element_size.x));
-			positions.Append(Core::String(64, "height: <em>%.0fpx</em><br />", element_size.y));
+			positions += Core::CreateString(64, "left: <em>%.0fpx</em><br />", element_offset.x);
+			positions += Core::CreateString(64, "top: <em>%.0fpx</em><br />", element_offset.y);
+			positions += Core::CreateString(64, "width: <em>%.0fpx</em><br />", element_size.x);
+			positions += Core::CreateString(64, "height: <em>%.0fpx</em><br />", element_size.y);
 
 			position_content->SetInnerRML(positions);
 		}
@@ -375,18 +375,18 @@ void ElementInfo::UpdateSourceElement()
 		{
 			Core::String ancestor_name = element_ancestor->GetTagName();
 			const Core::String ancestor_id = element_ancestor->GetId();
-			if (!ancestor_id.Empty())
+			if (!ancestor_id.empty())
 			{
 				ancestor_name += "#";
 				ancestor_name += ancestor_id;
 			}
 
-			ancestors.Append(Core::String(ancestor_name.Length() + 32, "<p id=\"a %d\">%s</p>", ancestor_depth, ancestor_name.CString()));
+			ancestors += Core::CreateString(ancestor_name.size() + 32, "<p id=\"a %d\">%s</p>", ancestor_depth, ancestor_name.c_str());
 			element_ancestor = element_ancestor->GetParentNode();
 			ancestor_depth++;
 		}
 
-		if (ancestors.Empty())
+		if (ancestors.empty())
 		{
 			while (ancestors_content->HasChildNodes())
 				ancestors_content->RemoveChild(ancestors_content->GetFirstChild());
@@ -412,17 +412,17 @@ void ElementInfo::UpdateSourceElement()
 
 				Core::String child_name = child->GetTagName();
 				const Core::String child_id = child->GetId();
-				if (!child_id.Empty())
+				if (!child_id.empty())
 				{
 					child_name += "#";
 					child_name += child_id;
 				}
 
-				children.Append(Core::String(child_name.Length() + 32, "<p id=\"c %d\">%s</p>", i, child_name.CString()));
+				children += Core::CreateString(child_name.size() + 32, "<p id=\"c %d\">%s</p>", i, child_name.c_str());
 			}
 		}
 
-		if (children.Empty())
+		if (children.empty())
 		{
 			while (children_content->HasChildNodes())
 				children_content->RemoveChild(children_content->GetChild(0));
@@ -457,7 +457,7 @@ void ElementInfo::BuildElementPropertiesRML(Core::String& property_rml, Core::El
 			NamedPropertyList::iterator insert_iterator = properties.begin();
 			while (insert_iterator != properties.end())
 			{
-				int source_cmp = strcasecmp((*insert_iterator).second->source.CString(), property->source.CString());
+				int source_cmp = strcasecmp((*insert_iterator).second->source.c_str(), property->source.c_str());
 				if (source_cmp > 0 ||
 					(source_cmp == 0 && (*insert_iterator).second->source_line_number >= property->source_line_number))
 					break;
@@ -473,7 +473,7 @@ void ElementInfo::BuildElementPropertiesRML(Core::String& property_rml, Core::El
 	{
 		// Print the 'inherited from ...' header if we're not the primary element.
 		if (element != primary_element)
-			property_rml += Core::String(element->GetTagName().Length() + 32, "<h3>inherited from %s</h3>", element->GetTagName().CString());
+			property_rml += Core::CreateString(element->GetTagName().size() + 32, "<h3>inherited from %s</h3>", element->GetTagName().c_str());
 
 		NamedPropertyMap::iterator base_properties = property_map.find(Core::PseudoClassList());
 		if (base_properties != property_map.end())
@@ -486,15 +486,15 @@ void ElementInfo::BuildElementPropertiesRML(Core::String& property_rml, Core::El
 				continue;
 
 			// Print the pseudo-class header.
-			property_rml.Append("<h3>");
+			property_rml += "<h3>";
 
 			for (Core::PseudoClassList::const_iterator j = (*i).first.begin(); j != (*i).first.end(); ++j)
 			{
-				property_rml.Append(" :");
-				property_rml.Append(*j);
+				property_rml += " :";
+				property_rml += *j;
 			}
 
-			property_rml.Append("</h3>");
+			property_rml += "</h3>";
 
 			BuildPropertiesRML(property_rml, (*i).second);
 		}
@@ -518,15 +518,15 @@ void ElementInfo::BuildPropertiesRML(Core::String& property_rml, const NamedProp
 			last_source = properties[i].second->source;
 			last_source_line = properties[i].second->source_line_number;
 
-			property_rml.Append("<h4>");
+			property_rml += "<h4>";
 
-			if (last_source.Empty() &&
+			if (last_source.empty() &&
 				last_source_line == 0)
-				property_rml.Append("<em>inline</em>");
+				property_rml += "<em>inline</em>";
 			else
-				property_rml.Append(Core::String(last_source.Length() + 32, "<em>%s</em>: %d", last_source.CString(), last_source_line));
+				property_rml += Core::CreateString(last_source.size() + 32, "<em>%s</em>: %d", last_source.c_str(), last_source_line);
 
-			property_rml.Append("</h4>");
+			property_rml += "</h4>";
 		}
 
 		BuildPropertyRML(property_rml, properties[i].first, properties[i].second);
@@ -538,25 +538,25 @@ void ElementInfo::BuildPropertyRML(Core::String& property_rml, const Core::Strin
 	Core::String property_value = property->ToString();
 	RemoveTrailingZeroes(property_value);
 
-	property_rml += Core::String(name.Length() + property_value.Length() + 32, "%s: <em>%s;</em><br />", name.CString(), property_value.CString());
+	property_rml += Core::CreateString(name.size() + property_value.size() + 32, "%s: <em>%s;</em><br />", name.c_str(), property_value.c_str());
 }
 
 void ElementInfo::RemoveTrailingZeroes(Core::String& string)
 {
-	if (string.Empty())
+	if (string.empty())
 	{
 		return;
 	}
 
 	// First, check for a decimal point. No point, no chance of trailing zeroes!
-	size_t decimal_point_position = string.Find(".");
+	size_t decimal_point_position = string.find(".");
 	if (decimal_point_position != Core::String::npos)
 	{
 		// Ok, so now we start at the back of the string and find the first
 		// numeral. If the character we find is a zero, then we start counting
 		// back till we find something that isn't a zero or a decimal point -
 		// and then remove all that we've counted.
-		size_t last_zero = string.Length() - 1;
+		size_t last_zero = string.size() - 1;
 		while ((string[last_zero] < '0' || string[last_zero] > '9') && string[last_zero] != '.')
 		{
 			if (last_zero == 0)
@@ -595,13 +595,13 @@ void ElementInfo::RemoveTrailingZeroes(Core::String& string)
 
 		// Now remove everything between first_zero and last_zero, inclusive.
 		if (last_zero > first_zero)
-			string.Erase(first_zero, (last_zero - first_zero) + 1);
+			string.erase(first_zero, (last_zero - first_zero) + 1);
 	}
 }
 
 bool ElementInfo::IsDebuggerElement(Core::Element* element)
 {
-	return element->GetOwnerDocument()->GetId().Find("rkt-debug-") == 0;
+	return element->GetOwnerDocument()->GetId().find("rkt-debug-") == 0;
 }
 
 }

+ 6 - 6
Source/Debugger/ElementLog.cpp

@@ -135,7 +135,7 @@ void ElementLog::AddLogMessage(Core::Log::Type type, const Core::String& message
 	// Add the message to the list of messages for the specified log type.
 	LogMessage log_message;
 	log_message.index = current_index++;
-	log_message.message = Core::String(message).Replace("<", "&lt;").Replace(">", "&gt;");
+	log_message.message = Core::Replace(Core::Replace(Core::String(message), "<", "&lt;"), ">", "&gt;");
 	log_types[type].log_messages.push_back(log_message);
 	if (log_types[type].log_messages.size() >= MAX_LOG_MESSAGES)
 	{
@@ -146,7 +146,7 @@ void ElementLog::AddLogMessage(Core::Log::Type type, const Core::String& message
 	// "Off" to "Off*" to signal that there are unread logs.
 	if (!log_types[type].visible)
 	{
-		if (!log_types[type].button_name.Empty())
+		if (!log_types[type].button_name.empty())
 		{
 			Rocket::Core::Element* button = GetElementById(log_types[type].button_name);
 			if (button)
@@ -199,9 +199,9 @@ void ElementLog::OnRender()
 			int num_messages = 0;
 			while (next_type != -1 && num_messages < MAX_LOG_MESSAGES)
 			{
-				messages.Append(Core::String(128, "<div class=\"log-entry\"><div class=\"icon %s\">%s</div><p class=\"message\">", log_types[next_type].class_name.CString(), log_types[next_type].alert_contents.CString()));
-				messages.Append(log_types[next_type].log_messages[log_pointers[next_type]].message);
-				messages.Append("</p></div>");
+				messages += Core::CreateString(128, "<div class=\"log-entry\"><div class=\"icon %s\">%s</div><p class=\"message\">", log_types[next_type].class_name.c_str(), log_types[next_type].alert_contents.c_str());
+				messages += log_types[next_type].log_messages[log_pointers[next_type]].message;
+				messages += "</p></div>";
 				
 				log_pointers[next_type]++;
 				next_type = FindNextEarliestLogType(log_pointers);
@@ -249,7 +249,7 @@ void ElementLog::ProcessEvent(Core::Event& event)
 			{
 				for (int i = 0; i < Core::Log::LT_MAX; i++)
 				{
-					if (!log_types[i].button_name.Empty() && event.GetTargetElement()->GetId() == log_types[i].button_name)
+					if (!log_types[i].button_name.empty() && event.GetTargetElement()->GetId() == log_types[i].button_name)
 					{
 						log_types[i].visible = !log_types[i].visible;
 						if (log_types[i].visible)

+ 2 - 2
Source/Debugger/Plugin.cpp

@@ -164,7 +164,7 @@ void Plugin::Render()
 		for (int i = 0; i < debug_context->GetNumDocuments(); ++i)
 		{
 			Core::ElementDocument* document = debug_context->GetDocument(i);
-			if (document->GetId().Find("rkt-debug-") == 0)
+			if (document->GetId().find("rkt-debug-") == 0)
 				continue;
 
 			std::stack< Core::Element* > element_stack;
@@ -211,7 +211,7 @@ void Plugin::OnShutdown()
 
 		int count = 0;
 		for (ElementInstanceMap::iterator i = elements.begin(); i != elements.end(); ++i)
-			Core::Log::Message(Core::Log::LT_WARNING, "\t(%d) %s -> %s", count++, (*i)->GetTagName().CString(), (*i)->GetAddress().CString());
+			Core::Log::Message(Core::Log::LT_WARNING, "\t(%d) %s -> %s", count++, (*i)->GetTagName().c_str(), (*i)->GetAddress().c_str());
 	}
 
 	delete this;