[DEV] update display error API

This commit is contained in:
Edouard DUPIN 2016-04-29 23:16:07 +02:00
parent 01344576d6
commit 6926e678c5
4 changed files with 41 additions and 34 deletions

View File

@ -74,15 +74,6 @@ void exml::Document::display() {
static_cast<exml::internal::Document*>(m_data.get())->display(); static_cast<exml::internal::Document*>(m_data.get())->display();
} }
void exml::Document::displayError() {
if (m_data == nullptr) {
EXML_ERROR("Can not displayError (nullptr) ...");
return;
}
static_cast<exml::internal::Document*>(m_data.get())->displayError();
}
void exml::Document::setCaseSensitive(bool _val) { void exml::Document::setCaseSensitive(bool _val) {
if (m_data == nullptr) { if (m_data == nullptr) {
EXML_ERROR("Can not setCaseSensitive (nullptr) ..."); EXML_ERROR("Can not setCaseSensitive (nullptr) ...");
@ -99,20 +90,26 @@ bool exml::Document::getCaseSensitive() const {
return static_cast<exml::internal::Document*>(m_data.get())->getCaseSensitive(); return static_cast<exml::internal::Document*>(m_data.get())->getCaseSensitive();
} }
void exml::Document::displayErrorWhenDetected() { void exml::Document::setDisplayError(bool _value){
if (m_data == nullptr) { if (m_data == nullptr) {
EXML_ERROR("Can not displayErrorWhenDetected (nullptr) ..."); EXML_ERROR("Can not setDisplayError (nullptr) ...");
return; return;
} }
static_cast<exml::internal::Document*>(m_data.get())->displayErrorWhenDetected(); static_cast<exml::internal::Document*>(m_data.get())->setDisplayError(_value);
} }
void exml::Document::notDisplayErrorWhenDetected() { bool exml::Document::getDisplayError() {
if (m_data == nullptr) { if (m_data == nullptr) {
EXML_ERROR("Can not notDisplayErrorWhenDetected (nullptr) ..."); EXML_ERROR("Can not getDisplayError (nullptr) ...");
return false;
}
return static_cast<exml::internal::Document*>(m_data.get())->getDisplayError();
}
void exml::Document::displayError() {
if (m_data == nullptr) {
EXML_ERROR("Can not displayError (nullptr) ...");
return; return;
} }
static_cast<exml::internal::Document*>(m_data.get())->notDisplayErrorWhenDetected(); static_cast<exml::internal::Document*>(m_data.get())->displayError();
} }

View File

@ -78,15 +78,18 @@ namespace exml {
*/ */
void display(); 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(); void displayError();
}; };

View File

@ -123,6 +123,14 @@ std::string createPosPointer(const std::string& _line, int32_t _pos) {
return out; 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() { void exml::internal::Document::displayError() {
if (m_comment.size() == 0) { if (m_comment.size() == 0) {
EXML_ERROR("No error detected ???"); EXML_ERROR("No error detected ???");

View File

@ -82,17 +82,20 @@ namespace exml {
exml::FilePos m_filePos; //!< position of the error exml::FilePos m_filePos; //!< position of the error
public: 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() { void setDisplayError(bool _value);
m_writeErrorWhenDetexted = true;
}
/** /**
* @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();
m_writeErrorWhenDetexted = false; /**
} * @brief Request display in log of the error
*/
void displayError();
/** /**
* @brief Create an error in the parsing (call by the syetm for error management) * @brief Create an error in the parsing (call by the syetm for error management)
* @param[in] _data string of chat is wrong * @param[in] _data string of chat is wrong
@ -101,10 +104,6 @@ namespace exml {
* @param[in] _comment Error string to display * @param[in] _comment Error string to display
*/ */
void createError(const std::string& _data, int32_t _pos, const exml::FilePos& _filePos, const std::string& _comment); 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: public:
enum nodeType getType() const override { enum nodeType getType() const override {
return nodeType::document; return nodeType::document;