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);
|
||||
}
|
||||
|
||||
String::String(const char* Text, u32 Count) : m_pStringData(const_cast<String::StringData*>(&s_EmptyStringData))
|
||||
{
|
||||
AppendString(Text, Count);
|
||||
}
|
||||
|
||||
String::String(String&& moveString)
|
||||
{
|
||||
Assign(moveString);
|
||||
|
|
|
@ -46,6 +46,9 @@ public:
|
|||
// For strings that do not allocate any space on the heap, see StaticString.
|
||||
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).
|
||||
String(const String& copyString);
|
||||
|
||||
|
@ -315,6 +318,12 @@ public:
|
|||
Assign(Text);
|
||||
}
|
||||
|
||||
StackString(const char* Text, u32 Count) : String(&m_sStringData)
|
||||
{
|
||||
InitStackStringData();
|
||||
AppendString(Text, Count);
|
||||
}
|
||||
|
||||
StackString(const String& copyString) : String(&m_sStringData)
|
||||
{
|
||||
// force a copy by passing it a string pointer, instead of a string object
|
||||
|
|
Loading…
Reference in New Issue