From 4ecfa360574ae7d7b0c58af7426ac59491b028d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Wed, 4 Dec 2019 22:10:47 -0800 Subject: [PATCH] String: Added STL compatible append. Added getCPtr(). --- include/bx/inline/string.inl | 12 ++++++++++++ include/bx/string.h | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/include/bx/inline/string.inl b/include/bx/inline/string.inl index 61c4933..ebd6144 100644 --- a/include/bx/inline/string.inl +++ b/include/bx/inline/string.inl @@ -225,6 +225,12 @@ namespace bx } } + template + inline void StringT::append(const char* _ptr, const char* _term) + { + append(StringView(_ptr, _term) ); + } + template inline void StringT::clear() { @@ -236,6 +242,12 @@ namespace bx } } + template + inline const char* StringT::getCPtr() const + { + return getPtr(); + } + inline StringView strSubstr(const StringView& _str, int32_t _start, int32_t _len) { return StringView(_str, _start, _len); diff --git a/include/bx/string.h b/include/bx/string.h index 43798a4..f35faac 100644 --- a/include/bx/string.h +++ b/include/bx/string.h @@ -128,8 +128,15 @@ namespace bx /// void append(const StringView& _str); + /// + void append(const char* _ptr, const char* _term); + /// void clear(); + + /// Returns zero-terminated C string pointer. + /// + const char* getCPtr() const; }; /// Retruns true if character is part of space set.