diff options
Diffstat (limited to 'deps/icu-small/source/common/charstr.h')
-rw-r--r-- | deps/icu-small/source/common/charstr.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/deps/icu-small/source/common/charstr.h b/deps/icu-small/source/common/charstr.h index 1a97e01988..23b950ed6e 100644 --- a/deps/icu-small/source/common/charstr.h +++ b/deps/icu-small/source/common/charstr.h @@ -82,10 +82,24 @@ public: const char *data() const { return buffer.getAlias(); } char *data() { return buffer.getAlias(); } + /** + * Allocates length()+1 chars and copies the NUL-terminated data(). + * The caller must uprv_free() the result. + */ + char *cloneData(UErrorCode &errorCode) const; + + bool operator==(StringPiece other) const { + return len == other.length() && (len == 0 || uprv_memcmp(data(), other.data(), len) == 0); + } + bool operator!=(StringPiece other) const { + return !operator==(other); + } /** @return last index of c, or -1 if c is not in this string */ int32_t lastIndexOf(char c) const; + bool contains(StringPiece s) const; + CharString &clear() { len=0; buffer[0]=0; return *this; } CharString &truncate(int32_t newLength); |