[DEV] cahnge level from error to debug when interface try to get on a nullptr
This commit is contained in:
parent
e406ea7a7e
commit
1d53d2b966
@ -39,7 +39,7 @@ ejson::Array& ejson::Array::operator= (const ejson::Array& _obj) {
|
||||
|
||||
size_t ejson::Array::size() const {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not size (nullptr) ...");
|
||||
EJSON_DEBUG("Can not size (nullptr) ...");
|
||||
return 0;
|
||||
}
|
||||
return static_cast<const ejson::internal::Array*>(m_data.get())->size();
|
||||
@ -47,7 +47,7 @@ size_t ejson::Array::size() const {
|
||||
|
||||
ejson::Value ejson::Array::operator[] (size_t _id) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not get (nullptr) ...");
|
||||
EJSON_DEBUG("Can not get (nullptr) ...");
|
||||
return ejson::Value(nullptr);
|
||||
}
|
||||
return ejson::Value(static_cast<ejson::internal::Array*>(m_data.get())->get(_id));
|
||||
@ -55,7 +55,7 @@ ejson::Value ejson::Array::operator[] (size_t _id) {
|
||||
|
||||
const ejson::Value ejson::Array::operator[] (size_t _id) const {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not get (nullptr) ...");
|
||||
EJSON_DEBUG("Can not get (nullptr) ...");
|
||||
return ejson::Value(nullptr);;
|
||||
}
|
||||
return ejson::Value(static_cast<const ejson::internal::Array*>(m_data.get())->get(_id));
|
||||
@ -63,7 +63,7 @@ const ejson::Value ejson::Array::operator[] (size_t _id) const {
|
||||
|
||||
bool ejson::Array::add(const ejson::Value& _element) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not add (nullptr) ...");
|
||||
EJSON_DEBUG("Can not add (nullptr) ...");
|
||||
return false;
|
||||
}
|
||||
return static_cast<ejson::internal::Array*>(m_data.get())->add(_element.m_data);
|
||||
@ -71,7 +71,7 @@ bool ejson::Array::add(const ejson::Value& _element) {
|
||||
|
||||
void ejson::Array::remove(size_t _id) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not remove (nullptr) ...");
|
||||
EJSON_DEBUG("Can not remove (nullptr) ...");
|
||||
return;
|
||||
}
|
||||
static_cast<ejson::internal::Array*>(m_data.get())->remove(_id);
|
||||
@ -79,7 +79,7 @@ void ejson::Array::remove(size_t _id) {
|
||||
|
||||
ejson::Array::iterator ejson::Array::remove(const ejson::Array::iterator& _it) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not remove (nullptr) ...");
|
||||
EJSON_DEBUG("Can not remove (nullptr) ...");
|
||||
return _it;
|
||||
}
|
||||
static_cast<ejson::internal::Array*>(m_data.get())->remove(_it.getId());
|
||||
|
@ -37,7 +37,7 @@ ejson::Boolean& ejson::Boolean::operator= (const ejson::Boolean& _obj) {
|
||||
|
||||
void ejson::Boolean::set(bool _value) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not set (nullptr) ...");
|
||||
EJSON_DEBUG("Can not set (nullptr) ...");
|
||||
return;
|
||||
}
|
||||
static_cast<ejson::internal::Boolean*>(m_data.get())->set(_value);
|
||||
@ -45,7 +45,7 @@ void ejson::Boolean::set(bool _value) {
|
||||
|
||||
bool ejson::Boolean::get(bool _errorValue) const {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not get (nullptr) ...");
|
||||
EJSON_DEBUG("Can not get (nullptr) ...");
|
||||
return _errorValue;
|
||||
}
|
||||
return static_cast<const ejson::internal::Boolean*>(m_data.get())->get();
|
||||
|
@ -36,7 +36,7 @@ ejson::Document& ejson::Document::operator= (const ejson::Document& _obj) {
|
||||
|
||||
bool ejson::Document::parse(const std::string& _data) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not parse (nullptr) ...");
|
||||
EJSON_DEBUG("Can not parse (nullptr) ...");
|
||||
return false;
|
||||
}
|
||||
return static_cast<ejson::internal::Document*>(m_data.get())->parse(_data);
|
||||
@ -44,7 +44,7 @@ bool ejson::Document::parse(const std::string& _data) {
|
||||
|
||||
bool ejson::Document::generate(std::string& _data) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not generate (nullptr) ...");
|
||||
EJSON_DEBUG("Can not generate (nullptr) ...");
|
||||
return false;
|
||||
}
|
||||
return static_cast<ejson::internal::Document*>(m_data.get())->generate(_data);
|
||||
@ -52,7 +52,7 @@ bool ejson::Document::generate(std::string& _data) {
|
||||
|
||||
bool ejson::Document::load(const std::string& _file) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not load (nullptr) ...");
|
||||
EJSON_DEBUG("Can not load (nullptr) ...");
|
||||
return false;
|
||||
}
|
||||
return static_cast<ejson::internal::Document*>(m_data.get())->load(_file);
|
||||
@ -60,7 +60,7 @@ bool ejson::Document::load(const std::string& _file) {
|
||||
|
||||
bool ejson::Document::store(const std::string& _file) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not store (nullptr) ...");
|
||||
EJSON_DEBUG("Can not store (nullptr) ...");
|
||||
return false;
|
||||
}
|
||||
return static_cast<ejson::internal::Document*>(m_data.get())->store(_file);
|
||||
@ -68,7 +68,7 @@ bool ejson::Document::store(const std::string& _file) {
|
||||
|
||||
bool ejson::Document::storeSafe(const std::string& _file) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not store (nullptr) ...");
|
||||
EJSON_DEBUG("Can not store (nullptr) ...");
|
||||
return false;
|
||||
}
|
||||
bool done = static_cast<ejson::internal::Document*>(m_data.get())->store(_file+".tmp");
|
||||
@ -80,7 +80,7 @@ bool ejson::Document::storeSafe(const std::string& _file) {
|
||||
|
||||
void ejson::Document::setDisplayError(bool _value){
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not setDisplayError (nullptr) ...");
|
||||
EJSON_DEBUG("Can not setDisplayError (nullptr) ...");
|
||||
return;
|
||||
}
|
||||
static_cast<ejson::internal::Document*>(m_data.get())->setDisplayError(_value);
|
||||
@ -88,7 +88,7 @@ void ejson::Document::setDisplayError(bool _value){
|
||||
|
||||
bool ejson::Document::getDisplayError() {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not getDisplayError (nullptr) ...");
|
||||
EJSON_DEBUG("Can not getDisplayError (nullptr) ...");
|
||||
return false;
|
||||
}
|
||||
return static_cast<ejson::internal::Document*>(m_data.get())->getDisplayError();
|
||||
@ -96,7 +96,7 @@ bool ejson::Document::getDisplayError() {
|
||||
|
||||
void ejson::Document::displayError() {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not displayError (nullptr) ...");
|
||||
EJSON_DEBUG("Can not displayError (nullptr) ...");
|
||||
return;
|
||||
}
|
||||
static_cast<ejson::internal::Document*>(m_data.get())->displayError();
|
||||
|
@ -36,7 +36,7 @@ ejson::Number& ejson::Number::operator= (const ejson::Number& _obj) {
|
||||
|
||||
void ejson::Number::set(double _value) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not set (nullptr) ...");
|
||||
EJSON_DEBUG("Can not set (nullptr) ...");
|
||||
return;
|
||||
}
|
||||
static_cast<ejson::internal::Number*>(m_data.get())->set(_value);
|
||||
@ -44,7 +44,7 @@ void ejson::Number::set(double _value) {
|
||||
|
||||
void ejson::Number::set(uint64_t _value) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not set (nullptr) ...");
|
||||
EJSON_DEBUG("Can not set (nullptr) ...");
|
||||
return;
|
||||
}
|
||||
static_cast<ejson::internal::Number*>(m_data.get())->set(_value);
|
||||
@ -52,7 +52,7 @@ void ejson::Number::set(uint64_t _value) {
|
||||
|
||||
void ejson::Number::set(int64_t _value) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not set (nullptr) ...");
|
||||
EJSON_DEBUG("Can not set (nullptr) ...");
|
||||
return;
|
||||
}
|
||||
static_cast<ejson::internal::Number*>(m_data.get())->set(_value);
|
||||
@ -60,7 +60,7 @@ void ejson::Number::set(int64_t _value) {
|
||||
|
||||
double ejson::Number::get(double _errorValue) const {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not get (nullptr) ...");
|
||||
EJSON_DEBUG("Can not get (nullptr) ...");
|
||||
return _errorValue;
|
||||
}
|
||||
return static_cast<const ejson::internal::Number*>(m_data.get())->get();
|
||||
@ -68,7 +68,7 @@ double ejson::Number::get(double _errorValue) const {
|
||||
|
||||
uint64_t ejson::Number::getU64(uint64_t _errorValue) const {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not get (nullptr) ...");
|
||||
EJSON_DEBUG("Can not get (nullptr) ...");
|
||||
return _errorValue;
|
||||
}
|
||||
return static_cast<const ejson::internal::Number*>(m_data.get())->getU64();
|
||||
@ -76,7 +76,7 @@ uint64_t ejson::Number::getU64(uint64_t _errorValue) const {
|
||||
|
||||
int64_t ejson::Number::getI64(int64_t _errorValue) const {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not get (nullptr) ...");
|
||||
EJSON_DEBUG("Can not get (nullptr) ...");
|
||||
return _errorValue;
|
||||
}
|
||||
return static_cast<const ejson::internal::Number*>(m_data.get())->getI64();
|
||||
@ -84,7 +84,7 @@ int64_t ejson::Number::getI64(int64_t _errorValue) const {
|
||||
|
||||
ejson::internal::Number::type ejson::Number::getType() const {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not get (nullptr) ...");
|
||||
EJSON_DEBUG("Can not get (nullptr) ...");
|
||||
return ejson::internal::Number::type::tDouble;
|
||||
}
|
||||
return static_cast<const ejson::internal::Number*>(m_data.get())->getType();
|
||||
|
@ -43,7 +43,7 @@ ejson::Object& ejson::Object::operator= (const ejson::Object& _obj) {
|
||||
|
||||
bool ejson::Object::valueExist(const std::string& _name) const {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not exist (nullptr) ...");
|
||||
EJSON_DEBUG("Can not exist (nullptr) ...");
|
||||
return false;
|
||||
}
|
||||
return static_cast<const ejson::internal::Object*>(m_data.get())->exist(_name);
|
||||
@ -51,7 +51,7 @@ bool ejson::Object::valueExist(const std::string& _name) const {
|
||||
|
||||
ejson::Value ejson::Object::operator[] (const std::string& _name) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not operator[] (nullptr) ...");
|
||||
EJSON_DEBUG("Can not operator[] (nullptr) ...");
|
||||
return ejson::Value(nullptr);
|
||||
}
|
||||
return ejson::Value(static_cast<ejson::internal::Object*>(m_data.get())->get(_name));
|
||||
@ -59,7 +59,7 @@ ejson::Value ejson::Object::operator[] (const std::string& _name) {
|
||||
|
||||
const ejson::Value ejson::Object::operator[] (const std::string& _name) const {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not operator[] (nullptr) ...");
|
||||
EJSON_DEBUG("Can not operator[] (nullptr) ...");
|
||||
return ejson::Value(nullptr);
|
||||
}
|
||||
return ejson::Value(static_cast<const ejson::internal::Object*>(m_data.get())->get(_name));
|
||||
@ -67,7 +67,7 @@ const ejson::Value ejson::Object::operator[] (const std::string& _name) const {
|
||||
|
||||
std::vector<std::string> ejson::Object::getKeys() const {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not getKeys (nullptr) ...");
|
||||
EJSON_DEBUG("Can not getKeys (nullptr) ...");
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
return static_cast<const ejson::internal::Object*>(m_data.get())->getKeys();
|
||||
@ -75,7 +75,7 @@ std::vector<std::string> ejson::Object::getKeys() const {
|
||||
|
||||
size_t ejson::Object::size() const {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not size (nullptr) ...");
|
||||
EJSON_DEBUG("Can not size (nullptr) ...");
|
||||
return 0;
|
||||
}
|
||||
return static_cast<const ejson::internal::Object*>(m_data.get())->size();
|
||||
@ -83,7 +83,7 @@ size_t ejson::Object::size() const {
|
||||
|
||||
ejson::Value ejson::Object::operator[] (size_t _id) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not operator[] (nullptr) ...");
|
||||
EJSON_DEBUG("Can not operator[] (nullptr) ...");
|
||||
return ejson::Value(nullptr);
|
||||
}
|
||||
return ejson::Value(static_cast<ejson::internal::Object*>(m_data.get())->get(_id));
|
||||
@ -91,7 +91,7 @@ ejson::Value ejson::Object::operator[] (size_t _id) {
|
||||
|
||||
const ejson::Value ejson::Object::operator[] (size_t _id) const {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not operator[] (nullptr) ...");
|
||||
EJSON_DEBUG("Can not operator[] (nullptr) ...");
|
||||
return ejson::Value(nullptr);
|
||||
}
|
||||
return ejson::Value(static_cast<const ejson::internal::Object*>(m_data.get())->get(_id));
|
||||
@ -99,7 +99,7 @@ const ejson::Value ejson::Object::operator[] (size_t _id) const {
|
||||
|
||||
std::string ejson::Object::getKey(size_t _id) const {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not getKey (nullptr) ...");
|
||||
EJSON_DEBUG("Can not getKey (nullptr) ...");
|
||||
return "";
|
||||
}
|
||||
return static_cast<const ejson::internal::Object*>(m_data.get())->getKey(_id);
|
||||
@ -107,7 +107,7 @@ std::string ejson::Object::getKey(size_t _id) const {
|
||||
|
||||
bool ejson::Object::add(const std::string& _name, const ejson::Value& _value) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not add (nullptr) ...");
|
||||
EJSON_DEBUG("Can not add (nullptr) ...");
|
||||
return false;
|
||||
}
|
||||
return static_cast<ejson::internal::Object*>(m_data.get())->add(_name, _value.m_data);
|
||||
@ -115,7 +115,7 @@ bool ejson::Object::add(const std::string& _name, const ejson::Value& _value) {
|
||||
|
||||
void ejson::Object::remove(const std::string& _name) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not remove (nullptr) ...");
|
||||
EJSON_DEBUG("Can not remove (nullptr) ...");
|
||||
return;
|
||||
}
|
||||
static_cast<ejson::internal::Object*>(m_data.get())->remove(_name);
|
||||
@ -123,7 +123,7 @@ void ejson::Object::remove(const std::string& _name) {
|
||||
|
||||
void ejson::Object::remove(size_t _id) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not remove (nullptr) ...");
|
||||
EJSON_DEBUG("Can not remove (nullptr) ...");
|
||||
return;
|
||||
}
|
||||
static_cast<ejson::internal::Object*>(m_data.get())->remove(_id);
|
||||
@ -131,7 +131,7 @@ void ejson::Object::remove(size_t _id) {
|
||||
|
||||
ejson::Object::iterator ejson::Object::remove(const ejson::Object::iterator& _it) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not remove (nullptr) ...");
|
||||
EJSON_DEBUG("Can not remove (nullptr) ...");
|
||||
return _it;
|
||||
}
|
||||
static_cast<ejson::internal::Object*>(m_data.get())->remove(_it.getId());
|
||||
|
@ -35,7 +35,7 @@ ejson::String& ejson::String::operator= (const ejson::String& _obj) {
|
||||
|
||||
void ejson::String::set(const std::string& _value) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not set (nullptr) ...");
|
||||
EJSON_DEBUG("Can not set (nullptr) ...");
|
||||
return;
|
||||
}
|
||||
static_cast<ejson::internal::String*>(m_data.get())->set(_value);
|
||||
@ -43,7 +43,7 @@ void ejson::String::set(const std::string& _value) {
|
||||
|
||||
std::string ejson::String::get(const std::string& _errorValue) const {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not get (nullptr) ...");
|
||||
EJSON_DEBUG("Can not get (nullptr) ...");
|
||||
return _errorValue;
|
||||
}
|
||||
return static_cast<const ejson::internal::String*>(m_data.get())->get();
|
||||
|
@ -29,7 +29,7 @@ std::ostream& ejson::operator <<(std::ostream& _os, const ejson::Value& _obj) {
|
||||
|
||||
enum ejson::valueType ejson::Value::getType() const {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not get type ...");
|
||||
EJSON_DEBUG("Can not get type ...");
|
||||
return ejson::valueType::unknow;
|
||||
}
|
||||
return m_data->getType();
|
||||
@ -45,7 +45,7 @@ bool ejson::Value::exist() const {
|
||||
std::string ejson::Value::generateHumanString() const {
|
||||
std::string out;
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not remove (nullptr) ...");
|
||||
EJSON_DEBUG("Can not remove (nullptr) ...");
|
||||
return out;
|
||||
}
|
||||
static_cast<const ejson::internal::Value*>(m_data.get())->iGenerate(out, 0);
|
||||
@ -55,7 +55,7 @@ std::string ejson::Value::generateHumanString() const {
|
||||
std::string ejson::Value::generateMachineString() const {
|
||||
std::string out;
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not remove (nullptr) ...");
|
||||
EJSON_DEBUG("Can not remove (nullptr) ...");
|
||||
return out;
|
||||
}
|
||||
static_cast<const ejson::internal::Value*>(m_data.get())->iMachineGenerate(out);
|
||||
@ -132,7 +132,7 @@ const ejson::Null ejson::Value::toNull() const{
|
||||
|
||||
void ejson::Value::display() const {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not Display (nullptr) ...");
|
||||
EJSON_DEBUG("Can not Display (nullptr) ...");
|
||||
return;
|
||||
}
|
||||
return m_data->display();
|
||||
@ -192,7 +192,7 @@ bool ejson::Value::isNull() const {
|
||||
|
||||
void ejson::Value::clear() {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not Clean (nullptr) ...");
|
||||
EJSON_DEBUG("Can not Clear (nullptr) ...");
|
||||
return;
|
||||
}
|
||||
return m_data->clear();
|
||||
@ -200,7 +200,7 @@ void ejson::Value::clear() {
|
||||
|
||||
bool ejson::Value::transfertIn(ejson::Value& _obj) {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not transfert In (nullptr) ...");
|
||||
EJSON_DEBUG("Can not transfert In (nullptr) ...");
|
||||
return false;
|
||||
}
|
||||
return m_data->transfertIn(_obj.m_data);
|
||||
@ -208,7 +208,7 @@ bool ejson::Value::transfertIn(ejson::Value& _obj) {
|
||||
|
||||
ejson::Value ejson::Value::clone() const {
|
||||
if (m_data == nullptr) {
|
||||
EJSON_ERROR("Can not transfert In (nullptr) ...");
|
||||
EJSON_DEBUG("Can not transfert In (nullptr) ...");
|
||||
return ejson::Value(m_data);
|
||||
}
|
||||
return ejson::Value(m_data->clone());
|
||||
|
Loading…
x
Reference in New Issue
Block a user