00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00043 #ifndef ClearSilverNode_h_
00044 #define ClearSilverNode_h_ 1
00045
00046 #include <string>
00047 #include <boost/operators.hpp>
00048 #include "ClearSilverNodeComparator.h"
00049
00050 class _hdf;
00051 class _attr;
00052
00053 namespace ClearSilver
00054 {
00068 class ClearSilverNode : boost::equality_comparable<ClearSilverNode>
00069 {
00070 public:
00072 typedef _hdf HDF;
00073 typedef _attr HDF_ATTR;
00074
00075 private:
00076 HDF* node_;
00077
00078 public:
00080
00081
00082 ClearSilverNode ();
00095 explicit ClearSilverNode (HDF*);
00097 ClearSilverNode (const ClearSilverNode&);
00099 ~ClearSilverNode () throw();
00100
00102 ClearSilverNode& operator = (const ClearSilverNode& n);
00108 ClearSilverNode& operator = (const char* value);
00118 ClearSilverNode& operator = (const std::string&);
00124 ClearSilverNode& operator = (int);
00132 ClearSilverNode& operator = (bool);
00133
00134
00136
00138 bool empty () const;
00139
00140
00142
00144 operator bool () const;
00145
00146
00148
00150 std::string name () const;
00152 std::string value () const;
00153
00154
00161
00163 HDF* get () const;
00165 ClearSilverNode top () const;
00167 ClearSilverNode next () const;
00169 ClearSilverNode child () const;
00171 HDF_ATTR* attr () const;
00172
00173
00180
00181 std::string get_value (const std::string& key,
00182 const std::string& default_value) const;
00183 void set_value (const std::string& key, const std::string& value);
00184 void set_value (const std::string& key, int value);
00185 void set_value (const std::string& key, unsigned int value);
00186 void set_value (const std::string& key, bool value);
00187
00188 ClearSilverNode get_node (const std::string&);
00189 ClearSilverNode get_obj (const std::string&) const;
00190 ClearSilverNode get_child (const std::string&) const;
00191
00192 void remove_tree ();
00193 void remove_tree (const std::string&);
00194
00195 void read_file (const std::string&);
00196 void write_file (const std::string&) const;
00197 void dump (const std::string&) const;
00198
00206 void copy (const std::string&, const ClearSilverNode&);
00207
00208
00210 friend bool operator == (const ClearSilverNode&, const ClearSilverNode&);
00211
00218 static bool& debug ();
00219
00228
00230 static std::string Boolean (bool);
00232 static std::string True ();
00234 static std::string False ();
00235
00236
00238 void swap (ClearSilverNode&) throw();
00239
00241 void sort (ClearSilverNodeComparator::Ptr);
00242 };
00243 };
00244
00245 #endif