aboutsummaryrefslogtreecommitdiffstats
path: root/meowpp/oo/Properties.h
diff options
context:
space:
mode:
Diffstat (limited to 'meowpp/oo/Properties.h')
-rw-r--r--meowpp/oo/Properties.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/meowpp/oo/Properties.h b/meowpp/oo/Properties.h
new file mode 100644
index 0000000..f19e300
--- /dev/null
+++ b/meowpp/oo/Properties.h
@@ -0,0 +1,61 @@
+#ifndef oo_Properties_H__
+#define oo_Properties_H__
+
+#include "ObjBase.h"
+
+#include <map>
+#include <queue>
+
+#include <cstdlib>
+
+namespace meow{
+ class Properties: public ObjBase{
+ private:
+ struct Property{
+ ObjBase* _pointer;
+ ssize_t _counter;
+ //
+ Property(ObjBase* __pointer, bool __autoRemove);
+ Property(Property const& __property);
+ ~Property();
+ //
+ bool attach();
+ bool detach();
+ };
+ //
+ std::map<size_t, Property*> _properties;
+ std::map<std::string, size_t> _index;
+ std::queue<size_t> _freeIndex;
+ //
+ size_t newIndex(std::string const& __name);
+ void delIndex(size_t __index);
+ void detach(size_t __index);
+ public:
+ Properties();
+ Properties(Properties const& __p);
+ ~Properties();
+ //
+ void clear();
+ Properties& copy (Properties const& __p);
+ //
+ size_t size () const;
+ bool empty() const;
+ //
+ bool chg(size_t __index, ObjBase* __pointer, bool __autoRemove);
+ bool add(std::string __name , ObjBase* __pointer, bool __autoRemove);
+ bool del(size_t __index);
+ bool del(std::string __name );
+ ObjBase* get(size_t __index) const;
+ ObjBase* get(std::string __name ) const;
+ ssize_t getIndex(ObjBase* __pointer) const;
+ std::string getName (ObjBase* __pointer) const;
+ //
+ Properties& operator=(Properties const& __p);
+ ObjBase* operator()(size_t __index) const;
+ ObjBase* operator()(std::string __name ) const;
+ };
+}
+
+#include "Properties.hpp"
+
+#endif // oo_Properties_H__