diff --git a/ege/Environement.cpp b/ege/Environement.cpp index cc07d10..202b1f2 100644 --- a/ege/Environement.cpp +++ b/ege/Environement.cpp @@ -165,16 +165,16 @@ std::shared_ptr ege::Environement::createElement(const std::string return tmpElement; } -std::shared_ptr ege::Environement::createElement(const std::string& _type, std::string& _description, bool _autoAddElement) { - return createElement(_type, _autoAddElement, ege::typeString, static_cast(&_description)); +std::shared_ptr ege::Environement::createElement(const std::string& _type, std::shared_ptr _description, bool _autoAddElement) { + return createElement(_type, _autoAddElement, ege::typeString, std::static_pointer_cast(&_description)); } -std::shared_ptr ege::Environement::createElement(const std::string& _type, ejson::Value* _value, bool _autoAddElement) { - return createElement(_type, _autoAddElement, ege::typeJson, static_cast(_value)); +std::shared_ptr ege::Environement::createElement(const std::string& _type, std::shared_ptr _value, bool _autoAddElement) { + return createElement(_type, _autoAddElement, ege::typeJson, std::static_pointer_cast(_value)); } -std::shared_ptr ege::Environement::createElement(const std::string& _type, exml::Node* _node, bool _autoAddElement) { - return createElement(_type, _autoAddElement, ege::typeXml, static_cast(_node)); +std::shared_ptr ege::Environement::createElement(const std::string& _type, std::shared_ptr _node, bool _autoAddElement) { + return createElement(_type, _autoAddElement, ege::typeXml, std::static_pointer_cast(_node)); } diff --git a/ege/Environement.h b/ege/Environement.h index f1006ec..009ff02 100644 --- a/ege/Environement.h +++ b/ege/Environement.h @@ -177,10 +177,10 @@ namespace ege { * @return nullptr if an error occured OR the pointer on the element and it is already added on the system. * @note Pointer is return in case of setting properties on it... */ - std::shared_ptr createElement(const std::string& _type, bool _autoAddElement=true, enum ege::property _property=ege::typeNone, void* _value=nullptr); - std::shared_ptr createElement(const std::string& _type, std::string& _description, bool _autoAddElement=true); - std::shared_ptr createElement(const std::string& _type, ejson::Value* _value, bool _autoAddElement=true); - std::shared_ptr createElement(const std::string& _type, exml::Node* _node, bool _autoAddElement=true); + std::shared_ptr createElement(const std::string& _type, bool _autoAddElement=true, enum ege::property _property=ege::typeNone, std::shared_ptr _value=nullptr); + std::shared_ptr createElement(const std::string& _type, std::shared_ptr _description, bool _autoAddElement=true); + std::shared_ptr createElement(const std::string& _type, std::shared_ptr _value, bool _autoAddElement=true); + std::shared_ptr createElement(const std::string& _type, std::shared_ptr _node, bool _autoAddElement=true); public: class ResultNearestElement { public: diff --git a/ege/elements/Element.h b/ege/elements/Element.h index 8cef1b6..71f06fe 100644 --- a/ege/elements/Element.h +++ b/ege/elements/Element.h @@ -54,7 +54,7 @@ namespace ege { * @param[in] _value pointer on the value type * @return true, the element is corectly initialized. */ - virtual bool init(enum property _property, void* _value) { + virtual bool init(enum property _property, std::shared_ptr _value) { return false; }; virtual bool unInit() {