00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
#ifndef _DOM_DOMString_h_
00023
#define _DOM_DOMString_h_
00024
00025
#include <kdebug.h>
00026
#include <qstring.h>
00027
00028
#include <kdelibs_export.h>
00029
00030
namespace DOM {
00031
00032
class DOMStringImpl;
00033
00043 class KHTML_EXPORT DOMString
00044 {
00045
friend class CharacterDataImpl;
00046
friend bool operator==(
const DOMString &a,
const char *b );
00047
public:
00051 DOMString() : impl(0) {}
00052
00053 DOMString(
const QChar *str, uint len);
00054 DOMString(
const QString &);
00055 DOMString(
const char *str);
00056 DOMString(DOMStringImpl *i);
00057
00058
virtual ~DOMString();
00059
00060
00061 DOMString(
const DOMString &str);
00062 DOMString &operator =(
const DOMString &str);
00063
00067 DOMString &operator += (
const DOMString &str);
00071 DOMString operator + (
const DOMString &str);
00072
00073
void insert(DOMString str, uint pos);
00074
00079
const QChar &operator [](
unsigned int i)
const;
00080
00081
int find(
const QChar c,
int start = 0)
const;
00082
00083 uint length() const;
00084
void truncate(
unsigned int len );
00085
void remove(
unsigned int pos,
int len=1);
00089 DOMString split(
unsigned int pos);
00090
00094 DOMString lower() const;
00098 DOMString upper() const;
00099
00100
QChar *unicode() const;
00101
QString string() const;
00102
00103
int toInt() const;
00104
bool percentage(
int &_percentage) const;
00105
00106 DOMString copy() const;
00107
00108
bool isNull()
const {
return (impl == 0); }
00109
bool isEmpty() const;
00110
00115 DOMStringImpl *implementation()
const {
return impl; }
00116
00117
protected:
00118 DOMStringImpl *impl;
00119 };
00120
00121
#ifndef NDEBUG
00122
inline kdbgstream &
operator<<(
kdbgstream &stream,
const DOMString &string) {
00123
return (stream << string.
string());
00124 }
00125
#else
00126
inline kndbgstream &
operator<<(
kndbgstream &stream,
const DOMString &) {
00127
return stream;
00128 }
00129
#endif
00130
00131 KHTML_EXPORT
bool operator==(
const DOMString &a,
const DOMString &b );
00132 KHTML_EXPORT
bool operator==(
const DOMString &a,
const QString &b );
00133 KHTML_EXPORT
bool operator==(
const DOMString &a,
const char *b );
00134
inline bool operator!=(
const DOMString &a,
const DOMString &b ) {
return !(a==b); }
00135
inline bool operator!=(
const DOMString &a,
const QString &b ) {
return !(a==b); }
00136
inline bool operator!=(
const DOMString &a,
const char *b ) {
return !(a==b); }
00137
inline bool strcmp(
const DOMString &a,
const DOMString &b ) {
return a != b; }
00138
00139
00140 KHTML_EXPORT
bool strcasecmp(
const DOMString &a,
const DOMString &b );
00141 KHTML_EXPORT
bool strcasecmp(
const DOMString& a,
const char* b );
00142
00143 }
00144
#endif