Przeglądaj źródła

base: implement String::Resize().

legacy
Sam Hocevar sam 13 lat temu
rodzic
commit
8dd6d33a6d
1 zmienionych plików z 7 dodań i 1 usunięć
  1. +7
    -1
      src/lol/base/string.h

+ 7
- 1
src/lol/base/string.h Wyświetl plik

@@ -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;


Ładowanie…
Anuluj
Zapisz