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#include "librevenge-api.h"
25
26namespace librevenge
27{
28
29class RVNGStringImpl;
30
34{
35public:
36 RVNGString();
37 RVNGString(const RVNGString &other);
38 RVNGString(const char *str);
40
48 static RVNGString escapeXML(const RVNGString &s);
49
57 static RVNGString escapeXML(const char *s);
58
59 const char *cstr() const;
60
65 int len() const;
72 unsigned long size() const;
73
74 bool empty() const;
75
76 void sprintf(const char *format, ...) REVENGE_ATTRIBUTE_PRINTF(2, 3);
77 void append(const RVNGString &s);
78 void append(const char *s);
79 void append(const char c);
80
85 void appendEscapedXML(const RVNGString &s);
86
91 void appendEscapedXML(const char *s);
92
93 void clear();
94 RVNGString &operator=(const RVNGString &str);
95 RVNGString &operator=(const char *s);
96
97 // Comparison
98 bool operator==(const char *s) const;
99 bool operator==(const RVNGString &str) const;
100 inline bool operator!=(const char *s) const
101 {
102 return !operator==(s);
103 }
104 inline bool operator!=(const RVNGString &str) const
105 {
106 return !operator==(str);
107 }
108 bool operator<(const char *s) const;
109 bool operator<(const RVNGString &str) const;
110 inline bool operator<=(const char *s) const
111 {
112 return operator==(s) || operator<(s);
113 }
114 inline bool operator<=(const RVNGString &str) const
115 {
116 return operator==(str) || operator<(str);
117 }
118 inline bool operator>=(const char *s) const
119 {
120 return !operator<(s);
121 }
122 inline bool operator>=(const RVNGString &str) const
123 {
124 return !operator<(str);
125 }
126 inline bool operator>(const char *s) const
127 {
128 return !operator<=(s);
129 }
130 inline bool operator>(const RVNGString &str) const
131 {
132 return !operator<=(str);
133 }
134
136 {
137 public:
138 Iter(const RVNGString &str);
139 virtual ~Iter();
140 void rewind();
141 bool next();
142 bool last();
143 const char *operator()() const;
144 private:
145 Iter(const Iter &);
146 Iter &operator=(const Iter &);
148 int m_pos;
149 mutable char *m_curChar;
150 };
151
152private:
154};
155
156}
157
158#endif
159/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
Definition RVNGString.cpp:76
bool next()
Definition RVNGString.cpp:355
void rewind()
Definition RVNGString.cpp:350
int m_pos
Definition RVNGString.h:148
Iter & operator=(const Iter &)
const char * operator()() const
Definition RVNGString.cpp:380
char * m_curChar
Definition RVNGString.h:149
RVNGStringImpl * m_stringImpl
Definition RVNGString.h:147
Iter(const RVNGString &str)
Definition RVNGString.cpp:336
bool last()
Definition RVNGString.cpp:372
UTF-8 string.
Definition RVNGString.h:34
unsigned long size() const
Return the size in bytes of the data buffer.
Definition RVNGString.cpp:288
void clear()
Definition RVNGString.cpp:278
bool empty() const
Definition RVNGString.cpp:293
bool operator!=(const RVNGString &str) const
Definition RVNGString.h:104
bool operator<=(const RVNGString &str) const
Definition RVNGString.h:114
bool operator!=(const char *s) const
Definition RVNGString.h:100
static RVNGString escapeXML(const RVNGString &s)
Create a new string from s as escaped XML.
Definition RVNGString.cpp:203
bool operator>=(const RVNGString &str) const
Definition RVNGString.h:122
bool operator>(const char *s) const
Definition RVNGString.h:126
const char * cstr() const
Definition RVNGString.cpp:217
bool operator>=(const char *s) const
Definition RVNGString.h:118
void sprintf(const char *format,...) REVENGE_ATTRIBUTE_PRINTF(2
Definition RVNGString.cpp:222
bool operator==(const char *s) const
Definition RVNGString.cpp:312
void void append(const RVNGString &s)
Definition RVNGString.cpp:252
bool operator<(const char *s) const
Definition RVNGString.cpp:324
int len() const
Return the number of UTF-8 characters.
Definition RVNGString.cpp:283
bool operator>(const RVNGString &str) const
Definition RVNGString.h:130
RVNGString & operator=(const RVNGString &str)
Definition RVNGString.cpp:298
void appendEscapedXML(const RVNGString &s)
Append the content of s as escaped XML.
Definition RVNGString.cpp:268
RVNGString()
Definition RVNGString.cpp:184
RVNGStringImpl * m_stringImpl
Definition RVNGString.h:153
bool operator<=(const char *s) const
Definition RVNGString.h:110
#define REVENGE_API
Definition librevenge-api.h:34
#define REVENGE_ATTRIBUTE_PRINTF(fmt, arg)
Definition librevenge-api.h:41
Definition RVNGBinaryData.cpp:40

Generated for librevenge by doxygen 1.14.0