[DEV] replace duplacate by clone
This commit is contained in:
parent
b3b7d90b41
commit
41c52147cd
@ -240,7 +240,7 @@ bool ejson::Array::transfertIn(std::shared_ptr<ejson::Value> _obj) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO : Manage error ...
|
// TODO : Manage error ...
|
||||||
std::shared_ptr<ejson::Value> ejson::Array::duplicate() const {
|
std::shared_ptr<ejson::Value> ejson::Array::clone() const {
|
||||||
std::shared_ptr<ejson::Array> output = ejson::Array::create();
|
std::shared_ptr<ejson::Array> output = ejson::Array::create();
|
||||||
if (output == nullptr) {
|
if (output == nullptr) {
|
||||||
JSON_ERROR("Allocation error ...");
|
JSON_ERROR("Allocation error ...");
|
||||||
@ -251,7 +251,7 @@ std::shared_ptr<ejson::Value> ejson::Array::duplicate() const {
|
|||||||
if (val == nullptr) {
|
if (val == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
output->add(val->duplicate());
|
output->add(val->clone());
|
||||||
}
|
}
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ namespace ejson {
|
|||||||
virtual bool iGenerate(std::string& _data, size_t _indent) const;
|
virtual bool iGenerate(std::string& _data, size_t _indent) const;
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
virtual bool transfertIn(std::shared_ptr<ejson::Value> _obj);
|
virtual bool transfertIn(std::shared_ptr<ejson::Value> _obj);
|
||||||
virtual std::shared_ptr<ejson::Value> duplicate() const;
|
virtual std::shared_ptr<ejson::Value> clone() const;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ bool ejson::Boolean::transfertIn(std::shared_ptr<ejson::Value> _obj) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<ejson::Value> ejson::Boolean::duplicate() const {
|
std::shared_ptr<ejson::Value> ejson::Boolean::clone() const {
|
||||||
std::shared_ptr<ejson::Boolean> output = ejson::Boolean::create(m_value);
|
std::shared_ptr<ejson::Boolean> output = ejson::Boolean::create(m_value);
|
||||||
if (output == nullptr) {
|
if (output == nullptr) {
|
||||||
JSON_ERROR("Allocation error ...");
|
JSON_ERROR("Allocation error ...");
|
||||||
|
@ -51,7 +51,7 @@ namespace ejson {
|
|||||||
virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
||||||
virtual bool iGenerate(std::string& _data, size_t _indent) const;
|
virtual bool iGenerate(std::string& _data, size_t _indent) const;
|
||||||
virtual bool transfertIn(std::shared_ptr<ejson::Value> _obj);
|
virtual bool transfertIn(std::shared_ptr<ejson::Value> _obj);
|
||||||
virtual std::shared_ptr<ejson::Value> duplicate() const;
|
virtual std::shared_ptr<ejson::Value> clone() const;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ bool ejson::Null::transfertIn(std::shared_ptr<ejson::Value> _obj) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<ejson::Value> ejson::Null::duplicate() const {
|
std::shared_ptr<ejson::Value> ejson::Null::clone() const {
|
||||||
std::shared_ptr<ejson::Null> output = ejson::Null::create();
|
std::shared_ptr<ejson::Null> output = ejson::Null::create();
|
||||||
if (output == nullptr) {
|
if (output == nullptr) {
|
||||||
JSON_ERROR("Allocation error ...");
|
JSON_ERROR("Allocation error ...");
|
||||||
|
@ -29,7 +29,7 @@ namespace ejson {
|
|||||||
virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
||||||
virtual bool iGenerate(std::string& _data, size_t _indent) const;
|
virtual bool iGenerate(std::string& _data, size_t _indent) const;
|
||||||
virtual bool transfertIn(std::shared_ptr<ejson::Value> _obj);
|
virtual bool transfertIn(std::shared_ptr<ejson::Value> _obj);
|
||||||
virtual std::shared_ptr<ejson::Value> duplicate() const;
|
virtual std::shared_ptr<ejson::Value> clone() const;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ bool ejson::Number::transfertIn(std::shared_ptr<ejson::Value> _obj) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<ejson::Value> ejson::Number::duplicate() const {
|
std::shared_ptr<ejson::Value> ejson::Number::clone() const {
|
||||||
std::shared_ptr<ejson::Number> output = ejson::Number::create(m_value);
|
std::shared_ptr<ejson::Number> output = ejson::Number::create(m_value);
|
||||||
if (output == nullptr) {
|
if (output == nullptr) {
|
||||||
JSON_ERROR("Allocation error ...");
|
JSON_ERROR("Allocation error ...");
|
||||||
|
@ -63,7 +63,7 @@ namespace ejson {
|
|||||||
virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
||||||
virtual bool iGenerate(std::string& _data, size_t _indent) const;
|
virtual bool iGenerate(std::string& _data, size_t _indent) const;
|
||||||
virtual bool transfertIn(std::shared_ptr<ejson::Value> _obj);
|
virtual bool transfertIn(std::shared_ptr<ejson::Value> _obj);
|
||||||
virtual std::shared_ptr<ejson::Value> duplicate() const;
|
virtual std::shared_ptr<ejson::Value> clone() const;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ bool ejson::Object::transfertIn(std::shared_ptr<ejson::Value> _obj) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO : Manage error ...
|
// TODO : Manage error ...
|
||||||
std::shared_ptr<ejson::Value> ejson::Object::duplicate() const {
|
std::shared_ptr<ejson::Value> ejson::Object::clone() const {
|
||||||
std::shared_ptr<ejson::Object> output = ejson::Object::create();
|
std::shared_ptr<ejson::Object> output = ejson::Object::create();
|
||||||
if (output == nullptr) {
|
if (output == nullptr) {
|
||||||
JSON_ERROR("Allocation error ...");
|
JSON_ERROR("Allocation error ...");
|
||||||
@ -484,7 +484,7 @@ std::shared_ptr<ejson::Value> ejson::Object::duplicate() const {
|
|||||||
if (val == nullptr) {
|
if (val == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
output->add(key, val->duplicate());
|
output->add(key, val->clone());
|
||||||
}
|
}
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ namespace ejson {
|
|||||||
virtual bool iGenerate(std::string& _data, size_t _indent) const;
|
virtual bool iGenerate(std::string& _data, size_t _indent) const;
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
virtual bool transfertIn(std::shared_ptr<ejson::Value> _obj);
|
virtual bool transfertIn(std::shared_ptr<ejson::Value> _obj);
|
||||||
virtual std::shared_ptr<ejson::Value> duplicate() const;
|
virtual std::shared_ptr<ejson::Value> clone() const;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ bool ejson::String::transfertIn(std::shared_ptr<ejson::Value> _obj) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<ejson::Value> ejson::String::duplicate() const {
|
std::shared_ptr<ejson::Value> ejson::String::clone() const {
|
||||||
std::shared_ptr<ejson::String> output = ejson::String::create(m_value);
|
std::shared_ptr<ejson::String> output = ejson::String::create(m_value);
|
||||||
if (output == nullptr) {
|
if (output == nullptr) {
|
||||||
JSON_ERROR("Allocation error ...");
|
JSON_ERROR("Allocation error ...");
|
||||||
|
@ -49,7 +49,7 @@ namespace ejson {
|
|||||||
virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
||||||
virtual bool iGenerate(std::string& _data, size_t _indent) const;
|
virtual bool iGenerate(std::string& _data, size_t _indent) const;
|
||||||
virtual bool transfertIn(std::shared_ptr<ejson::Value> _obj);
|
virtual bool transfertIn(std::shared_ptr<ejson::Value> _obj);
|
||||||
virtual std::shared_ptr<ejson::Value> duplicate() const;
|
virtual std::shared_ptr<ejson::Value> clone() const;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ namespace ejson {
|
|||||||
* @brief Copy the curent node and all the child in the curent one.
|
* @brief Copy the curent node and all the child in the curent one.
|
||||||
* @return nullptr in an error occured, the pointer on the element otherwise
|
* @return nullptr in an error occured, the pointer on the element otherwise
|
||||||
*/
|
*/
|
||||||
virtual std::shared_ptr<ejson::Value> duplicate() const {
|
virtual std::shared_ptr<ejson::Value> clone() const {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user