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 #ifndef OST_INFO_GROUP_H
00029 #define OST_INFO_GROUP_H
00030
00031 #include <vector>
00032 #include <ost/base.hh>
00033 #include <ost/geom/geom.hh>
00034 #include "info_fw.hh"
00035 #include "info_handle.hh"
00036 #include "info_impl_fw.hh"
00037
00038 namespace ost { namespace info {
00039
00040 class DLLEXPORT InfoGroup {
00041 friend class InfoHandle;
00042 friend class InfoItem;
00043 public:
00044
00046 InfoGroup GetParent() const;
00047
00049 void SetName(const String& name);
00051 String GetName() const;
00052
00054 InfoPath GetPath() const;
00055
00056 InfoGroup GetGroup(const InfoPath& path, bool use_defaults=true) const;
00057
00058 InfoGroupList GetGroups(const InfoPath& path) const;
00059
00060 InfoItemList GetItems(const InfoPath& path) const;
00061
00062 InfoGroup CreateGroup(const String& name);
00063 bool HasGroup(const InfoPath& name, bool use_defaults=true) const;
00064 InfoGroup RetrieveGroup(const InfoPath& path, bool use_defaults=true);
00065
00066 InfoItem GetItem(const InfoPath& path, bool use_defaults=true) const;
00067 InfoItem CreateItem(const String& name, const String& value);
00068 InfoItem CreateItem(const String& name, Real value);
00069 InfoItem CreateItem(const String& name, bool value);
00070 InfoItem CreateItem(const String& name, int value);
00071 InfoItem CreateItem(const String& name, const geom::Vec3& vector);
00072 bool HasItem(const InfoPath& path, bool use_defaults=true) const;
00073 InfoItem RetrieveItem(const InfoPath& path, bool use_defaults=true);
00074
00075 void Remove(const InfoPath& path, bool use_defaults=false);
00076 void Remove(const InfoGroup& group);
00077
00078
00080 String GetAttribute(const String& name) const;
00082 void SetAttribute(const String& name, const String& value);
00084 bool HasAttribute(const String& name) const;
00086 void RemoveAttribute(const String& name);
00087
00088 std::vector<String> GetAttributeList() const;
00089
00090 String GetTextData() const;
00091 void SetTextData(const String& td);
00092
00094
00097 void Apply(InfoVisitor& v, bool visit_this=true);
00098 void Apply(InfoConstVisitor& v, bool visit_this=true) const;
00099
00100 bool operator==(const InfoGroup& ref) const;
00101 bool operator!=(const InfoGroup& ref) const;
00102 private:
00103 void Swap(InfoGroup& group);
00104 InfoGroup(const InfoHandle& root, const ElePtr& impl);
00105
00106 bool do_group_lookup(std::vector<String>::const_iterator& pos,
00107 const std::vector<String>::const_iterator& end,
00108 InfoGroupList& subgroups) const;
00109 bool do_group_lookup(std::vector<String>::const_iterator& pos,
00110 const std::vector<String>::const_iterator& end,
00111 InfoGroup& subgroup) const;
00112
00113 InfoGroup group_create(InfoGroup group,
00114 std::vector<String>::const_iterator& pos,
00115 const std::vector<String>::const_iterator& end);
00116
00117 InfoHandle root_;
00118 ElePtr impl_;
00119 };
00120
00121 }}
00122
00123 #endif