• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KHTML

dom_string.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of the DOM implementation for KDE.
00003  *
00004  * Copyright 1999 Lars Knoll (knoll@kde.org)
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public License
00017  * along with this library; see the file COPYING.LIB.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 #ifndef _DOM_DOMString_h_
00023 #define _DOM_DOMString_h_
00024 
00025 #include <khtml_export.h>
00026 #include <kdebug.h>
00027 #include <QtCore/QString>
00028 
00029 namespace DOM {
00030 
00031 class DOMStringImpl;
00032 
00042 class KHTML_EXPORT DOMString
00043 {
00044     friend class CharacterDataImpl;
00045     friend KHTML_EXPORT bool operator==( const DOMString &a, const char *b );
00046 public:
00050     DOMString() : impl(0) {}
00051 
00052     DOMString(const QChar *str, uint len);
00053     DOMString(const QString &);
00054     DOMString(const char *str);
00058     DOMString(const char *str, uint len);
00059     DOMString(DOMStringImpl *i);
00060 
00061     virtual ~DOMString();
00062 
00063     // assign and copy
00064     DOMString(const DOMString &str);
00065     DOMString &operator =(const DOMString &str);
00066 
00070     DOMString &operator += (const DOMString &str);
00074     DOMString operator + (const DOMString &str);
00075 
00076     void insert(DOMString str, uint pos);
00077 
00082     const QChar &operator [](unsigned int i) const;
00083 
00084     int find(const QChar c, int start = 0) const;
00085 
00086     uint length() const;
00087     void truncate( unsigned int len );
00088     void remove(unsigned int pos, int len=1);
00092     DOMString split(unsigned int pos);
00093 
00097     DOMString lower() const;
00101     DOMString upper() const;
00102 
00103     QChar *unicode() const;
00104     // for WebCore API compatibility
00105     inline QChar *characters() const { return unicode(); }
00106     QString string() const;
00107 
00108     int toInt() const;
00109     int toInt(bool* ok) const;
00110     float toFloat(bool* ok = 0) const;
00111     bool percentage(int &_percentage) const;
00112 
00113     static DOMString number(float f);
00114 
00115     DOMString copy() const;
00116 
00117     bool isNull()  const { return (impl == 0); }
00118     bool isEmpty()  const;
00119 
00120     bool endsWith(const DOMString& str) const;
00121 
00126     DOMStringImpl *implementation() const { return impl; }
00127 
00128 protected:
00129     DOMStringImpl *impl;
00130 };
00131 
00132 inline QDebug operator<<(QDebug stream, const DOMString &string) {
00133     return (stream << (string.implementation() ? string.string() : QString::fromLatin1("null")));
00134 }
00135 
00136 KHTML_EXPORT bool operator==( const DOMString &a, const DOMString &b );
00137 KHTML_EXPORT bool operator==( const DOMString &a, const QString &b );
00138 KHTML_EXPORT bool operator==( const DOMString &a, const char *b );
00139 inline bool operator!=( const DOMString &a, const DOMString &b ) { return !(a==b); }
00140 inline bool operator!=( const DOMString &a, const QString &b ) { return !(a==b); }
00141 inline bool operator!=( const DOMString &a, const char *b )  { return !(a==b); }
00142 inline bool strcmp( const DOMString &a, const DOMString &b ) { return a != b; }
00143 
00144 // returns false when equal, true otherwise (ignoring case)
00145 KHTML_EXPORT bool strcasecmp( const DOMString &a, const DOMString &b );
00146 KHTML_EXPORT bool strcasecmp( const DOMString& a, const char* b );
00147 
00148 }
00149 #endif

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • kformula
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal