39 #ifndef TIXML_STRING_INCLUDED
40 #define TIXML_STRING_INCLUDED
49 #if defined(_MSC_VER) && (_MSC_VER >= 1200 )
51 #define TIXML_EXPLICIT explicit
52 #elif defined(__GNUC__) && (__GNUC__ >= 3 )
54 #define TIXML_EXPLICIT explicit
56 #define TIXML_EXPLICIT
91 init( static_cast<size_type>( strlen(copy) ));
111 return assign( copy, (
size_type)strlen(copy));
117 return assign(copy.start(), copy.
length());
124 return append(suffix, static_cast<size_type>( strlen(suffix) ));
130 return append(&single, 1);
136 return append(suffix.
data(), suffix.
length());
141 const char *
c_str ()
const {
return rep_->str; }
144 const char *
data ()
const {
return rep_->str; }
153 bool empty ()
const {
return rep_->size == 0; }
163 return rep_->str[
index ];
170 return rep_->str[
index ];
176 return find(lookup, 0);
182 if (offset >=
length())
return npos;
184 for (
const char*
p = c_str() + offset; *
p !=
'\0'; ++
p)
186 if (*
p == tofind)
return static_cast< size_type >(
p - c_str() );
204 void reserve (size_type
cap);
219 void init(size_type sz) {
init(sz, sz); }
220 void set_size(size_type sz) { rep_->str[ rep_->size = sz ] =
'\0'; }
221 char*
start()
const {
return rep_->str; }
222 char* finish()
const {
return rep_->str + rep_->size; }
226 size_type
size, capacity;
230 void init(size_type sz, size_type
cap)
239 const size_type bytesNeeded =
sizeof(Rep) + cap;
240 const size_type intsNeeded = ( bytesNeeded +
sizeof(
int) - 1 ) /
sizeof(
int );
241 rep_ =
reinterpret_cast<Rep*
>(
new int[ intsNeeded ] );
243 rep_->str[ rep_->size = sz ] =
'\0';
244 rep_->capacity =
cap;
254 if (rep_ != &nullrep_)
258 delete [] (
reinterpret_cast<int*
>( rep_ ) );
317 #endif // TIXML_STRING_INCLUDED
318 #endif // TIXML_USE_STL
size_type find(char lookup) const
const char & at(size_type index) const
bool operator>(const TiXmlString &a, const TiXmlString &b)
TIXML_EXPLICIT TiXmlString(const char *copy)
bool operator<(const TiXmlString &a, const TiXmlString &b)
bool operator==(const SourceLocation &lhs, const SourceLocation &rhs)
void swap(TiXmlString &other)
static void init(struct bs2b *bs2b)
TiXmlString operator+(const TiXmlString &a, const TiXmlString &b)
GLboolean GLboolean GLboolean GLboolean a
const char * c_str() const
size_type find(char tofind, size_type offset) const
size_type capacity() const
TiXmlString(const TiXmlString ©)
bool operator!=(const SourceLocation &lhs, const SourceLocation &rhs)
std::ostream & operator<<(std::ostream &out, const Token &token)
static const size_type npos
bool operator>=(const TiXmlString &a, const TiXmlString &b)
const char * data() const
GLdouble GLdouble GLdouble r
GLdouble GLdouble GLdouble b
bool operator<=(const TiXmlString &a, const TiXmlString &b)
TIXML_EXPLICIT TiXmlString(const char *str, size_type len)