String: Add a new constructor
This commit is contained in:
parent
5e07b23cfb
commit
787ab5dbd0
|
@ -161,6 +161,11 @@ String::String(const char* Text) : m_pStringData(const_cast<String::StringData*>
|
||||||
Assign(Text);
|
Assign(Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String::String(const char* Text, u32 Count) : m_pStringData(const_cast<String::StringData*>(&s_EmptyStringData))
|
||||||
|
{
|
||||||
|
AppendString(Text, Count);
|
||||||
|
}
|
||||||
|
|
||||||
String::String(String&& moveString)
|
String::String(String&& moveString)
|
||||||
{
|
{
|
||||||
Assign(moveString);
|
Assign(moveString);
|
||||||
|
|
|
@ -46,6 +46,9 @@ public:
|
||||||
// For strings that do not allocate any space on the heap, see StaticString.
|
// For strings that do not allocate any space on the heap, see StaticString.
|
||||||
String(const char* Text);
|
String(const char* Text);
|
||||||
|
|
||||||
|
// Creates a string contained the specified text (with length).
|
||||||
|
String(const char* Text, u32 Count);
|
||||||
|
|
||||||
// Creates a string using the same buffer as another string (copy-on-write).
|
// Creates a string using the same buffer as another string (copy-on-write).
|
||||||
String(const String& copyString);
|
String(const String& copyString);
|
||||||
|
|
||||||
|
@ -315,6 +318,12 @@ public:
|
||||||
Assign(Text);
|
Assign(Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StackString(const char* Text, u32 Count) : String(&m_sStringData)
|
||||||
|
{
|
||||||
|
InitStackStringData();
|
||||||
|
AppendString(Text, Count);
|
||||||
|
}
|
||||||
|
|
||||||
StackString(const String& copyString) : String(&m_sStringData)
|
StackString(const String& copyString) : String(&m_sStringData)
|
||||||
{
|
{
|
||||||
// force a copy by passing it a string pointer, instead of a string object
|
// force a copy by passing it a string pointer, instead of a string object
|
||||||
|
|
Loading…
Reference in New Issue