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 
27 namespace librevenge
28 {
29 
30 class RVNGStringImpl;
31 
35 {
36 public:
37  RVNGString();
38  RVNGString(const RVNGString &other);
39  RVNGString(const char *str);
40  RVNGString(std::string&&);
41  ~RVNGString();
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 
154 private:
156 };
157 
158 }
159 
160 #endif
161 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
char * m_curChar
Definition: RVNGString.h:151
RVNGStringImpl * m_stringImpl
Definition: RVNGString.h:155
Definition: RVNGBinaryData.cpp:39
#define REVENGE_ATTRIBUTE_PRINTF(fmt, arg)
Definition: librevenge-api.h:41
bool operator!=(const RVNGString &str) const
Definition: RVNGString.h:106
RVNGStringImpl * m_stringImpl
Definition: RVNGString.h:149
bool operator>=(const char *s) const
Definition: RVNGString.h:120
Definition: RVNGString.cpp:75
Definition: RVNGString.h:137
#define REVENGE_API
Definition: librevenge-api.h:34
int m_pos
Definition: RVNGString.h:150
bool operator!=(const char *s) const
Definition: RVNGString.h:102
bool operator<=(const char *s) const
Definition: RVNGString.h:112
bool operator>(const RVNGString &str) const
Definition: RVNGString.h:132
UTF-8 string.
Definition: RVNGString.h:34
bool operator>=(const RVNGString &str) const
Definition: RVNGString.h:124
bool operator>(const char *s) const
Definition: RVNGString.h:128
bool operator<=(const RVNGString &str) const
Definition: RVNGString.h:116

Generated for librevenge by doxygen 1.8.10