diff options
author | frosch <frosch@openttd.org> | 2010-02-14 18:33:57 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2010-02-14 18:33:57 +0000 |
commit | 30b215a82b8a7272d28898df83b70e254cd04c6d (patch) | |
tree | 1299697ec19e1b013d301cf9a252b623bcba3cb7 /src/misc/str.hpp | |
parent | d0122644afc79b163c3727fa3d382fd6c7cdc774 (diff) | |
download | openttd-30b215a82b8a7272d28898df83b70e254cd04c6d.tar.xz |
(svn r19134) -Fix (r16983, r17219): YAPF debug output was quite broken.
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 { |