00001 00004 /* ----START-LICENCE---- 00005 * Copyright 1999,2000,2001 BrightStation PLC 00006 * Copyright 2002 Ananova Ltd 00007 * Copyright 2002 Olly Betts 00008 * 00009 * This program is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License as 00011 * published by the Free Software Foundation; either version 2 of the 00012 * License, or (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program; if not, write to the Free Software 00021 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00022 * USA 00023 * -----END-LICENCE----- 00024 */ 00025 00026 #ifndef OM_HGUARD_OMVALUEITERATOR_H 00027 #define OM_HGUARD_OMVALUEITERATOR_H 00028 00029 #include <iterator> 00030 #include <string> 00031 #include "om/omtypes.h" 00032 00033 class OmDocument; 00034 00037 class OmValueIterator { 00038 public: 00039 class Internal; 00041 Internal *internal; 00042 00043 private: 00044 friend class OmDocument; // So OmDocument can construct us 00045 00046 friend bool operator==(const OmValueIterator &a, const OmValueIterator &b); 00047 00048 OmValueIterator(Internal *internal_); 00049 00050 public: 00052 OmValueIterator(); 00053 00055 ~OmValueIterator(); 00056 00058 OmValueIterator(const OmValueIterator &other); 00059 00061 void operator=(const OmValueIterator &other); 00062 00063 OmValueIterator & operator++(); 00064 00065 void operator++(int); 00066 00068 const std::string & operator *() const; 00069 00071 const std::string * operator ->() const; 00072 00074 om_valueno get_valueno() const; 00075 00079 std::string get_description() const; 00080 00082 00083 typedef std::input_iterator_tag iterator_category; 00084 typedef std::string value_type; 00085 typedef om_valueno_diff difference_type; 00086 typedef std::string * pointer; 00087 typedef std::string & reference; 00089 }; 00090 00091 inline bool operator!=(const OmValueIterator &a, const OmValueIterator &b) 00092 { 00093 return !(a == b); 00094 } 00095 00096 #endif /* OM_HGUARD_OMVALUEITERATOR_H */