ConstHDF.h

Go to the documentation of this file.
00001 /* -*- c++ -*-
00002  * $Id: ConstHDF.h,v 1.9 2006/05/16 20:06:34 brook Exp $
00003  */
00004 
00005 /*
00006  * ClearSilver++ Software License.
00007  *
00008  * Copyright (c) 2005,2006 Brook Milligan <brook@nmsu.edu>
00009  * All rights reserved.
00010  * 
00011  * Redistribution and use in source and binary forms, with or without
00012  * modification, are permitted provided that the following conditions
00013  * are met:
00014  * 
00015  * 1. Redistributions of source code must retain the above copyright
00016  *    notice, this list of conditions and the following disclaimer.
00017  * 2. Redistributions in binary form must reproduce the above
00018  *    copyright notice, this list of conditions and the following
00019  *    disclaimer in the documentation and/or other materials provided
00020  *    with the distribution.
00021  * 3. The name of the author may not be used to endorse or promote
00022  *    products derived from this software without specific prior
00023  *    written permission.
00024  * 
00025  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
00026  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00027  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00028  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
00029  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00030  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00031  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00032  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00033  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036  */
00037 
00043 #ifndef ConstHDF_h_
00044 #define ConstHDF_h_ 1
00045 
00046 #include <string>
00047 #include <boost/operators.hpp>
00048 #include <boost/shared_ptr.hpp>
00049 #include "ClearSilverNode.h"
00050 #include "ConstHDFNode.h"
00051 #include "Nodes.h"
00052 #include "RootNode.h"
00053 
00054 namespace ClearSilver
00055 {
00056   class HDF;                    // forward declaration
00057 
00072   class ConstHDF : public ConstHDFNode, boost::equality_comparable<ConstHDF>
00073   {
00074     public:
00076       //\{
00077       typedef size_t size_type;
00078       struct input_iterator_tag {};
00079       struct forward_iterator_tag : public input_iterator_tag {};
00080       typedef forward_iterator_tag iterator_category;
00081       typedef ConstHDF value_type;
00082       typedef ptrdiff_t difference_type;
00083       typedef ConstHDF* pointer;
00084       typedef ConstHDF reference;
00085       typedef ConstHDF const_reference;
00086       typedef ConstHDF const_iterator;
00087       //\}
00088 
00089   public:
00091     //\{
00093     ConstHDF ();
00095     explicit ConstHDF (const char* path);
00097     explicit ConstHDF (const std::string& path);
00099     explicit ConstHDF (const RootNode&);
00101     explicit ConstHDF (const HDF&);
00103     ConstHDF (const ConstHDF&);
00105     ~ConstHDF () throw();
00106 
00108     ConstHDF& operator = (const ConstHDF&);
00109     //\}
00110 
00112     //\{
00114     size_type depth () const;
00116     std::string path () const;
00117     //\}
00118 
00120     //\{
00121     const_reference operator [] (const char* key) const;
00122     const_reference operator [] (const std::string&) const;
00123     //\}
00124 
00126     //\{
00127     const_iterator begin () const;
00128     const_iterator end () const;
00129 
00130     const_iterator find (const char* key) const;
00131     const_iterator find (const std::string& key) const;
00132     //\}
00133 
00139     //\{
00140     const_iterator& operator ++ ();
00141     const_iterator  operator ++ (int);
00149     value_type operator * ();
00156     pointer operator -> ();
00157     //\}
00158 
00160     virtual ClearSilverNode node () const;
00161 
00163     ClearSilverNode root () const;
00164 
00166     void swap (ConstHDF&) throw();
00167 
00169     friend bool operator == (const reference&, const reference&);
00170 
00177     static bool& debug ();
00178 
00179   protected:
00180     virtual Nodes::Nodes nodes () const;
00181     virtual Nodes::Nodes& nodes ();
00182     virtual void push (const Name&, const ClearSilverNode&);
00183     virtual void pop ();
00184     virtual ClearSilverNode top () const;
00185 
00186   private:
00187     typedef boost::shared_ptr<_hdf> Ptr;
00188 
00189   private:
00190     RootNode root_;
00191     Nodes nodes_;
00192   };
00193 };                              // namespace ClearSilver
00194 
00195 #endif

Generated on Tue May 16 14:50:52 2006 for ClearSilver C++ Library by  doxygen 1.4.5