RVNGString.h Source File documentation

- 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 #include "librevenge-api.h"
25
26 namespace librevenge
27 {
28
29 class RVNGStringImpl;
30
31 class REVENGE_API RVNGString
32 {
33 public:
34 RVNGString();
35 RVNGString(const RVNGString &other);
36 RVNGString(const char *str);
37 ~RVNGString();
38
46 static RVNGString escapeXML(const RVNGString &s);
47
55 static RVNGString escapeXML(const char *s);
56
57 const char *cstr() const;
58 int len() const;
59 unsigned long size() const;
60 bool empty() const;
61
62 void sprintf(const char *format, ...) REVENGE_ATTRIBUTE_PRINTF(2, 3);
63 void append(const RVNGString &s);
64 void append(const char *s);
65 void append(const char c);
66
71 void appendEscapedXML(const RVNGString &s);
72
77 void appendEscapedXML(const char *s);
78
79 void clear();
80 RVNGString &operator=(const RVNGString &str);
81 RVNGString &operator=(const char *s);
82
83 // Comparison
84 bool operator==(const char *s) const;
85 bool operator==(const RVNGString &str) const;
86 inline bool operator!=(const char *s) const
87 {
88 return !operator==(s);
89 }
90 inline bool operator!=(const RVNGString &str) const
91 {
92 return !operator==(str);
93 }
94 bool operator<(const char *s) const;
95 bool operator<(const RVNGString &str) const;
96 inline bool operator<=(const char *s) const
97 {
98 return operator==(s) || operator<(s);
99 }
100 inline bool operator<=(const RVNGString &str) const
101 {
102 return operator==(str) || operator<(str);
103 }
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 inline bool operator>(const char *s) const
113 {
114 return !operator<=(s);
115 }
116 inline bool operator>(const RVNGString &str) const
117 {
118 return !operator<=(str);
119 }
120
121 class REVENGE_API Iter
122 {
123 public:
124 Iter(const RVNGString &str);
125 virtual ~Iter();
126 void rewind();
127 bool next();
128 bool last();
129 const char *operator()() const;
130 private:
131 Iter(const Iter &);
132 Iter &operator=(const Iter &);
133 RVNGStringImpl *m_stringImpl;
134 int m_pos;
135 mutable char *m_curChar;
136 };
137
138 private:
139 RVNGStringImpl *m_stringImpl;
140 };
141
142 }
143
144 #endif
145 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
librevenge::RVNGString::Iter::m_curChar
char * m_curChar
Definition: RVNGString.h:135
librevenge::RVNGString::m_stringImpl
RVNGStringImpl * m_stringImpl
Definition: RVNGString.h:139
librevenge
Definition: RVNGBinaryData.cpp:38
REVENGE_ATTRIBUTE_PRINTF
#define REVENGE_ATTRIBUTE_PRINTF(fmt, arg)
Definition: librevenge-api.h:41
librevenge::RVNGString::operator!=
bool operator!=(const RVNGString &str) const
Definition: RVNGString.h:90
librevenge::RVNGString::Iter::m_stringImpl
RVNGStringImpl * m_stringImpl
Definition: RVNGString.h:133
librevenge::RVNGString::operator>=
bool operator>=(const char *s) const
Definition: RVNGString.h:104
librevenge::RVNGStringImpl
Definition: RVNGString.cpp:70
librevenge::RVNGString::Iter
Definition: RVNGString.h:121
REVENGE_API
#define REVENGE_API
Definition: librevenge-api.h:34
librevenge::RVNGString::Iter::m_pos
int m_pos
Definition: RVNGString.h:134
librevenge::RVNGString::operator!=
bool operator!=(const char *s) const
Definition: RVNGString.h:86
librevenge::RVNGString::operator<=
bool operator<=(const char *s) const
Definition: RVNGString.h:96
librevenge::RVNGString::operator>
bool operator>(const RVNGString &str) const
Definition: RVNGString.h:116
librevenge-api.h
librevenge::RVNGString
Definition: RVNGString.h:31
librevenge::RVNGString::operator>=
bool operator>=(const RVNGString &str) const
Definition: RVNGString.h:108
librevenge::RVNGString::operator>
bool operator>(const char *s) const
Definition: RVNGString.h:112
librevenge::RVNGString::operator<=
bool operator<=(const RVNGString &str) const
Definition: RVNGString.h:100