RVNGString.h Source File documentation

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
33 class REVENGE_API RVNGString
34{
35public:
36 RVNGString();
37 RVNGString(const RVNGString &other);
38 RVNGString(const char *str);
39 ~RVNGString();
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
135 class REVENGE_API Iter
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 &);
147 RVNGStringImpl *m_stringImpl;
148 int m_pos;
149 mutable char *m_curChar;
150 };
151
152private:
153 RVNGStringImpl *m_stringImpl;
154};
155
156}
157
158#endif
159/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
librevenge::RVNGStringImpl
Definition RVNGString.cpp:76
librevenge::RVNGString::Iter::next
bool next()
Definition RVNGString.cpp:355
librevenge::RVNGString::Iter::rewind
void rewind()
Definition RVNGString.cpp:350
librevenge::RVNGString::Iter::m_pos
int m_pos
Definition RVNGString.h:148
librevenge::RVNGString::Iter::operator=
Iter & operator=(const Iter &)
librevenge::RVNGString::Iter::operator()
const char * operator()() const
Definition RVNGString.cpp:380
librevenge::RVNGString::Iter::m_curChar
char * m_curChar
Definition RVNGString.h:149
librevenge::RVNGString::Iter::m_stringImpl
RVNGStringImpl * m_stringImpl
Definition RVNGString.h:147
librevenge::RVNGString::Iter::Iter
Iter(const Iter &)
librevenge::RVNGString::Iter::Iter
Iter(const RVNGString &str)
Definition RVNGString.cpp:336
librevenge::RVNGString::Iter::last
bool last()
Definition RVNGString.cpp:372
librevenge::RVNGString
UTF-8 string.
Definition RVNGString.h:34
librevenge::RVNGString::size
unsigned long size() const
Return the size in bytes of the data buffer.
Definition RVNGString.cpp:288
librevenge::RVNGString::clear
void clear()
Definition RVNGString.cpp:278
librevenge::RVNGString::empty
bool empty() const
Definition RVNGString.cpp:293
librevenge::RVNGString::operator!=
bool operator!=(const RVNGString &str) const
Definition RVNGString.h:104
librevenge::RVNGString::operator<=
bool operator<=(const RVNGString &str) const
Definition RVNGString.h:114
librevenge::RVNGString::operator!=
bool operator!=(const char *s) const
Definition RVNGString.h:100
librevenge::RVNGString::escapeXML
static RVNGString escapeXML(const RVNGString &s)
Create a new string from s as escaped XML.
Definition RVNGString.cpp:203
librevenge::RVNGString::operator>=
bool operator>=(const RVNGString &str) const
Definition RVNGString.h:122
librevenge::RVNGString::operator>
bool operator>(const char *s) const
Definition RVNGString.h:126
librevenge::RVNGString::cstr
const char * cstr() const
Definition RVNGString.cpp:217
librevenge::RVNGString::operator>=
bool operator>=(const char *s) const
Definition RVNGString.h:118
librevenge::RVNGString::sprintf
void sprintf(const char *format,...) REVENGE_ATTRIBUTE_PRINTF(2
Definition RVNGString.cpp:222
librevenge::RVNGString::operator==
bool operator==(const char *s) const
Definition RVNGString.cpp:312
librevenge::RVNGString::append
void void append(const RVNGString &s)
Definition RVNGString.cpp:252
librevenge::RVNGString::operator<
bool operator<(const char *s) const
Definition RVNGString.cpp:324
librevenge::RVNGString::len
int len() const
Return the number of UTF-8 characters.
Definition RVNGString.cpp:283
librevenge::RVNGString::operator>
bool operator>(const RVNGString &str) const
Definition RVNGString.h:130
librevenge::RVNGString::operator=
RVNGString & operator=(const RVNGString &str)
Definition RVNGString.cpp:298
librevenge::RVNGString::appendEscapedXML
void appendEscapedXML(const RVNGString &s)
Append the content of s as escaped XML.
Definition RVNGString.cpp:268
librevenge::RVNGString::RVNGString
RVNGString()
Definition RVNGString.cpp:184
librevenge::RVNGString::m_stringImpl
RVNGStringImpl * m_stringImpl
Definition RVNGString.h:153
librevenge::RVNGString::operator<=
bool operator<=(const char *s) const
Definition RVNGString.h:110
librevenge-api.h
REVENGE_API
#define REVENGE_API
Definition librevenge-api.h:34
REVENGE_ATTRIBUTE_PRINTF
#define REVENGE_ATTRIBUTE_PRINTF(fmt, arg)
Definition librevenge-api.h:41
librevenge
Definition RVNGBinaryData.cpp:40