dom_string.h
/*
* This file is part of the DOM implementation for KDE.
*
* (C) 1999 Lars Knoll (knoll@kde.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef _DOM_DOMString_h_
#define _DOM_DOMString_h_
#include <kdebug.h>
#include <qstring.h>
#include <kdelibs_export.h>
namespace DOM {
class DOMStringImpl;
class KHTML_EXPORT DOMString
{
friend class CharacterDataImpl;
friend KHTML_EXPORT bool operator==( const DOMString &a, const char *b );
public:
DOMString() : impl(0) {}
DOMString(const QChar *str, uint len);
DOMString(const QString &);
DOMString(const char *str);
DOMString(DOMStringImpl *i);
virtual ~DOMString();
// assign and copy
DOMString(const DOMString &str);
DOMString &operator =(const DOMString &str);
DOMString &operator += (const DOMString &str);
DOMString operator + (const DOMString &str);
void insert(DOMString str, uint pos);
const QChar &operator [](unsigned int i) const;
int find(const QChar c, int start = 0) const;
uint length() const;
void truncate( unsigned int len );
void remove(unsigned int pos, int len=1);
DOMString split(unsigned int pos);
DOMString lower() const;
DOMString upper() const;
QChar *unicode() const;
QString string() const;
int toInt() const;
bool percentage(int &_percentage) const;
DOMString copy() const;
bool isNull() const { return (impl == 0); }
bool isEmpty() const;
DOMStringImpl *implementation() const { return impl; }
protected:
DOMStringImpl *impl;
};
#ifndef NDEBUG
inline kdbgstream &operator<<(kdbgstream &stream, const DOMString &string) {
return (stream << string.string());
}
#else
inline kndbgstream &operator<<(kndbgstream &stream, const DOMString &) {
return stream;
}
#endif
KHTML_EXPORT bool operator==( const DOMString &a, const DOMString &b );
KHTML_EXPORT bool operator==( const DOMString &a, const QString &b );
KHTML_EXPORT bool operator==( const DOMString &a, const char *b );
inline bool operator!=( const DOMString &a, const DOMString &b ) { return !(a==b); }
inline bool operator!=( const DOMString &a, const QString &b ) { return !(a==b); }
inline bool operator!=( const DOMString &a, const char *b ) { return !(a==b); }
inline bool strcmp( const DOMString &a, const DOMString &b ) { return a != b; }
// returns false when equal, true otherwise (ignoring case)
KHTML_EXPORT bool strcasecmp( const DOMString &a, const DOMString &b );
KHTML_EXPORT bool strcasecmp( const DOMString& a, const char* b );
}
#endif
kdbgstream
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:43
DOM::DOMString::DOMString
DOMString()
default constructor.
Definition: dom_string.h:51
operator<<
kdbgstream & operator<<(const QValueList< T > &list)
kndbgstream

KDE Home | KDE Accessibility Home | Description of Access Keys