WPXString.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /* libwpd
00003  * Version: MPL 2.0 / LGPLv2.1+
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * Major Contributor(s):
00010  * Copyright (C) 2004 William Lachance (wrlach@gmail.com)
00011  * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
00012  *
00013  * For minor contributions see the git repository.
00014  *
00015  * Alternatively, the contents of this file may be used under the terms
00016  * of the GNU Lesser General Public License Version 2.1 or later
00017  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
00018  * applicable instead of those above.
00019  *
00020  * For further information visit http://libwpd.sourceforge.net
00021  */
00022 
00023 /* "This product is not manufactured, approved, or supported by
00024  * Corel Corporation or Corel Corporation Limited."
00025  */
00026 
00027 #ifndef WPXSTRING_H
00028 #define WPXSTRING_H
00029 
00030 class WPXStringImpl;
00031 
00032 class WPXString
00033 {
00034 public:
00035         WPXString();
00036         WPXString(const WPXString &, bool escapeXML = false);
00037         WPXString(const char *str);
00038         ~WPXString();
00039 
00040         const char *cstr() const;
00041         int len() const;
00042 
00043         void sprintf(const char *format, ...);
00044         void append(const WPXString &s);
00045         void append(const char *s);
00046         void append(const char c);
00047         void clear();
00048         WPXString &operator=(const WPXString &str);
00049         WPXString &operator=(const char *s);
00050         bool operator==(const char *s) const;
00051         bool operator==(const WPXString &str) const;
00052         bool operator!() const;
00053         inline bool operator!=(const char *s) const
00054         {
00055                 return !operator==(s);
00056         }
00057         inline bool operator!=(const WPXString &str) const
00058         {
00059                 return !operator==(str);
00060         }
00061 
00062         class Iter
00063         {
00064         public:
00065                 Iter(const WPXString &str);
00066                 virtual ~Iter();
00067                 void rewind();
00068                 bool next();
00069                 bool last();
00070                 const char *operator()() const;
00071         private:
00072                 Iter(const Iter &);
00073                 Iter &operator=(const Iter &);
00074                 WPXStringImpl *m_stringImpl;
00075                 int m_pos;
00076                 mutable char *m_curChar;
00077         };
00078 
00079 private:
00080         WPXStringImpl *m_stringImpl;
00081 };
00082 #endif
00083 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */