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

KHTML

  • sources
  • kde-4.12
  • kdelibs
  • khtml
  • dom
dom_string.h
Go to the documentation of this file.
1 /*
2  * This file is part of the DOM implementation for KDE.
3  *
4  * Copyright 1999 Lars Knoll (knoll@kde.org)
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  */
22 #ifndef _DOM_DOMString_h_
23 #define _DOM_DOMString_h_
24 
25 #include <khtml_export.h>
26 #include <kdebug.h>
27 #include <QtCore/QString>
28 #include <limits.h>
29 
30 namespace DOM {
31 
32 class DOMStringImpl;
33 
43 class KHTML_EXPORT DOMString
44 {
45  friend class CharacterDataImpl;
46  friend KHTML_EXPORT bool operator==( const DOMString &a, const char *b );
47 public:
51  DOMString() : impl(0) {}
52 
53  DOMString(const QChar *str, uint len);
54  DOMString(const QString &);
55  DOMString(const char *str);
59  DOMString(const char *str, uint len);
60  DOMString(DOMStringImpl *i);
61 
62  virtual ~DOMString();
63 
64  // assign and copy
65  DOMString(const DOMString &str);
66  DOMString &operator =(const DOMString &str);
67 
71  DOMString &operator += (const DOMString &str);
75  DOMString operator + (const DOMString &str);
76 
77  void insert(DOMString str, uint pos);
78 
83  const QChar &operator [](unsigned int i) const;
84 
85  int find(const QChar c, int start = 0) const;
86  int reverseFind(const QChar c, int start = -1) const;
87 
88  DOMString substring(unsigned pos, unsigned len = UINT_MAX) const;
89 
90  uint length() const;
91  void truncate( unsigned int len );
92  void remove(unsigned int pos, int len=1);
96  DOMString split(unsigned int pos);
97 
101  DOMString lower() const;
105  DOMString upper() const;
106 
107  QChar *unicode() const;
108  // for WebCore API compatibility
109  inline QChar *characters() const { return unicode(); }
110  QString string() const;
111 
112  int toInt() const;
113  int toInt(bool* ok) const;
114  float toFloat(bool* ok = 0) const;
115  bool percentage(int &_percentage) const;
116 
117  static DOMString number(float f);
118 
119  DOMString copy() const;
120 
121  bool isNull() const { return (impl == 0); }
122  bool isEmpty() const;
123 
124  bool endsWith(const DOMString& str) const;
125  bool startsWith(const DOMString& str) const;
126 
131  DOMStringImpl *implementation() const { return impl; }
132 
133  static DOMString format(const char* format, ...)
134 #if defined(__GNUC__)
135  __attribute__ ((format (printf, 1, 2)))
136 #endif
137  ;
138 
139 protected:
140  DOMStringImpl *impl;
141 };
142 
143 inline QDebug operator<<(QDebug stream, const DOMString &string) {
144  return (stream << (string.implementation() ? string.string() : QString::fromLatin1("null")));
145 }
146 
147 KHTML_EXPORT bool operator==( const DOMString &a, const DOMString &b );
148 KHTML_EXPORT bool operator==( const DOMString &a, const QString &b );
149 KHTML_EXPORT bool operator==( const DOMString &a, const char *b );
150 inline bool operator!=( const DOMString &a, const DOMString &b ) { return !(a==b); }
151 inline bool operator!=( const DOMString &a, const QString &b ) { return !(a==b); }
152 inline bool operator!=( const DOMString &a, const char *b ) { return !(a==b); }
153 inline bool strcmp( const DOMString &a, const DOMString &b ) { return a != b; }
154 
155 // returns false when equal, true otherwise (ignoring case)
156 KHTML_EXPORT bool strcasecmp( const DOMString &a, const DOMString &b );
157 KHTML_EXPORT bool strcasecmp( const DOMString& a, const char* b );
158 
159 }
160 #endif
DOM::DOMString::characters
QChar * characters() const
Definition: dom_string.h:109
kdebug.h
DOM::operator!=
bool operator!=(const DOMString &a, const DOMString &b)
Definition: dom_string.h:150
copy
KAction * copy(const QObject *recvr, const char *slot, QObject *parent)
DOM::strcasecmp
bool strcasecmp(const DOMString &a, const DOMString &b)
Definition: dom_string.cpp:295
DOM::operator<<
QDebug operator<<(QDebug stream, const DOMString &string)
Definition: dom_string.h:143
find
KAction * find(const QObject *recvr, const char *slot, QObject *parent)
QString
DOM::DOMString::impl
DOMStringImpl * impl
Definition: dom_string.h:140
DOM::strcmp
bool strcmp(const DOMString &a, const DOMString &b)
Definition: dom_string.h:153
insert
KGuiItem insert()
DOM::DOMString::isNull
bool isNull() const
Definition: dom_string.h:121
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:43
DOM::operator==
bool operator==(const DOMString &a, const DOMString &b)
Definition: dom_string.cpp:365
DOM::DOMString::DOMString
DOMString()
default constructor.
Definition: dom_string.h:51
WebCore::operator+
FloatPoint operator+(const FloatPoint &a, const FloatSize &b)
Definition: FloatPoint.h:115
khtml_export.h
DOM::DOMString::implementation
DOMStringImpl * implementation() const
Definition: dom_string.h:131
number
QString number(KIO::filesize_t size)
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:51:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal