summaryrefslogtreecommitdiff
path: root/source/core/slang-string.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/core/slang-string.h')
-rw-r--r--source/core/slang-string.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/core/slang-string.h b/source/core/slang-string.h
index 85f7b894f..cb13ec415 100644
--- a/source/core/slang-string.h
+++ b/source/core/slang-string.h
@@ -210,6 +210,9 @@ namespace Slang
return (const char*)(this + 1);
}
+ /// Set the contents to be the slice. Must be enough capacity to hold the slice.
+ void setContents(const UnownedStringSlice& slice);
+
static const char* getData(const StringRepresentation* stringRep)
{
return stringRep ? stringRep->getData() : "";
@@ -246,6 +249,11 @@ namespace Slang
return createWithCapacityAndLength(length, length);
}
+ /// Create a representation from the slice. If slice is empty will return nullptr.
+ static StringRepresentation* create(const UnownedStringSlice& slice);
+ /// Same as create, but representation will have refcount of 1 (if not nullptr)
+ static StringRepresentation* createWithReference(const UnownedStringSlice& slice);
+
StringRepresentation* cloneWithCapacity(Index newCapacity)
{
StringRepresentation* newObj = createWithCapacityAndLength(newCapacity, length);