- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

RVNGString.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* librevenge
3 * Version: MPL 2.0 / LGPLv2.1+
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * Major Contributor(s):
10 * Copyright (C) 2004 William Lachance (wrlach@gmail.com)
11 * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
12 *
13 * For minor contributions see the git repository.
14 *
15 * Alternatively, the contents of this file may be used under the terms
16 * of the GNU Lesser General Public License Version 2.1 or later
17 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
18 * applicable instead of those above.
19 */
20
21 #ifndef RVNGSTRING_H
22 #define RVNGSTRING_H
23
24 namespace librevenge
25 {
26
27 class RVNGStringImpl;
28
29 class RVNGString
30 {
31 public:
32 RVNGString();
33 RVNGString(const RVNGString &other);
34 RVNGString(const char *str);
35 ~RVNGString();
36
44 static RVNGString escapeXML(const RVNGString &s);
45
53 static RVNGString escapeXML(const char *s);
54
55 const char *cstr() const;
56 int len() const;
57 unsigned long size() const;
58 bool empty() const;
59
60 void sprintf(const char *format, ...);
61 void append(const RVNGString &s);
62 void append(const char *s);
63 void append(const char c);
64
69 void appendEscapedXML(const RVNGString &s);
70
75 void appendEscapedXML(const char *s);
76
77 void clear();
78 RVNGString &operator=(const RVNGString &str);
79 RVNGString &operator=(const char *s);
80
81 // Comparison
82 bool operator==(const char *s) const;
83 bool operator==(const RVNGString &str) const;
84 inline bool operator!=(const char *s) const
85 {
86 return !operator==(s);
87 }
88 inline bool operator!=(const RVNGString &str) const
89 {
90 return !operator==(str);
91 }
92 bool operator<(const char *s) const;
93 bool operator<(const RVNGString &str) const;
94 inline bool operator<=(const char *s) const
95 {
96 return operator==(s) || operator<(s);
97 }
98 inline bool operator<=(const RVNGString &str) const
99 {
100 return operator==(str) || operator<(str);
101 }
102 inline bool operator>=(const char *s) const
103 {
104 return !operator<(s);
105 }
106 inline bool operator>=(const RVNGString &str) const
107 {
108 return !operator<(str);
109 }
110 inline bool operator>(const char *s) const
111 {
112 return !operator<=(s);
113 }
114 inline bool operator>(const RVNGString &str) const
115 {
116 return !operator<=(str);
117 }
118
119 class Iter
120 {
121 public:
122 Iter(const RVNGString &str);
123 virtual ~Iter();
124 void rewind();
125 bool next();
126 bool last();
127 const char *operator()() const;
128 private:
129 Iter(const Iter &);
130 Iter &operator=(const Iter &);
131 RVNGStringImpl *m_stringImpl;
132 int m_pos;
133 mutable char *m_curChar;
134 };
135
136 private:
137 RVNGStringImpl *m_stringImpl;
138 };
139
140 }
141
142 #endif
143 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
librevenge::RVNGString::Iter::last
bool last()
Definition: RVNGString.cpp:330
librevenge::RVNGString::Iter::m_curChar
char * m_curChar
Definition: RVNGString.h:133
librevenge::RVNGString::m_stringImpl
RVNGStringImpl * m_stringImpl
Definition: RVNGString.h:137
librevenge::RVNGString::Iter::Iter
Iter(const RVNGString &str)
Definition: RVNGString.cpp:294
librevenge::RVNGString::Iter::next
bool next()
Definition: RVNGString.cpp:313
librevenge::RVNGString::appendEscapedXML
void appendEscapedXML(const RVNGString &s)
Append the content of s as escaped XML.
Definition: RVNGString.cpp:225
librevenge::RVNGString::~RVNGString
~RVNGString()
Definition: RVNGString.cpp:134
librevenge::RVNGString::Iter::~Iter
virtual ~Iter()
Definition: RVNGString.cpp:302
librevenge::RVNGString::operator!=
bool operator!=(const RVNGString &str) const
Definition: RVNGString.h:88
librevenge::RVNGString::operator==
bool operator==(const char *s) const
Definition: RVNGString.cpp:270
librevenge::RVNGString::Iter::rewind
void rewind()
Definition: RVNGString.cpp:308
librevenge::RVNGString::escapeXML
static RVNGString escapeXML(const RVNGString &s)
Create a new string from as escaped XML.
Definition: RVNGString.cpp:158
librevenge::RVNGString::clear
void clear()
Definition: RVNGString.cpp:235
librevenge::RVNGString::empty
bool empty() const
Definition: RVNGString.cpp:250
librevenge::RVNGString::append
void append(const RVNGString &s)
Definition: RVNGString.cpp:209
librevenge::RVNGString::len
int len() const
Definition: RVNGString.cpp:240
librevenge::RVNGString::Iter::m_stringImpl
RVNGStringImpl * m_stringImpl
Definition: RVNGString.h:131
librevenge::RVNGString::operator>=
bool operator>=(const char *s) const
Definition: RVNGString.h:102
librevenge::RVNGStringImpl
Definition: RVNGString.cpp:70
librevenge::RVNGString::cstr
const char * cstr() const
Definition: RVNGString.cpp:172
librevenge::RVNGString::operator<
bool operator<(const char *s) const
Definition: RVNGString.cpp:282
librevenge::RVNGString::RVNGString
RVNGString()
Definition: RVNGString.cpp:139
librevenge::RVNGString::Iter::operator=
Iter & operator=(const Iter &)
librevenge::RVNGString::Iter
Definition: RVNGString.h:119
librevenge::RVNGString::operator=
RVNGString & operator=(const RVNGString &str)
Definition: RVNGString.cpp:255
librevenge::RVNGString::Iter::m_pos
int m_pos
Definition: RVNGString.h:132
librevenge::RVNGString::operator!=
bool operator!=(const char *s) const
Definition: RVNGString.h:84
librevenge::RVNGString::size
unsigned long size() const
Definition: RVNGString.cpp:245
librevenge::RVNGString::operator<=
bool operator<=(const char *s) const
Definition: RVNGString.h:94
librevenge::RVNGString::operator>
bool operator>(const RVNGString &str) const
Definition: RVNGString.h:114
librevenge::RVNGString
Definition: RVNGString.h:29
librevenge::RVNGString::sprintf
void sprintf(const char *format,...)
Definition: RVNGString.cpp:177
librevenge::RVNGString::operator>=
bool operator>=(const RVNGString &str) const
Definition: RVNGString.h:106
librevenge::RVNGString::operator>
bool operator>(const char *s) const
Definition: RVNGString.h:110
librevenge::RVNGString::operator<=
bool operator<=(const RVNGString &str) const
Definition: RVNGString.h:98
librevenge::RVNGString::Iter::operator()
const char * operator()() const
Definition: RVNGString.cpp:337