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();
238 if(!
impl)
return QString();
240 return impl->string();
247 return impl->toInt();
296 return ((c < 0x0021) &&
297 (c == 0x0020 || c == 0x0009 || c == 0x000A || c == 0x000C || c == 0x000D));
307 const QChar *s =
impl->s;
308 unsigned int start = 0;
309 unsigned int end =
impl->l - 1;
323 const unsigned int len =
end - start + 1;
324 DOMStringImpl *out =
new DOMStringImpl(s + start, len);
327 unsigned int newLen = 0;
328 for (
unsigned int k = 0; k < len; ++k) {
329 QChar ch = out->s[k];
330 if (ch.unicode() >
'\r') {
331 out->s[newLen++] = ch;
339#ifndef KDE_NO_DEPRECATED
357 if ( !bs )
return ( l != 0 );
359 if ( a->toLatin1() != *bs ) {
360 char cc = ( ( *bs >=
'A' ) && ( *bs <=
'Z' ) ) ? ( ( *bs ) +
'a' -
'A' ) : ( *bs );
361 if ( a->toLower().toLatin1() != cc )
return true;
365 return ( *bs !=
'\0' );
378 Vector<char, 256> buffer;
382 int result = _vscprintf(
format, args);
385 int result = vsnprintf(&ch, 1,
format, args);
404 unsigned len = result;
405 buffer.grow(len + 1);
408 vsnprintf(buffer.data(), buffer.size(),
format, args);
413 return new DOMStringImpl(buffer.data());
427 if( l != b.length() )
return false;
429 if(!memcmp(a.
unicode(), b.unicode(), l*
sizeof(QChar)))
436 DOMStringImpl* aimpl = a.
impl;
437 if ( !b )
return !aimpl;
441 const QChar *aptr = aimpl->s;
443 unsigned char c = *b++;
444 if ( !c || ( *aptr++ ).unicode() != c )
This class implements the basic string we use in the DOM.
DOMString()
default constructor.
DOMString trimSpaces() const
DOMString & operator+=(const DOMString &str)
append str to this string
DOMString upper() const
Returns an uppercase version of the string.
DOMString parsedUrl() const
Return a parsed url.
float toFloat(bool *ok=0) const
bool endsWith(const DOMString &str) const
bool startsWith(const DOMString &str) const
void truncate(unsigned int len)
bool percentage(int &_percentage) const
static DOMString number(float f)
int find(const QChar c, int start=0) const
DOMString substring(unsigned pos, unsigned len=UINT_MAX) const
DOMString & operator=(const DOMString &str)
DOMString split(unsigned int pos)
Splits the string into two.
static DOMString format(const char *format,...)
DOMString lower() const
Returns a lowercase version of the string.
void remove(unsigned int pos, int len=1)
DOMStringImpl * implementation() const
DOMString operator+(const DOMString &str)
add two DOMString's
const QChar & operator[](unsigned int i) const
The character at position i of the DOMString.
void insert(DOMString str, uint pos)
int reverseFind(const QChar c, int start=-1) const
static bool isSpaceCharacter(const ushort &c)
This library provides a full-featured HTML parser and widget.
bool operator==(const DOMString &a, const DOMString &b)
bool strcasecmp(const DOMString &a, const DOMString &b)
bool strcmp(const DOMString &a, const DOMString &b)