Go to the documentation of this file.
27 #ifndef TIXML_STRING_INCLUDED
28 #define TIXML_STRING_INCLUDED
37 #if defined(_MSC_VER) && (_MSC_VER >= 1200 )
39 #define TIXML_EXPLICIT explicit
40 #elif defined(__GNUC__) && (__GNUC__ >= 3 )
42 #define TIXML_EXPLICIT explicit
44 #define TIXML_EXPLICIT
80 init(
static_cast<size_type>( strlen(copy) ));
81 memcpy(start(), copy,
length());
88 memcpy(start(), str, len);
117 return append(&single, 1);
128 const char *
c_str ()
const {
return rep_->str; }
131 const char *
data ()
const {
return rep_->str; }
140 bool empty ()
const {
return rep_->size == 0; }
149 assert( index <
length() );
150 return rep_->str[ index ];
156 assert( index <
length() );
157 return rep_->str[ index ];
163 return find(lookup, 0);
171 for (
const char* p =
c_str() + offset; *p !=
'\0'; ++p)
206 void init(
size_type sz) { init(sz, sz); }
207 void set_size(
size_type sz) { rep_->str[ rep_->size = sz ] =
'\0'; }
208 char* start()
const {
return rep_->str; }
209 char* finish()
const {
return rep_->str + rep_->size; }
226 const size_type bytesNeeded =
sizeof(Rep) + cap;
227 const size_type intsNeeded = ( bytesNeeded +
sizeof(int) - 1 ) /
sizeof( int );
228 rep_ =
reinterpret_cast<Rep*
>(
new int[ intsNeeded ] );
230 rep_->str[ rep_->size = sz ] =
'\0';
231 rep_->capacity = cap;
241 if (rep_ != &nullrep_)
245 delete [] (
reinterpret_cast<int*
>( rep_ ) );
304 #endif // TIXML_STRING_INCLUDED
305 #endif // TIXML_USE_STL
TiXmlString & append(const char *str, size_type len)
TIXML_EXPLICIT TiXmlString(const char *str, size_type len)
TiXmlString(const TiXmlString ©)
bool operator<(const TiXmlString &a, const TiXmlString &b)
bool operator>(const TiXmlString &a, const TiXmlString &b)
size_type capacity() const
char & operator[](size_type index) const
size_type find(char lookup) const
const char * c_str() const
TIXML_EXPLICIT TiXmlString(const char *copy)
TiXmlString & assign(const char *str, size_type len)
void reserve(size_type cap)
static const size_type npos
TiXmlOutStream & operator<<(const TiXmlString &in)
bool operator==(const TiXmlString &a, const TiXmlString &b)
bool operator>=(const TiXmlString &a, const TiXmlString &b)
TiXmlString & operator+=(const char *suffix)
void swap(TiXmlString &other)
const char * data() const
TiXmlString & operator=(const char *copy)
const char & at(size_type index) const
size_type find(char tofind, size_type offset) const
bool operator!=(const TiXmlString &a, const TiXmlString &b)
bool operator<=(const TiXmlString &a, const TiXmlString &b)
TiXmlString operator+(const TiXmlString &a, const TiXmlString &b)