23 #include "xml/dom_stringimpl.h"
25 #include <wtf/Vector.h>
36 impl =
new DOMStringImpl( str, len );
47 impl =
new DOMStringImpl( str.unicode(), str.length() );
58 impl =
new DOMStringImpl( str );
68 impl =
new DOMStringImpl(str, len);
111 DOMStringImpl *i =
impl->copy();
147 static const QChar nullChar = 0;
149 if(!
impl || i >=
impl->l )
return nullChar;
156 unsigned int l = start;
157 if(!
impl || l >=
impl->l )
return -1;
160 if( *(
impl->s+l) == c )
return l;
168 unsigned int l = start;
169 if (!
impl || l < -impl->l)
return -1;
172 if (*(
impl->s + l) == c)
return l;
204 return impl->split(pos);
210 return impl->lower();
216 return impl->upper();
223 if ( *(
impl->s+
impl->l-1) != QChar(
'%'))
226 _percentage = QString::fromRawData(
impl->s,
impl->l-1).toInt();
233 return impl->unicode();
240 return impl->string();
247 return impl->toInt();
257 return impl->toInt(ok);
267 return impl->toFloat(ok);
304 if ( !bs )
return ( l != 0 );
306 if ( a->toLatin1() != *bs ) {
307 char cc = ( ( *bs >=
'A' ) && ( *bs <=
'Z' ) ) ? ( ( *bs ) +
'a' -
'A' ) : ( *bs );
308 if ( a->toLower().toLatin1() != cc )
return true;
312 return ( *bs !=
'\0' );
323 va_start(args, format);
325 Vector<char, 256> buffer;
329 int result = _vscprintf(format, args);
332 int result = vsnprintf(&ch, 1, format, args);
340 va_start(args, format);
351 unsigned len = result;
352 buffer.grow(len + 1);
355 vsnprintf(buffer.data(), buffer.size(),
format, args);
360 return new DOMStringImpl(buffer.data());
374 if( l != b.length() )
return false;
376 if(!memcmp(a.
unicode(), b.unicode(), l*
sizeof(QChar)))
383 DOMStringImpl* aimpl = a.
impl;
384 if ( !b )
return !aimpl;
388 const QChar *aptr = aimpl->s;
390 unsigned char c = *b++;
391 if ( !c || ( *aptr++ ).unicode() != c )
DOMString lower() const
Returns a lowercase version of the string.
DOMString split(unsigned int pos)
Splits the string into two.
int reverseFind(const QChar c, int start=-1) const
static DOMString format(const char *format,...)
bool strcasecmp(const DOMString &a, const DOMString &b)
DOMString operator+(const DOMString &str)
add two DOMString's
void remove(unsigned int pos, int len=1)
DOMString & operator=(const DOMString &str)
float toFloat(bool *ok=0) const
bool strcmp(const DOMString &a, const DOMString &b)
bool percentage(int &_percentage) const
This class implements the basic string we use in the DOM.
bool operator==(const DOMString &a, const DOMString &b)
DOMString()
default constructor.
DOMString & operator+=(const DOMString &str)
append str to this string
bool startsWith(const DOMString &str) const
int find(const QChar c, int start=0) const
void truncate(unsigned int len)
bool endsWith(const DOMString &str) const
void insert(DOMString str, uint pos)
DOMString substring(unsigned pos, unsigned len=UINT_MAX) const
DOMStringImpl * implementation() const
static DOMString number(float f)
const QChar & operator[](unsigned int i) const
The character at position i of the DOMString.
DOMString upper() const
Returns an uppercase version of the string.