blob: f19e300cfeff546cafd2ae81cec10228e62ab97d (
plain) (
tree)
|
|
#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__
|