diff options
Diffstat (limited to 'src/misc/str.hpp')
-rw-r--r-- | src/misc/str.hpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/misc/str.hpp b/src/misc/str.hpp index 9a4663a6e..9204dbfb7 100644 --- a/src/misc/str.hpp +++ b/src/misc/str.hpp @@ -27,6 +27,12 @@ struct CStrA : public CBlobT<char> { } + /** Copy constructor */ + FORCEINLINE CStrA(const CStrA &src) : base(src) + { + base::FixTail(); + } + /** Take over ownership constructor */ FORCEINLINE CStrA(const OnTransfer& ot) : base(ot) @@ -50,14 +56,34 @@ struct CStrA : public CBlobT<char> } } + /** Append another CStrA. */ + FORCEINLINE void Append(const CStrA &src) + { + if (src.RawSize() > 0) { + base::AppendRaw(src); + base::FixTail(); + } + } + /** Assignment from C string. */ - FORCEINLINE CStrA& operator = (const char *src) + FORCEINLINE CStrA &operator = (const char *src) { base::Clear(); AppendStr(src); return *this; } + /** Assignment from another CStrA. */ + FORCEINLINE CStrA &operator = (const CStrA &src) + { + if (&src != this) { + base::Clear(); + base::AppendRaw(src); + base::FixTail(); + } + return *this; + } + /** Lower-than operator (to support stl collections) */ FORCEINLINE bool operator < (const CStrA &other) const { |