DOM::DOMString

#include <dom_string.h>

Public Member Functions

 DOMString ()
 
 DOMString (const QChar *str, uint len)
 
 DOMString (const QString &)
 
 DOMString (const char *str)
 
 DOMString (const char *str, uint len)
 
 DOMString (DOMStringImpl *i)
 
 DOMString (const DOMString &str)
 
QCharcharacters () const
 
DOMString copy () const
 
bool endsWith (const DOMString &str) const
 
int find (const QChar c, int start=0) const
 
DOMStringImpl * implementation () const
 
void insert (DOMString str, uint pos)
 
bool isEmpty () const
 
bool isNull () const
 
uint length () const
 
DOMString lower () const
 
DOMString operator+ (const DOMString &str)
 
DOMStringoperator+= (const DOMString &str)
 
DOMStringoperator= (const DOMString &str)
 
const QCharoperator[] (unsigned int i) const
 
bool percentage (int &_percentage) const
 
void remove (unsigned int pos, int len=1)
 
int reverseFind (const QChar c, int start=-1) const
 
DOMString split (unsigned int pos)
 
bool startsWith (const DOMString &str) const
 
QString string () const
 
DOMString substring (unsigned pos, unsigned len=UINT_MAX) const
 
float toFloat (bool *ok=nullptr) const
 
int toInt () const
 
int toInt (bool *ok) const
 
DOMString trimSpaces () const
 
void truncate (unsigned int len)
 
QCharunicode () const
 
DOMString upper () const
 

Static Public Member Functions

static DOMString format (const char *format,...)
 
static DOMString number (float f)
 

Protected Attributes

DOMStringImpl * impl
 

Friends

KHTML_EXPORT bool operator== (const DOMString &a, const char *b)
 

Detailed Description

This class implements the basic string we use in the DOM.

We do not use QString for 2 reasons: Memory overhead, and the missing explicit sharing of strings we need for the DOM.

All DOMStrings are explicitly shared (they behave like pointers), meaning that modifications to one instance will also modify all others. If you wish to get a DOMString that is independent, use copy().

Definition at line 44 of file dom_string.h.

Constructor & Destructor Documentation

DOM::DOMString::DOMString ( )
inline

default constructor.

Gives an empty DOMString

Definition at line 52 of file dom_string.h.

DOMString::DOMString ( const char *  str,
uint  len 
)
Since
4.2

Definition at line 61 of file dom_string.cpp.

Member Function Documentation

DOMStringImpl* DOM::DOMString::implementation ( ) const
inline

get a handle to the imlementation of the DOMString Use at own risk!!!

Definition at line 145 of file dom_string.h.

DOMString DOMString::lower ( ) const

Returns a lowercase version of the string.

Definition at line 232 of file dom_string.cpp.

DOMString DOMString::operator+ ( const DOMString str)

add two DOMString's

Definition at line 128 of file dom_string.cpp.

DOMString & DOMString::operator+= ( const DOMString str)

append str to this string

Definition at line 108 of file dom_string.cpp.

const QChar & DOMString::operator[] ( unsigned int  i) const

The character at position i of the DOMString.

If i >= length(), the character returned will be 0.

Definition at line 152 of file dom_string.cpp.

DOMString DOMString::split ( unsigned int  pos)

Splits the string into two.

The original string gets truncated to pos, and the rest is returned.

Definition at line 224 of file dom_string.cpp.

DOMString DOMString::trimSpaces ( ) const

Returns a string with Space Characters removed from the start and the end.

Space Characters as defined in https://dev.w3.org/html5/spec-LC/common-microsyntaxes.html#space-character

Definition at line 345 of file dom_string.cpp.

DOMString DOMString::upper ( ) const

Returns an uppercase version of the string.

Definition at line 240 of file dom_string.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Nov 30 2020 22:46:50 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.