[DEV] Add a function to specify the type of the parameter

This commit is contained in:
Edouard DUPIN 2016-01-28 22:47:03 +01:00
parent e91da861a6
commit 01ca0392fe
6 changed files with 46 additions and 0 deletions

View File

@ -87,3 +87,17 @@ std::map<std::string, std::string> ewol::parameter::Interface::parameterGetAll(b
}
return out;
}
size_t ewol::parameter::Interface::getParameterCount() const {
return m_list.size();
}
ewol::parameter::Parameter* ewol::parameter::Interface::getParameterRaw(const size_t& _id) const {
if (_id >= m_list.size()) {
EWOL_ERROR("Wrong ID for parameter list. " << _id << " >= " << m_list.size());
return nullptr;
}
return m_list[_id];
}

View File

@ -70,6 +70,21 @@ namespace ewol {
* @return map on the parameters
*/
std::map<std::string, std::string> parameterGetAll(bool _notIfDefault=true) const;
public:
/**
* @brief Get count of parameters.
* @return The number of the parameter.
*/
size_t getParameterCount() const;
/**
* @brief Get name of a parameters.
* @return _id Id of the parameter.
* @return pointer on the parameter.
*/
ewol::parameter::Parameter* getParameterRaw(const size_t& _id) const;
};
};
};

View File

@ -52,6 +52,10 @@ namespace ewol {
m_list.insert(std::make_pair(_name, _value));
}
// herited methode
virtual std::string getParameterType() const {
return "ewol::parameter::List";
}
// herited methode
virtual std::string getType() const {
return typeid(MY_TYPE).name();
}

View File

@ -35,6 +35,11 @@ namespace ewol {
virtual std::string getName() const {
return m_name;
};
/**
* @brief Get the parameter type of the class in string mode.
* @return The string type of the parameter.
*/
virtual std::string getParameterType() const = 0;
/**
* @brief Get the type of the parameter in string mode.
* @return The string type of the parameter.

View File

@ -50,6 +50,10 @@ namespace ewol {
*/
virtual ~Range() { };
// herited methode
virtual std::string getParameterType() const {
return "ewol::parameter::Range";
}
// herited methode
virtual std::string getType() const {
return typeid(MY_TYPE).name();
}

View File

@ -52,6 +52,10 @@ namespace ewol {
*/
virtual ~Value() { };
// herited methode
virtual std::string getParameterType() const {
return "ewol::parameter::Value";
}
// herited methode
virtual std::string getType() const {
return typeid(MY_TYPE).name();
}