Daniele Bartolini 10 роки тому
батько
коміт
52637a3dc7
2 змінених файлів з 14 додано та 15 видалено
  1. 7 10
      src/core/strings/dynamic_string.h
  2. 7 5
      src/core/strings/string_stream.h

+ 7 - 10
src/core/strings/dynamic_string.h

@@ -15,10 +15,14 @@
 
 namespace crown
 {
+/// Dynamic array of charachers.
 ///
-class DynamicString
+/// @ingroup Containers
+struct DynamicString
 {
-public:
+	ALLOCATOR_AWARE;
+
+	Array<char> _data;
 
 	DynamicString(Allocator& a);
 	DynamicString(const char* s, Allocator& a = default_allocator());
@@ -28,7 +32,6 @@ public:
 	DynamicString& operator+=(const char c);
 	DynamicString& operator+=(const FixedString& s);
 
-	///
 	DynamicString& operator=(const DynamicString& s);
 	DynamicString& operator=(const char* s);
 	DynamicString& operator=(const char c);
@@ -63,14 +66,8 @@ public:
 	/// Returns the StringId32 of the string.
 	StringId32 to_string_id() const;
 
-	///
+	/// Returns the string as a NULL-terminated string.
 	const char* c_str() const;
-
-	ALLOCATOR_AWARE;
-
-private:
-
-	Array<char> _data;
 };
 
 inline DynamicString::DynamicString(Allocator& a)

+ 7 - 5
src/core/strings/string_stream.h

@@ -15,11 +15,13 @@ namespace crown
 /// @ingroup Containers
 typedef Array<char> StringStream;
 
-/// Functions to operate on StringStream.
+/// Functions to manipulate StringStream.
+///
+/// @ingroup Containers
 namespace string_stream
 {
 	/// Appends @a val to the stream @a s using appropriate formatting.
-	StringStream& operator<<(StringStream& s, char ch);
+	StringStream& operator<<(StringStream& s, char val);
 	StringStream& operator<<(StringStream& s, s16 val);
 	StringStream& operator<<(StringStream& s, u16 val);
 	StringStream& operator<<(StringStream& s, s32 val);
@@ -32,7 +34,7 @@ namespace string_stream
 	/// Appends the string @a string to the stream @a s.
 	StringStream& operator<<(StringStream& s, const char* string);
 
-	/// Returns the stream as a NULL-terminated string.
+	/// Returns the stream as a NUL-terminated string.
 	const char* c_str(StringStream& s);
 
 	template <typename T> StringStream& stream_printf(StringStream& s, const char* format, T& val);
@@ -41,9 +43,9 @@ namespace string_stream
 
 namespace string_stream
 {
-	inline StringStream& operator<<(StringStream& s, char ch)
+	inline StringStream& operator<<(StringStream& s, char val)
 	{
-		array::push_back(s, ch);
+		array::push_back(s, val);
 		return s;
 	}