[DEV] continue removing stl
This commit is contained in:
parent
f583c09c56
commit
1ecd94c470
@ -7,8 +7,8 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <vector>
|
#include <etk/Vector.hpp>
|
||||||
#include <map>
|
#include <etk/Map.hpp>
|
||||||
#include <eproperty/InterfaceData.hpp>
|
#include <eproperty/InterfaceData.hpp>
|
||||||
|
|
||||||
namespace eproperty {
|
namespace eproperty {
|
||||||
|
@ -31,7 +31,7 @@ void eproperty::InterfaceData::add(eproperty::Property* _pointerOnProperty) {
|
|||||||
EPROPERTY_CRITICAL("2 property can not have the same name ... ==> generate runtime error");
|
EPROPERTY_CRITICAL("2 property can not have the same name ... ==> generate runtime error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_list.push_back(_pointerOnProperty);
|
m_list.pushBack(_pointerOnProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
void eproperty::InterfaceData::clean() {
|
void eproperty::InterfaceData::clean() {
|
||||||
@ -41,7 +41,7 @@ void eproperty::InterfaceData::clean() {
|
|||||||
|
|
||||||
// Note no lock is needed at this level, because the lock is done is the upper elements ...
|
// Note no lock is needed at this level, because the lock is done is the upper elements ...
|
||||||
// the property set might be done with a pool of property, allone, the overhed is bigger ...
|
// the property set might be done with a pool of property, allone, the overhed is bigger ...
|
||||||
bool eproperty::InterfaceData::set(const std::string& _property, const std::string& _value) {
|
bool eproperty::InterfaceData::set(const etk::String& _property, const etk::String& _value) {
|
||||||
for (auto &it : m_list) {
|
for (auto &it : m_list) {
|
||||||
if( it != nullptr
|
if( it != nullptr
|
||||||
&& it->getName() == _property) {
|
&& it->getName() == _property) {
|
||||||
@ -53,7 +53,7 @@ bool eproperty::InterfaceData::set(const std::string& _property, const std::stri
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string eproperty::InterfaceData::get(const std::string& _property) const {
|
etk::String eproperty::InterfaceData::get(const etk::String& _property) const {
|
||||||
for (auto &it : m_list) {
|
for (auto &it : m_list) {
|
||||||
if( it != nullptr
|
if( it != nullptr
|
||||||
&& it->getName() == _property) {
|
&& it->getName() == _property) {
|
||||||
@ -67,9 +67,9 @@ void eproperty::InterfaceData::display(bool _changeOnly) const {
|
|||||||
EPROPERTY_INFO(" Object propertys:");
|
EPROPERTY_INFO(" Object propertys:");
|
||||||
for (auto &it : m_list) {
|
for (auto &it : m_list) {
|
||||||
if(it != nullptr) {
|
if(it != nullptr) {
|
||||||
std::string paramName = it->getName();
|
etk::String paramName = it->getName();
|
||||||
std::string paramVal = it->getString();
|
etk::String paramVal = it->getString();
|
||||||
std::string paramInfo = it->getInfo();
|
etk::String paramInfo = it->getInfo();
|
||||||
if ( _changeOnly == false
|
if ( _changeOnly == false
|
||||||
|| it->isDefault() == false) {
|
|| it->isDefault() == false) {
|
||||||
EPROPERTY_INFO(" | param='" << paramName << "' value=" << paramVal << " (" << paramInfo << ")");
|
EPROPERTY_INFO(" | param='" << paramName << "' value=" << paramVal << " (" << paramInfo << ")");
|
||||||
@ -80,15 +80,15 @@ void eproperty::InterfaceData::display(bool _changeOnly) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, std::string> eproperty::InterfaceData::getAll(bool _notIfDefault) const {
|
etk::Map<etk::String, etk::String> eproperty::InterfaceData::getAll(bool _notIfDefault) const {
|
||||||
std::map<std::string, std::string> out;
|
etk::Map<etk::String, etk::String> out;
|
||||||
for (auto &it : m_list) {
|
for (auto &it : m_list) {
|
||||||
if(it != nullptr) {
|
if(it != nullptr) {
|
||||||
std::string paramName = it->getName();
|
etk::String paramName = it->getName();
|
||||||
std::string paramVal = it->getString();
|
etk::String paramVal = it->getString();
|
||||||
if ( _notIfDefault == false
|
if ( _notIfDefault == false
|
||||||
|| it->isDefault() == false) {
|
|| it->isDefault() == false) {
|
||||||
out.insert(std::make_pair(paramName, paramVal));
|
out.insert(etk::makePair(paramName, paramVal));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ eproperty::Property* eproperty::InterfaceData::getRaw(const size_t& _id) const {
|
|||||||
return m_list[_id];
|
return m_list[_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
eproperty::Property* eproperty::InterfaceData::getRaw(const std::string _name) const {
|
eproperty::Property* eproperty::InterfaceData::getRaw(const etk::String _name) const {
|
||||||
for (auto &it : m_list) {
|
for (auto &it : m_list) {
|
||||||
if(it->getName() == _name) {
|
if(it->getName() == _name) {
|
||||||
return it;
|
return it;
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <vector>
|
#include <etk/Vector.hpp>
|
||||||
#include <map>
|
#include <etk/Map.hpp>
|
||||||
|
|
||||||
namespace eproperty {
|
namespace eproperty {
|
||||||
class Property;
|
class Property;
|
||||||
@ -18,7 +18,7 @@ namespace eproperty {
|
|||||||
*/
|
*/
|
||||||
class InterfaceData {
|
class InterfaceData {
|
||||||
private:
|
private:
|
||||||
std::vector<eproperty::Property*> m_list; //!< list of availlable Propertys (no need to free)
|
etk::Vector<eproperty::Property*> m_list; //!< list of availlable Propertys (no need to free)
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Constructor.
|
* @brief Constructor.
|
||||||
@ -46,13 +46,13 @@ namespace eproperty {
|
|||||||
* @return true Property update.
|
* @return true Property update.
|
||||||
* @return false Property not update.
|
* @return false Property not update.
|
||||||
*/
|
*/
|
||||||
bool set(const std::string& _property, const std::string& _value);
|
bool set(const etk::String& _property, const etk::String& _value);
|
||||||
/**
|
/**
|
||||||
* @brief Get a specific value of the property reference name.
|
* @brief Get a specific value of the property reference name.
|
||||||
* @param[in] _property The property string name.
|
* @param[in] _property The property string name.
|
||||||
* @return The value of the property (string).
|
* @return The value of the property (string).
|
||||||
*/
|
*/
|
||||||
std::string get(const std::string& _property) const;
|
etk::String get(const etk::String& _property) const;
|
||||||
/**
|
/**
|
||||||
* @brief Display all the property value with there name.
|
* @brief Display all the property value with there name.
|
||||||
* @param[in] _changeOnly check at true if the user want to display only property that are not at default value.
|
* @param[in] _changeOnly check at true if the user want to display only property that are not at default value.
|
||||||
@ -63,7 +63,7 @@ namespace eproperty {
|
|||||||
* @param[in] _notIfDefault if true the parameter value with default value are not extracted.
|
* @param[in] _notIfDefault if true the parameter value with default value are not extracted.
|
||||||
* @return map on the propertys
|
* @return map on the propertys
|
||||||
*/
|
*/
|
||||||
std::map<std::string, std::string> getAll(bool _notIfDefault=true) const;
|
etk::Map<etk::String, etk::String> getAll(bool _notIfDefault=true) const;
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Get count of propertys.
|
* @brief Get count of propertys.
|
||||||
@ -81,7 +81,7 @@ namespace eproperty {
|
|||||||
* @param[in] _name name of the property.
|
* @param[in] _name name of the property.
|
||||||
* @return pointer on the property.
|
* @return pointer on the property.
|
||||||
*/
|
*/
|
||||||
eproperty::Property* getRaw(const std::string _name) const;
|
eproperty::Property* getRaw(const etk::String _name) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <eproperty/PropertyType.hpp>
|
#include <eproperty/PropertyType.hpp>
|
||||||
#include <map>
|
#include <etk/Map.hpp>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
|
||||||
namespace eproperty {
|
namespace eproperty {
|
||||||
@ -17,7 +17,7 @@ namespace eproperty {
|
|||||||
*/
|
*/
|
||||||
template<class TYPE> class List : public PropertyType<TYPE> {
|
template<class TYPE> class List : public PropertyType<TYPE> {
|
||||||
private:
|
private:
|
||||||
std::map<std::string, TYPE> m_list; //!< pointer on the list of all elements.
|
etk::Map<etk::String, TYPE> m_list; //!< pointer on the list of all elements.
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Create a parameter with List of element parameter (nullptr if none).
|
* @brief Create a parameter with List of element parameter (nullptr if none).
|
||||||
@ -29,9 +29,9 @@ namespace eproperty {
|
|||||||
*/
|
*/
|
||||||
template<class CLASS_TYPE>
|
template<class CLASS_TYPE>
|
||||||
List(CLASS_TYPE* _owner,
|
List(CLASS_TYPE* _owner,
|
||||||
const std::string& _name,
|
const etk::String& _name,
|
||||||
const TYPE& _defaultValue,
|
const TYPE& _defaultValue,
|
||||||
const std::string& _description="",
|
const etk::String& _description="",
|
||||||
void (CLASS_TYPE::*_setObs)()=nullptr) :
|
void (CLASS_TYPE::*_setObs)()=nullptr) :
|
||||||
eproperty::PropertyType<TYPE>(_owner, _name, _defaultValue, _description, _setObs) {
|
eproperty::PropertyType<TYPE>(_owner, _name, _defaultValue, _description, _setObs) {
|
||||||
|
|
||||||
@ -54,19 +54,19 @@ namespace eproperty {
|
|||||||
* @param[in] _name String of the value
|
* @param[in] _name String of the value
|
||||||
* @param[in] _description Description of the parameter value
|
* @param[in] _description Description of the parameter value
|
||||||
*/
|
*/
|
||||||
void add(const TYPE& _value, const std::string& _name, const std::string& _description = "") {
|
void add(const TYPE& _value, const etk::String& _name, const etk::String& _description = "") {
|
||||||
auto it = m_list.find(_name);
|
auto it = m_list.find(_name);
|
||||||
if (it != m_list.end()) {
|
if (it != m_list.end()) {
|
||||||
it->second = _value;
|
it->second = _value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_list.insert(std::make_pair(_name, _value));
|
m_list.insert(etk::makePair(_name, _value));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Remove a value of the element availlable
|
* @brief Remove a value of the element availlable
|
||||||
* @param[in] _name Name of the value to remove
|
* @param[in] _name Name of the value to remove
|
||||||
*/
|
*/
|
||||||
void remove(const std::string& _name) {
|
void remove(const etk::String& _name) {
|
||||||
auto it = m_list.find(_name);
|
auto it = m_list.find(_name);
|
||||||
bool firstValue = false;
|
bool firstValue = false;
|
||||||
bool firstDefault = false;
|
bool firstDefault = false;
|
||||||
@ -98,7 +98,7 @@ namespace eproperty {
|
|||||||
* @param[in] _nameOld Old property name to replace
|
* @param[in] _nameOld Old property name to replace
|
||||||
* @param[in] _nameNew New name of the property
|
* @param[in] _nameNew New name of the property
|
||||||
*/
|
*/
|
||||||
void rename(const std::string& _nameOld, const std::string& _nameNew) {
|
void rename(const etk::String& _nameOld, const etk::String& _nameNew) {
|
||||||
//get old value
|
//get old value
|
||||||
TYPE value;
|
TYPE value;
|
||||||
auto it = m_list.find(_nameOld);
|
auto it = m_list.find(_nameOld);
|
||||||
@ -111,10 +111,10 @@ namespace eproperty {
|
|||||||
remove(_nameOld);
|
remove(_nameOld);
|
||||||
add(value, _nameNew);
|
add(value, _nameNew);
|
||||||
}
|
}
|
||||||
std::string getPropertyType() const override {
|
etk::String getPropertyType() const override {
|
||||||
return "eproperty::List";
|
return "eproperty::List";
|
||||||
}
|
}
|
||||||
void setString(const std::string& _newVal) override {
|
void setString(const etk::String& _newVal) override {
|
||||||
auto it = m_list.find(_newVal);
|
auto it = m_list.find(_newVal);
|
||||||
if (it != m_list.end()) {
|
if (it != m_list.end()) {
|
||||||
if (it->second != eproperty::PropertyType<TYPE>::m_value) {
|
if (it->second != eproperty::PropertyType<TYPE>::m_value) {
|
||||||
@ -130,17 +130,17 @@ namespace eproperty {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
std::string getInfo() const override {
|
etk::String getInfo() const override {
|
||||||
std::string list = "List default=" + getValueSpecific(eproperty::PropertyType<TYPE>::m_default) + " in : [";
|
etk::String list = "List default=" + getValueSpecific(eproperty::PropertyType<TYPE>::m_default) + " in : [";
|
||||||
for (auto &it : m_list) {
|
for (auto &it : m_list) {
|
||||||
list += it.first + "/";
|
list += it.first + "/";
|
||||||
}
|
}
|
||||||
return list + "]";
|
return list + "]";
|
||||||
}
|
}
|
||||||
std::vector<std::string> getListValue() const override {
|
etk::Vector<etk::String> getListValue() const override {
|
||||||
std::vector<std::string> out;
|
etk::Vector<etk::String> out;
|
||||||
for (auto &it : m_list) {
|
for (auto &it : m_list) {
|
||||||
out.push_back(it.first);
|
out.pushBack(it.first);
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ namespace eproperty {
|
|||||||
* @param[in] _intValue value that might be converted in string.
|
* @param[in] _intValue value that might be converted in string.
|
||||||
* @return the description string coresponding to this ID.
|
* @return the description string coresponding to this ID.
|
||||||
*/
|
*/
|
||||||
std::string getValueSpecific(const TYPE& _valueRequested) const override {
|
etk::String getValueSpecific(const TYPE& _valueRequested) const override {
|
||||||
for (auto &it : m_list) {
|
for (auto &it : m_list) {
|
||||||
if (it.second == _valueRequested) {
|
if (it.second == _valueRequested) {
|
||||||
return it.first;
|
return it.first;
|
||||||
@ -189,7 +189,7 @@ namespace eproperty {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
//! @not_in_doc
|
//! @not_in_doc
|
||||||
template<typename TYPE> std::ostream& operator <<(std::ostream& _os, const eproperty::List<TYPE>& _obj) {
|
template<typename TYPE> etk::Stream& operator <<(etk::Stream& _os, const eproperty::List<TYPE>& _obj) {
|
||||||
_os << _obj.get();
|
_os << _obj.get();
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include <eproperty/Property.hpp>
|
#include <eproperty/Property.hpp>
|
||||||
|
|
||||||
|
|
||||||
eproperty::Property::Property(eproperty::Interface* _paramInterfaceLink, const std::string& _name) :
|
eproperty::Property::Property(eproperty::Interface* _paramInterfaceLink, const etk::String& _name) :
|
||||||
m_interfaceLink(_paramInterfaceLink),
|
m_interfaceLink(_paramInterfaceLink),
|
||||||
m_setObserver(),
|
m_setObserver(),
|
||||||
m_name(_name) {
|
m_name(_name) {
|
||||||
@ -32,7 +32,7 @@ void eproperty::Property::setObserver(eproperty::Property::Observer _setObs) {
|
|||||||
m_setObserver = _setObs;
|
m_setObserver = _setObs;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string eproperty::Property::getName() const {
|
etk::String eproperty::Property::getName() const {
|
||||||
return m_name;
|
return m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <eproperty/Interface.hpp>
|
#include <eproperty/Interface.hpp>
|
||||||
#include <string>
|
#include <etk/String.hpp>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@ -26,14 +26,14 @@ namespace eproperty {
|
|||||||
private:
|
private:
|
||||||
eproperty::Interface* m_interfaceLink; //!< Base interface class to group all the property
|
eproperty::Interface* m_interfaceLink; //!< Base interface class to group all the property
|
||||||
Observer m_setObserver; //!< Observer of the changing value
|
Observer m_setObserver; //!< Observer of the changing value
|
||||||
std::string m_name; //!< Name of the property
|
etk::String m_name; //!< Name of the property
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Basic property elements
|
* @brief Basic property elements
|
||||||
* @param[in] _paramInterfaceLink Link on the esignal::Interface class to register parameter (can be nullptr)
|
* @param[in] _paramInterfaceLink Link on the esignal::Interface class to register parameter (can be nullptr)
|
||||||
* @param[in] _name Name of the parameter (must be unique if _paramInterfaceLink is define)
|
* @param[in] _name Name of the parameter (must be unique if _paramInterfaceLink is define)
|
||||||
*/
|
*/
|
||||||
Property(eproperty::Interface* _paramInterfaceLink, const std::string& _name);
|
Property(eproperty::Interface* _paramInterfaceLink, const etk::String& _name);
|
||||||
/**
|
/**
|
||||||
* @brief Basic property elements
|
* @brief Basic property elements
|
||||||
*/
|
*/
|
||||||
@ -58,37 +58,37 @@ namespace eproperty {
|
|||||||
* @brief Get the name of the Property.
|
* @brief Get the name of the Property.
|
||||||
* @return The name of the Property
|
* @return The name of the Property
|
||||||
*/
|
*/
|
||||||
virtual std::string getName() const;
|
virtual etk::String getName() const;
|
||||||
/**
|
/**
|
||||||
* @brief Description of the Propertys.
|
* @brief Description of the Propertys.
|
||||||
* @return Descriptive information of the Property (for remote UI).
|
* @return Descriptive information of the Property (for remote UI).
|
||||||
*/
|
*/
|
||||||
virtual std::string getInfo() const = 0;
|
virtual etk::String getInfo() const = 0;
|
||||||
/**
|
/**
|
||||||
* @brief Get the Property type of the class in string mode.
|
* @brief Get the Property type of the class in string mode.
|
||||||
* @return The string type of the Property.
|
* @return The string type of the Property.
|
||||||
*/
|
*/
|
||||||
virtual std::string getPropertyType() const = 0;
|
virtual etk::String getPropertyType() const = 0;
|
||||||
/**
|
/**
|
||||||
* @brief Get the type of the Property in string mode.
|
* @brief Get the type of the Property in string mode.
|
||||||
* @return The string type of the Property.
|
* @return The string type of the Property.
|
||||||
*/
|
*/
|
||||||
virtual std::string getType() const = 0;
|
virtual etk::String getType() const = 0;
|
||||||
/**
|
/**
|
||||||
* @brief Get the string of the current value of the Property.
|
* @brief Get the string of the current value of the Property.
|
||||||
* @return The string description of the value.
|
* @return The string description of the value.
|
||||||
*/
|
*/
|
||||||
virtual std::string getString() const = 0;
|
virtual etk::String getString() const = 0;
|
||||||
/**
|
/**
|
||||||
* @brief Get the string of the default value of the Property.
|
* @brief Get the string of the default value of the Property.
|
||||||
* @return the string decription of the default value.
|
* @return the string decription of the default value.
|
||||||
*/
|
*/
|
||||||
virtual std::string getDefault() const = 0;
|
virtual etk::String getDefault() const = 0;
|
||||||
/**
|
/**
|
||||||
* @brief Set a new value of the Property (with string interface).
|
* @brief Set a new value of the Property (with string interface).
|
||||||
* @param[in] _newVal New value of the Propertys.
|
* @param[in] _newVal New value of the Propertys.
|
||||||
*/
|
*/
|
||||||
virtual void setString(const std::string& _newVal) = 0;
|
virtual void setString(const etk::String& _newVal) = 0;
|
||||||
/**
|
/**
|
||||||
* @brief Check if the value is the default
|
* @brief Check if the value is the default
|
||||||
* @return true : the vakue is the default one, false otherwise.
|
* @return true : the vakue is the default one, false otherwise.
|
||||||
@ -102,8 +102,8 @@ namespace eproperty {
|
|||||||
* @brief Specific for eproperty::List to get all the possible values
|
* @brief Specific for eproperty::List to get all the possible values
|
||||||
* @return Descriptive information of the Property (for remote UI).
|
* @return Descriptive information of the Property (for remote UI).
|
||||||
*/
|
*/
|
||||||
virtual std::vector<std::string> getListValue() const {
|
virtual etk::Vector<etk::String> getListValue() const {
|
||||||
return std::vector<std::string>();
|
return etk::Vector<etk::String>();
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -30,9 +30,9 @@ namespace eproperty {
|
|||||||
*/
|
*/
|
||||||
template<class CLASS_TYPE>
|
template<class CLASS_TYPE>
|
||||||
PropertyType(CLASS_TYPE* _owner,
|
PropertyType(CLASS_TYPE* _owner,
|
||||||
const std::string& _name,
|
const etk::String& _name,
|
||||||
const TYPE& _defaultValue,
|
const TYPE& _defaultValue,
|
||||||
const std::string& _description = "",
|
const etk::String& _description = "",
|
||||||
void (CLASS_TYPE::*_setObs)()=nullptr) :
|
void (CLASS_TYPE::*_setObs)()=nullptr) :
|
||||||
Property(_owner, _name),
|
Property(_owner, _name),
|
||||||
m_value(_defaultValue),
|
m_value(_defaultValue),
|
||||||
@ -54,19 +54,19 @@ namespace eproperty {
|
|||||||
* @brief Destructor.
|
* @brief Destructor.
|
||||||
*/
|
*/
|
||||||
virtual ~PropertyType() = default;
|
virtual ~PropertyType() = default;
|
||||||
std::string getPropertyType() const override {
|
etk::String getPropertyType() const override {
|
||||||
return "eproperty::Value";
|
return "eproperty::Value";
|
||||||
}
|
}
|
||||||
std::string getType() const override {
|
etk::String getType() const override {
|
||||||
return typeid(TYPE).name();
|
return typeid(TYPE).name();
|
||||||
}
|
}
|
||||||
std::string getString() const override {
|
etk::String getString() const override {
|
||||||
return getValueSpecific(m_value);
|
return getValueSpecific(m_value);
|
||||||
}
|
}
|
||||||
std::string getDefault() const override {
|
etk::String getDefault() const override {
|
||||||
return getValueSpecific(m_default);
|
return getValueSpecific(m_default);
|
||||||
}
|
}
|
||||||
std::string getInfo() const override {
|
etk::String getInfo() const override {
|
||||||
return getType() + " default=" + getDefault();
|
return getType() + " default=" + getDefault();
|
||||||
}
|
}
|
||||||
bool isDefault() const override {
|
bool isDefault() const override {
|
||||||
@ -134,7 +134,7 @@ namespace eproperty {
|
|||||||
* @param[in] _valueRequested Value to convert in string
|
* @param[in] _valueRequested Value to convert in string
|
||||||
* @return convertion of the value in string.
|
* @return convertion of the value in string.
|
||||||
*/
|
*/
|
||||||
virtual std::string getValueSpecific(const TYPE& _valueRequested) const = 0;
|
virtual etk::String getValueSpecific(const TYPE& _valueRequested) const = 0;
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Const cast the property in the Type of the data
|
* @brief Const cast the property in the Type of the data
|
||||||
@ -165,7 +165,7 @@ namespace eproperty {
|
|||||||
PropertyType<TYPE>& operator= (const TYPE& _newVal) = delete;
|
PropertyType<TYPE>& operator= (const TYPE& _newVal) = delete;
|
||||||
};
|
};
|
||||||
//! @not_in_doc
|
//! @not_in_doc
|
||||||
template<typename TYPE> std::ostream& operator <<(std::ostream& _os, const eproperty::PropertyType<TYPE>& _obj) {
|
template<typename TYPE> etk::Stream& operator <<(etk::Stream& _os, const eproperty::PropertyType<TYPE>& _obj) {
|
||||||
_os << _obj.get();
|
_os << _obj.get();
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,11 @@ namespace eproperty {
|
|||||||
*/
|
*/
|
||||||
template<class CLASS_TYPE>
|
template<class CLASS_TYPE>
|
||||||
Range(CLASS_TYPE* _owner,
|
Range(CLASS_TYPE* _owner,
|
||||||
const std::string& _name,
|
const etk::String& _name,
|
||||||
const TYPE& _defaultValue,
|
const TYPE& _defaultValue,
|
||||||
const TYPE& _min,
|
const TYPE& _min,
|
||||||
const TYPE& _max,
|
const TYPE& _max,
|
||||||
const std::string& _description = "",
|
const etk::String& _description = "",
|
||||||
void (CLASS_TYPE::*_setObs)()=nullptr) :
|
void (CLASS_TYPE::*_setObs)()=nullptr) :
|
||||||
eproperty::Value<TYPE>(_owner, _name, _defaultValue, _description, _setObs),
|
eproperty::Value<TYPE>(_owner, _name, _defaultValue, _description, _setObs),
|
||||||
m_min(_min),
|
m_min(_min),
|
||||||
@ -59,15 +59,15 @@ namespace eproperty {
|
|||||||
* @brief Destructor.
|
* @brief Destructor.
|
||||||
*/
|
*/
|
||||||
virtual ~Range() = default;
|
virtual ~Range() = default;
|
||||||
std::string getPropertyType() const override;
|
etk::String getPropertyType() const override;
|
||||||
void setString(const std::string& _newVal) override;
|
void setString(const etk::String& _newVal) override;
|
||||||
std::string getInfo() const override;
|
etk::String getInfo() const override;
|
||||||
public:
|
public:
|
||||||
void set(const TYPE& _newVal) override;
|
void set(const TYPE& _newVal) override;
|
||||||
void setDirectCheck(const TYPE& _newVal) override;
|
void setDirectCheck(const TYPE& _newVal) override;
|
||||||
};
|
};
|
||||||
//! @not_in_doc
|
//! @not_in_doc
|
||||||
template<typename TYPE> std::ostream& operator <<(std::ostream& _os, const eproperty::Range<TYPE>& _obj) {
|
template<typename TYPE> etk::Stream& operator <<(etk::Stream& _os, const eproperty::Range<TYPE>& _obj) {
|
||||||
_os << _obj.get();
|
_os << _obj.get();
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,9 @@ namespace eproperty {
|
|||||||
*/
|
*/
|
||||||
template<class CLASS_TYPE>
|
template<class CLASS_TYPE>
|
||||||
Value(CLASS_TYPE* _owner,
|
Value(CLASS_TYPE* _owner,
|
||||||
const std::string& _name,
|
const etk::String& _name,
|
||||||
const TYPE& _defaultValue,
|
const TYPE& _defaultValue,
|
||||||
const std::string& _description = "",
|
const etk::String& _description = "",
|
||||||
void (CLASS_TYPE::*_setObs)()=nullptr) :
|
void (CLASS_TYPE::*_setObs)()=nullptr) :
|
||||||
eproperty::PropertyType<TYPE>(_owner, _name, _defaultValue, _description, _setObs) {
|
eproperty::PropertyType<TYPE>(_owner, _name, _defaultValue, _description, _setObs) {
|
||||||
|
|
||||||
@ -42,11 +42,11 @@ namespace eproperty {
|
|||||||
*/
|
*/
|
||||||
Value(const TYPE& _defaultValue);
|
Value(const TYPE& _defaultValue);
|
||||||
public:
|
public:
|
||||||
std::string getValueSpecific(const TYPE& _valueRequested) const override;
|
etk::String getValueSpecific(const TYPE& _valueRequested) const override;
|
||||||
void setString(const std::string& _newVal) override;
|
void setString(const etk::String& _newVal) override;
|
||||||
};
|
};
|
||||||
//! @not_in_doc
|
//! @not_in_doc
|
||||||
template<typename TYPE> std::ostream& operator <<(std::ostream& _os, const eproperty::Value<TYPE>& _obj) {
|
template<typename TYPE> etk::Stream& operator <<(etk::Stream& _os, const eproperty::Value<TYPE>& _obj) {
|
||||||
_os << _obj.get();
|
_os << _obj.get();
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
@ -23,12 +23,12 @@ eproperty::Range<TYPE>::Range(const TYPE& _defaultValue,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class TYPE>
|
template<class TYPE>
|
||||||
std::string eproperty::Range<TYPE>::getPropertyType() const {
|
etk::String eproperty::Range<TYPE>::getPropertyType() const {
|
||||||
return "eproperty::Range";
|
return "eproperty::Range";
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class TYPE>
|
template<class TYPE>
|
||||||
void eproperty::Range<TYPE>::setString(const std::string& _newVal) {
|
void eproperty::Range<TYPE>::setString(const etk::String& _newVal) {
|
||||||
TYPE val;
|
TYPE val;
|
||||||
// when you want to set an element in parameter you will implement the function template std::from_string
|
// when you want to set an element in parameter you will implement the function template std::from_string
|
||||||
etk::from_string(val, _newVal);
|
etk::from_string(val, _newVal);
|
||||||
@ -36,7 +36,7 @@ void eproperty::Range<TYPE>::setString(const std::string& _newVal) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class TYPE>
|
template<class TYPE>
|
||||||
std::string eproperty::Range<TYPE>::getInfo() const {
|
etk::String eproperty::Range<TYPE>::getInfo() const {
|
||||||
return eproperty::Value<TYPE>::getType() + " default=" + eproperty::Value<TYPE>::getDefault();
|
return eproperty::Value<TYPE>::getType() + " default=" + eproperty::Value<TYPE>::getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ void eproperty::Range<TYPE>::set(const TYPE& _newVal) {
|
|||||||
eproperty::Value<TYPE>::notifyChange();
|
eproperty::Value<TYPE>::notifyChange();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TYPE newVal = std::avg(m_min, _newVal, m_max);
|
TYPE newVal = etk::avg(m_min, _newVal, m_max);
|
||||||
if (newVal != eproperty::Value<TYPE>::m_value) {
|
if (newVal != eproperty::Value<TYPE>::m_value) {
|
||||||
eproperty::Value<TYPE>::m_value = newVal;
|
eproperty::Value<TYPE>::m_value = newVal;
|
||||||
eproperty::Value<TYPE>::notifyChange();
|
eproperty::Value<TYPE>::notifyChange();
|
||||||
@ -63,7 +63,7 @@ void eproperty::Range<TYPE>::setDirectCheck(const TYPE& _newVal) {
|
|||||||
eproperty::Value<TYPE>::m_value = _newVal;
|
eproperty::Value<TYPE>::m_value = _newVal;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TYPE newVal = std::avg(m_min, _newVal, m_max);
|
TYPE newVal = etk::avg(m_min, _newVal, m_max);
|
||||||
if (newVal != eproperty::Value<TYPE>::m_value) {
|
if (newVal != eproperty::Value<TYPE>::m_value) {
|
||||||
eproperty::Value<TYPE>::m_value = newVal;
|
eproperty::Value<TYPE>::m_value = newVal;
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
|
|
||||||
// void generic properties
|
// void generic properties
|
||||||
template class eproperty::Value<bool>;
|
template class eproperty::Value<bool>;
|
||||||
template class eproperty::Value<std::string>;
|
template class eproperty::Value<etk::String>;
|
||||||
#if __CPP_VERSION__ >= 2011
|
#if __CPP_VERSION__ >= 2011
|
||||||
template class eproperty::Value<std::u32string>;
|
template class eproperty::Value<etk::UString>;
|
||||||
#endif
|
#endif
|
||||||
template class eproperty::Value<int64_t>;
|
template class eproperty::Value<int64_t>;
|
||||||
template class eproperty::Value<int32_t>;
|
template class eproperty::Value<int32_t>;
|
||||||
|
@ -17,12 +17,12 @@ eproperty::Value<TYPE>::Value(const TYPE& _defaultValue) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class TYPE>
|
template<class TYPE>
|
||||||
std::string eproperty::Value<TYPE>::getValueSpecific(const TYPE& _valueRequested) const {
|
etk::String eproperty::Value<TYPE>::getValueSpecific(const TYPE& _valueRequested) const {
|
||||||
return etk::to_string(_valueRequested);
|
return etk::toString(_valueRequested);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class TYPE>
|
template<class TYPE>
|
||||||
void eproperty::Value<TYPE>::setString(const std::string& _newVal) {
|
void eproperty::Value<TYPE>::setString(const etk::String& _newVal) {
|
||||||
// when you want to set an element in parameter you will implement the function template std::from_string
|
// when you want to set an element in parameter you will implement the function template std::from_string
|
||||||
etk::from_string(eproperty::PropertyType<TYPE>::m_value, _newVal);
|
etk::from_string(eproperty::PropertyType<TYPE>::m_value, _newVal);
|
||||||
// TODO : Do it better ...
|
// TODO : Do it better ...
|
||||||
|
@ -51,7 +51,7 @@ def configure(target, my_module):
|
|||||||
])
|
])
|
||||||
my_module.add_path(".")
|
my_module.add_path(".")
|
||||||
my_module.add_flag('c++', [
|
my_module.add_flag('c++', [
|
||||||
"-DEPROPERTY_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\""
|
"-DEPROPERTY_VERSION=\"\\\"" + tools.version_toString(get_version()) + "\\\"\""
|
||||||
])
|
])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class sampleClassGroup : public eproperty::Interface {
|
|||||||
//! [eproperty_sample_declare_class_with_interface]
|
//! [eproperty_sample_declare_class_with_interface]
|
||||||
public:
|
public:
|
||||||
//! [eproperty_sample_declare_class_property_value]
|
//! [eproperty_sample_declare_class_property_value]
|
||||||
eproperty::Value<std::string> propertyValue; //!< Simple property Value with type string
|
eproperty::Value<etk::String> propertyValue; //!< Simple property Value with type string
|
||||||
//! [eproperty_sample_declare_class_property_value]
|
//! [eproperty_sample_declare_class_property_value]
|
||||||
//! [eproperty_sample_declare_class_property_list]
|
//! [eproperty_sample_declare_class_property_list]
|
||||||
eproperty::List<enum simpleEnum> propertyList; //!< Simple property List with type enumeration
|
eproperty::List<enum simpleEnum> propertyList; //!< Simple property List with type enumeration
|
||||||
@ -101,7 +101,7 @@ class sampleClassGroup : public eproperty::Interface {
|
|||||||
//! [eproperty_sample_class_without_interface]
|
//! [eproperty_sample_class_without_interface]
|
||||||
class sampleClassSolo {
|
class sampleClassSolo {
|
||||||
public:
|
public:
|
||||||
eproperty::Value<std::string> propertyValue;
|
eproperty::Value<etk::String> propertyValue;
|
||||||
eproperty::List<enum simpleEnum> propertyList;
|
eproperty::List<enum simpleEnum> propertyList;
|
||||||
eproperty::Range<int32_t> propertyRange;
|
eproperty::Range<int32_t> propertyRange;
|
||||||
sampleClassSolo():
|
sampleClassSolo():
|
||||||
|
@ -16,7 +16,7 @@ int main(int _argc, const char *_argv[]) {
|
|||||||
::testing::InitGoogleTest(&_argc, const_cast<char **>(_argv));
|
::testing::InitGoogleTest(&_argc, const_cast<char **>(_argv));
|
||||||
etk::init(_argc, _argv);
|
etk::init(_argc, _argv);
|
||||||
for (int32_t iii=0; iii<_argc ; ++iii) {
|
for (int32_t iii=0; iii<_argc ; ++iii) {
|
||||||
std::string data = _argv[iii];
|
etk::String data = _argv[iii];
|
||||||
if ( data == "-h"
|
if ( data == "-h"
|
||||||
|| data == "--help") {
|
|| data == "--help") {
|
||||||
TEST_PRINT("eproperty-test - help : ");
|
TEST_PRINT("eproperty-test - help : ");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user