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(RVNGString &&other);
40 RVNGString(const char *str);
41 RVNGString(std::string&&);
43
51 static RVNGString escapeXML(const RVNGString &s);
52
60 static RVNGString escapeXML(const char *s);
61
62 const char *cstr() const;
63
68 int len() const;
75 unsigned long size() const;
76
77 bool empty() const;
78
79 void sprintf(const char *format, ...) REVENGE_ATTRIBUTE_PRINTF(2, 3);
80 void append(const RVNGString &s);
81 void append(const char *s);
82 void append(const char c);
83
88 void appendEscapedXML(const RVNGString &s);
89
94 void appendEscapedXML(const char *s);
95
96 void clear();
97 RVNGString &operator=(const RVNGString &str);
99 RVNGString &operator=(const char *s);
100
101 // Comparison
102 bool operator==(const char *s) const;
103 bool operator==(const RVNGString &str) const;
104 inline bool operator!=(const char *s) const
105 {
106 return !operator==(s);
107 }
108 inline bool operator!=(const RVNGString &str) const
109 {
110 return !operator==(str);
111 }
112 bool operator<(const char *s) const;
113 bool operator<(const RVNGString &str) const;
114 inline bool operator<=(const char *s) const
115 {
116 return operator==(s) || operator<(s);
117 }
118 inline bool operator<=(const RVNGString &str) const
119 {
120 return operator==(str) || operator<(str);
121 }
122 inline bool operator>=(const char *s) const
123 {
124 return !operator<(s);
125 }
126 inline bool operator>=(const RVNGString &str) const
127 {
128 return !operator<(str);
129 }
130 inline bool operator>(const char *s) const
131 {
132 return !operator<=(s);
133 }
134 inline bool operator>(const RVNGString &str) const
135 {
136 return !operator<=(str);
137 }
138
140 {
141 public:
142 Iter(const RVNGString &str);
143 virtual ~Iter();
144 void rewind();
145 bool next();
146 bool last();
147 const char *operator()() const;
148 private:
149 Iter(const Iter &);
150 Iter &operator=(const Iter &);
152 int m_pos;
153 mutable char *m_curChar;
154 };
155
156private:
158};
159
160}
161
162#endif
163/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
Definition RVNGString.cpp:74
bool next()
Definition RVNGString.cpp:379
void rewind()
Definition RVNGString.cpp:374
int m_pos
Definition RVNGString.h:152
Iter & operator=(const Iter &)
const char * operator()() const
Definition RVNGString.cpp:404
char * m_curChar
Definition RVNGString.h:153
RVNGStringImpl * m_stringImpl
Definition RVNGString.h:151
Iter(const RVNGString &str)
Definition RVNGString.cpp:360
bool last()
Definition RVNGString.cpp:396
UTF-8 string.
Definition RVNGString.h:35
unsigned long size() const
Return the size in bytes of the data buffer.
Definition RVNGString.cpp:306
void clear()
Definition RVNGString.cpp:296
bool empty() const
Definition RVNGString.cpp:311
bool operator!=(const RVNGString &str) const
Definition RVNGString.h:108
bool operator<=(const RVNGString &str) const
Definition RVNGString.h:118
bool operator!=(const char *s) const
Definition RVNGString.h:104
static RVNGString escapeXML(const RVNGString &s)
Create a new string from s as escaped XML.
Definition RVNGString.cpp:219
bool operator>=(const RVNGString &str) const
Definition RVNGString.h:126
bool operator>(const char *s) const
Definition RVNGString.h:130
const char * cstr() const
Definition RVNGString.cpp:233
bool operator>=(const char *s) const
Definition RVNGString.h:122
void sprintf(const char *format,...) REVENGE_ATTRIBUTE_PRINTF(2
Definition RVNGString.cpp:238
bool operator==(const char *s) const
Definition RVNGString.cpp:336
void void append(const RVNGString &s)
Definition RVNGString.cpp:270
bool operator<(const char *s) const
Definition RVNGString.cpp:348
int len() const
Return the number of UTF-8 characters.
Definition RVNGString.cpp:301
bool operator>(const RVNGString &str) const
Definition RVNGString.h:134
RVNGString & operator=(const RVNGString &str)
Definition RVNGString.cpp:316
void appendEscapedXML(const RVNGString &s)
Append the content of s as escaped XML.
Definition RVNGString.cpp:286
RVNGString()
Definition RVNGString.cpp:189
RVNGStringImpl * m_stringImpl
Definition RVNGString.h:157
bool operator<=(const char *s) const
Definition RVNGString.h:114
#define REVENGE_API
Definition librevenge-api.h:34
#define REVENGE_ATTRIBUTE_PRINTF(fmt, arg)
Definition librevenge-api.h:41
Definition RVNGBinaryData.cpp:41

Generated for librevenge by doxygen 1.18.0