diff --git a/exml/Document.cpp b/exml/Document.cpp index 3125e94..c00685e 100644 --- a/exml/Document.cpp +++ b/exml/Document.cpp @@ -74,15 +74,6 @@ void exml::Document::display() { static_cast(m_data.get())->display(); } -void exml::Document::displayError() { - if (m_data == nullptr) { - EXML_ERROR("Can not displayError (nullptr) ..."); - return; - } - static_cast(m_data.get())->displayError(); -} - - void exml::Document::setCaseSensitive(bool _val) { if (m_data == nullptr) { EXML_ERROR("Can not setCaseSensitive (nullptr) ..."); @@ -99,20 +90,26 @@ bool exml::Document::getCaseSensitive() const { return static_cast(m_data.get())->getCaseSensitive(); } -void exml::Document::displayErrorWhenDetected() { +void exml::Document::setDisplayError(bool _value){ if (m_data == nullptr) { - EXML_ERROR("Can not displayErrorWhenDetected (nullptr) ..."); + EXML_ERROR("Can not setDisplayError (nullptr) ..."); return; } - static_cast(m_data.get())->displayErrorWhenDetected(); + static_cast(m_data.get())->setDisplayError(_value); } -void exml::Document::notDisplayErrorWhenDetected() { +bool exml::Document::getDisplayError() { if (m_data == nullptr) { - EXML_ERROR("Can not notDisplayErrorWhenDetected (nullptr) ..."); + EXML_ERROR("Can not getDisplayError (nullptr) ..."); + return false; + } + return static_cast(m_data.get())->getDisplayError(); +} + +void exml::Document::displayError() { + if (m_data == nullptr) { + EXML_ERROR("Can not displayError (nullptr) ..."); return; } - static_cast(m_data.get())->notDisplayErrorWhenDetected(); + static_cast(m_data.get())->displayError(); } - - diff --git a/exml/Document.h b/exml/Document.h index fd9e822..5e0c767 100644 --- a/exml/Document.h +++ b/exml/Document.h @@ -78,15 +78,18 @@ namespace exml { */ void display(); /** - * @brief Request display error when detected (not print only at the end ...) + * @brief Set the display of the error when detected. + * @param[in] _value true: display error, false not display error (get it at end) */ - void displayErrorWhenDetected(); + void setDisplayError(bool _value); /** - * @brief Request NOT display error when detected. + * @brief Get the display of the error status. + * @return true Display error + * @return false Does not display error (get it at end) */ - void notDisplayErrorWhenDetected(); + bool getDisplayError(); /** - * @brief request display in log of the error + * @brief Display error detected. */ void displayError(); }; diff --git a/exml/internal/Document.cpp b/exml/internal/Document.cpp index 0879cce..be90ad9 100644 --- a/exml/internal/Document.cpp +++ b/exml/internal/Document.cpp @@ -123,6 +123,14 @@ std::string createPosPointer(const std::string& _line, int32_t _pos) { return out; } +void exml::internal::Document::setDisplayError(bool _value) { + m_writeErrorWhenDetexted = _value; +} + +bool exml::internal::Document::getDisplayError() { + return m_writeErrorWhenDetexted; +} + void exml::internal::Document::displayError() { if (m_comment.size() == 0) { EXML_ERROR("No error detected ???"); diff --git a/exml/internal/Document.h b/exml/internal/Document.h index a2fbdd6..58959ab 100644 --- a/exml/internal/Document.h +++ b/exml/internal/Document.h @@ -82,17 +82,20 @@ namespace exml { exml::FilePos m_filePos; //!< position of the error public: /** - * @brief Request display error when detected (not print only at the end ...) + * @brief Set the display of the error when detected. + * @param[in] _value true: display error, false not display error (get it at end) */ - void displayErrorWhenDetected() { - m_writeErrorWhenDetexted = true; - } + void setDisplayError(bool _value); /** - * @brief Request NOT display error when detected. + * @brief Get the display of the error status. + * @return true Display error + * @return false Does not display error (get it at end) */ - void notDisplayErrorWhenDetected() { - m_writeErrorWhenDetexted = false; - } + bool getDisplayError(); + /** + * @brief Request display in log of the error + */ + void displayError(); /** * @brief Create an error in the parsing (call by the syetm for error management) * @param[in] _data string of chat is wrong @@ -101,10 +104,6 @@ namespace exml { * @param[in] _comment Error string to display */ void createError(const std::string& _data, int32_t _pos, const exml::FilePos& _filePos, const std::string& _comment); - /** - * @brief request display in log of the error - */ - void displayError(); public: enum nodeType getType() const override { return nodeType::document;