瀏覽代碼

base: implement String::Resize().

legacy
Sam Hocevar sam 13 年之前
父節點
當前提交
8dd6d33a6d
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. +7
    -1
      src/lol/base/string.h

+ 7
- 1
src/lol/base/string.h 查看文件

@@ -64,6 +64,12 @@ public:
return ((Super const &)*this).Count() - 1; return ((Super const &)*this).Count() - 1;
} }


void Resize(int count)
{
((Super &)*this).Resize(count + 1);
((Super &)*this).Last() = '\0';
}

inline String operator +(String const &s) const inline String operator +(String const &s) const
{ {
String ret(*this); String ret(*this);
@@ -72,7 +78,7 @@ public:


inline String& operator +=(String const &s) inline String& operator +=(String const &s)
{ {
/* Be careful, we have a trailing zero we don't want! */
/* Ignore the trailing zero we don't want */
--m_count; --m_count;
(Super &)*this += (Super const &)s; (Super &)*this += (Super const &)s;
return *this; return *this;


Loading…
取消
儲存