std::string getvalType(bool val) {return "bool";}
std::string getvalType(std::string val) {return "string";}
public:
std::string _name; // 属性的名称
std::string _defaultVal; // 默认值
std::string _describe; // 描述
std::vector
};
#endif
myProperty.cpp
[cpp]
#include "myProperty.h"
myPropertySet.h
[cpp]
// 王智泉
// 属性集
#ifndef __myPropertySet__H__
#define __myPropertySet__H__
#include
#include
myPropertySet.cpp
[cpp]
#include "myPropertySet.h"
#include "myProperty.h"
#include
// ================================================================
myPropertySet::myPropertySet(void)
{
}
// ================================================================
myPropertySet::~myPropertySet(void)
{
}
// ================================================================
void myPropertySet::registerProperty_impl(myProperty * pty)
{
_ptysList[pty->_name] = pty;
}
// ================================================================
void myPropertySet::setProperty(const std::string& name, const std::string& val)
{
myPropertySet::PropertyList::iterator pos = _ptysList.find(name);
if (pos != _ptysList.end())
{
pos->second->setter(this, val);
}
}
// ================================================================
std::string myPropertySet::getProperty(const std::string& name) const
{
myPropertySet::PropertyList::const_iterator pos = _ptysList.find(name);
assert(pos != _ptysList.end());
return pos->second->getter(this);
}
// ================================================================
myProperty* myPropertySet::getPropertyPtr(const std::string& name)
{
myPropertySet::PropertyList::const_iterator pos = _ptysList.find(name);
if (pos != _ptysList.end())
return pos->second;
return NULL;
}
// ================================================================
std::string myPropertySet::getPropertyValueType(const std::string& name) const
{
myPropertySet::PropertyList::const_iterator pos = _ptysList.find(name);
as