77 #ifndef TIXML_STRING_INCLUDED 78 #define TIXML_STRING_INCLUDED 87 #if defined(_MSC_VER) && (_MSC_VER >= 1200 ) 89 #define TIXML_EXPLICIT explicit 90 #elif defined(__GNUC__) && (__GNUC__ >= 3 ) 92 #define TIXML_EXPLICIT explicit 94 #define TIXML_EXPLICIT 97 namespace RTT {
namespace marsh {
131 init( static_cast<size_type>( strlen(copy) ));
132 memcpy(start(), copy,
length());
139 memcpy(start(), str, len);
151 return assign( copy, (size_type)strlen(copy));
164 return append(suffix, static_cast<size_type>( strlen(suffix) ));
170 return append(&single, 1);
181 const char *
c_str ()
const {
return rep_->str; }
184 const char *
data ()
const {
return rep_->str; }
187 size_type
length ()
const {
return rep_->size; }
190 size_type
size ()
const {
return rep_->size; }
193 bool empty ()
const {
return rep_->size == 0; }
196 size_type
capacity ()
const {
return rep_->capacity; }
200 const char&
at (size_type index)
const 202 assert( index <
length() );
203 return rep_->str[ index ];
209 assert( index <
length() );
210 return rep_->str[ index ];
214 size_type
find (
char lookup)
const 216 return find(lookup, 0);
220 size_type
find (
char tofind, size_type offset)
const 224 for (
const char* p =
c_str() + offset; *p !=
'\0'; ++p)
226 if (*p == tofind)
return static_cast< size_type
>( p -
c_str() );
259 void init(size_type sz) { init(sz, sz); }
260 void set_size(size_type sz) { rep_->str[ rep_->size = sz ] =
'\0'; }
261 char* start()
const {
return rep_->str; }
262 char* finish()
const {
return rep_->str + rep_->size; }
270 void init(size_type sz, size_type cap)
279 const size_type bytesNeeded =
sizeof(Rep) + cap;
280 const size_type intsNeeded = ( bytesNeeded +
sizeof(int) - 1 ) /
sizeof( int );
281 rep_ =
reinterpret_cast<Rep*
>(
new int[ intsNeeded ] );
283 rep_->str[ rep_->size = sz ] =
'\0';
284 rep_->capacity = cap;
294 if (rep_ != &nullrep_)
298 delete [] (
reinterpret_cast<int*
>( rep_ ) );
359 #endif // TIXML_STRING_INCLUDED 360 #endif // TIXML_USE_STL void swap(TiXmlString &other)
const char * data() const
size_type capacity() const
TIXML_EXPLICIT TiXmlString(const char *copy)
TiXmlString & operator=(const char *copy)
bool operator<(const TiXmlString &a, const TiXmlString &b)
TiXmlString operator+(const TiXmlString &a, const TiXmlString &b)
bool operator>=(const TiXmlString &a, const TiXmlString &b)
TiXmlString & append(const char *str, size_type len)
TiXmlString & operator+=(const char *suffix)
char & operator[](size_type index) const
TIXML_EXPLICIT TiXmlString(const char *str, size_type len)
bool operator<=(const TiXmlString &a, const TiXmlString &b)
void reserve(size_type cap)
const char * c_str() const
TIXML_OSTREAM & operator<<(TIXML_OSTREAM &out, const TiXmlNode &base)
TiXmlString(const TiXmlString ©)
bool operator>(const TiXmlString &a, const TiXmlString &b)
const char & at(size_type index) const
static const size_type npos
size_type find(char tofind, size_type offset) const
bool operator==(const TiXmlString &a, const TiXmlString &b)
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
TiXmlString & assign(const char *str, size_type len)
size_type find(char lookup) const
bool operator!=(const TiXmlString &a, const TiXmlString &b)