00001 /* libwpd 00002 * Copyright (C) 2004 William Lachance (william.lachance@sympatico.ca) 00003 * Copyright (C) 2005 Net Integration Technologies (http://www.net-itech.com) 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 00018 * 00019 * For further information visit http://libwpd.sourceforge.net 00020 */ 00021 00022 /* "This product is not manufactured, approved, or supported by 00023 * Corel Corporation or Corel Corporation Limited." 00024 */ 00025 00026 #ifndef WPXPROPERTYLIST_H 00027 #define WPXPROPERTYLIST_H 00028 #include "WPXProperty.h" 00029 00030 // we use the pimpl pattern so we don't expose any STL symbols to the rest of 00031 // the world.. yes, this is quite annoying. 00032 00033 class WPXMapImpl 00034 { 00035 public: 00036 virtual ~WPXMapImpl() {} 00037 virtual void insert(const char *name, WPXProperty *property) = 0; 00038 virtual const WPXProperty * operator[](const char *name) const = 0; 00039 virtual void remove(const char *name) = 0; 00040 virtual void clear() = 0; 00041 00042 friend class WPXMapIterImpl; 00043 }; 00044 00045 class WPXMapIterImpl 00046 { 00047 public: 00048 virtual void rewind() = 0; 00049 virtual bool next() = 0; 00050 virtual bool last() = 0; 00051 virtual const WPXProperty * operator()() const = 0; 00052 virtual const char * key() = 0; 00053 }; 00054 00055 class WPXPropertyList 00056 { 00057 public: 00058 WPXPropertyList(); 00059 WPXPropertyList(const WPXPropertyList &); 00060 virtual ~WPXPropertyList(); 00061 void insert(const char * name, WPXProperty *prop); 00062 void insert(const char * name, const char *val); 00063 void insert(const char * name, const int val); 00064 void insert(const char * name, const bool val); 00065 void insert(const char * name, const WPXString &val); 00066 void insert(const char * name, const float val, const WPXUnit units = INCH); 00067 00068 void remove(const char * name); 00069 const WPXProperty * operator[](const char *name) const; 00070 void clear(); 00071 00072 class Iter 00073 { 00074 public: 00075 Iter(const WPXPropertyList &propList); 00076 virtual ~Iter(); 00077 void rewind(); 00078 bool next(); 00079 bool last(); 00080 const WPXProperty * operator()() const; 00081 const char * key(); 00082 private: 00083 WPXMapIterImpl *m_iterImpl; 00084 }; 00085 friend class WPXPropertyList::Iter; 00086 00087 private: 00088 mutable WPXMapImpl *m_mapImpl; 00089 }; 00090 #endif /* WPXPROPERTYLIST_H */