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#include <string>
26
27namespace librevenge
28{
29
30class RVNGStringImpl;
31
35{
36public:
37 RVNGString();
38 RVNGString(const RVNGString &other);
39 RVNGString(const char *str);
40 RVNGString(std::string&&);
42
50 static RVNGString escapeXML(const RVNGString &s);
51
59 static RVNGString escapeXML(const char *s);
60
61 const char *cstr() const;
62
67 int len() const;
74 unsigned long size() const;
75
76 bool empty() const;
77
78 void sprintf(const char *format, ...) REVENGE_ATTRIBUTE_PRINTF(2, 3);
79 void append(const RVNGString &s);
80 void append(const char *s);
81 void append(const char c);
82
87 void appendEscapedXML(const RVNGString &s);
88
93 void appendEscapedXML(const char *s);
94
95 void clear();
96 RVNGString &operator=(const RVNGString &str);
97 RVNGString &operator=(const char *s);
98
99 // Comparison
100 bool operator==(const char *s) const;
101 bool operator==(const RVNGString &str) const;
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 bool operator<(const char *s) const;
111 bool operator<(const RVNGString &str) const;
112 inline bool operator<=(const char *s) const
113 {
114 return operator==(s) || operator<(s);
115 }
116 inline bool operator<=(const RVNGString &str) const
117 {
118 return operator==(str) || operator<(str);
119 }
120 inline bool operator>=(const char *s) const
121 {
122 return !operator<(s);
123 }
124 inline bool operator>=(const RVNGString &str) const
125 {
126 return !operator<(str);
127 }
128 inline bool operator>(const char *s) const
129 {
130 return !operator<=(s);
131 }
132 inline bool operator>(const RVNGString &str) const
133 {
134 return !operator<=(str);
135 }
136
138 {
139 public:
140 Iter(const RVNGString &str);
141 virtual ~Iter();
142 void rewind();
143 bool next();
144 bool last();
145 const char *operator()() const;
146 private:
147 Iter(const Iter &);
148 Iter &operator=(const Iter &);
150 int m_pos;
151 mutable char *m_curChar;
152 };
153
154private:
156};
157
158}
159
160#endif
161/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
Definition RVNGString.cpp:76
bool next()
Definition RVNGString.cpp:361
void rewind()
Definition RVNGString.cpp:356
int m_pos
Definition RVNGString.h:150
Iter & operator=(const Iter &)
const char * operator()() const
Definition RVNGString.cpp:386
char * m_curChar
Definition RVNGString.h:151
RVNGStringImpl * m_stringImpl
Definition RVNGString.h:149
Iter(const RVNGString &str)
Definition RVNGString.cpp:342
bool last()
Definition RVNGString.cpp:378
UTF-8 string.
Definition RVNGString.h:35
unsigned long size() const
Return the size in bytes of the data buffer.
Definition RVNGString.cpp:294
void clear()
Definition RVNGString.cpp:284
bool empty() const
Definition RVNGString.cpp:299
bool operator!=(const RVNGString &str) const
Definition RVNGString.h:106
bool operator<=(const RVNGString &str) const
Definition RVNGString.h:116
bool operator!=(const char *s) const
Definition RVNGString.h:102
static RVNGString escapeXML(const RVNGString &s)
Create a new string from s as escaped XML.
Definition RVNGString.cpp:209
bool operator>=(const RVNGString &str) const
Definition RVNGString.h:124
bool operator>(const char *s) const
Definition RVNGString.h:128
const char * cstr() const
Definition RVNGString.cpp:223
bool operator>=(const char *s) const
Definition RVNGString.h:120
void sprintf(const char *format,...) REVENGE_ATTRIBUTE_PRINTF(2
Definition RVNGString.cpp:228
bool operator==(const char *s) const
Definition RVNGString.cpp:318
void void append(const RVNGString &s)
Definition RVNGString.cpp:258
bool operator<(const char *s) const
Definition RVNGString.cpp:330
int len() const
Return the number of UTF-8 characters.
Definition RVNGString.cpp:289
bool operator>(const RVNGString &str) const
Definition RVNGString.h:132
RVNGString & operator=(const RVNGString &str)
Definition RVNGString.cpp:304
void appendEscapedXML(const RVNGString &s)
Append the content of s as escaped XML.
Definition RVNGString.cpp:274
RVNGString()
Definition RVNGString.cpp:185
RVNGStringImpl * m_stringImpl
Definition RVNGString.h:155
bool operator<=(const char *s) const
Definition RVNGString.h:112
#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.16.1