RVNGPropertyList.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /* librevenge
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 
00021 #ifndef RVNGPROPERTYLIST_H
00022 #define RVNGPROPERTYLIST_H
00023 
00024 #include "librevenge-api.h"
00025 
00026 #include "RVNGProperty.h"
00027 
00028 namespace librevenge
00029 {
00030 
00031 // we use the pimpl pattern so we don't expose any STL symbols to the rest of
00032 // the world.. yes, this is quite annoying.
00033 
00034 class RVNGPropertyListImpl;
00035 class RVNGPropertyListIterImpl;
00036 class RVNGPropertyListVector;
00037 
00038 class REVENGE_API RVNGPropertyList
00039 {
00040 public:
00041         RVNGPropertyList();
00042         RVNGPropertyList(const RVNGPropertyList &);
00043         virtual ~RVNGPropertyList();
00044         void insert(const char *name, RVNGProperty *prop);
00045         void insert(const char *name, const char *val);
00046         void insert(const char *name, const int val);
00047         void insert(const char *name, const bool val);
00048         void insert(const char *name, const RVNGString &val);
00049         void insert(const char *name, const double val, const RVNGUnit units = RVNG_INCH);
00050         void insert(const char *name, const unsigned char *buffer, const unsigned long bufferSize);
00051         void insert(const char *name, const RVNGBinaryData &data);
00052         void insert(const char *name, const RVNGPropertyListVector &vec);
00053         void remove(const char *name);
00054         void clear();
00055         bool empty() const;
00056 
00057         const RVNGProperty *operator[](const char *name) const;
00058         const RVNGPropertyListVector *child(const char *name) const;
00059         const RVNGPropertyList &operator=(const RVNGPropertyList &propList);
00060 
00061         RVNGString getPropString() const;
00062 
00063         class REVENGE_API Iter
00064         {
00065         public:
00066                 Iter(const RVNGPropertyList &propList);
00067                 virtual ~Iter();
00068                 void rewind();
00069                 bool next();
00070                 bool last();
00071                 const RVNGProperty *operator()() const;
00072                 const char *key() const;
00073                 const RVNGPropertyListVector *child() const;
00074         private:
00075                 RVNGPropertyListIterImpl *m_iterImpl;
00076                 Iter(const Iter &);
00077                 Iter &operator=(const Iter &);
00078         };
00079         friend class RVNGPropertyList::Iter;
00080 
00081 private:
00082         mutable RVNGPropertyListImpl *m_impl;
00083 };
00084 
00085 }
00086 
00087 #endif /* RVNGPROPERTYLIST_H */
00088 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */