xmlwrapp
Lightweight C++ XML parsing library
|
Go to the documentation of this file.
40 #ifndef _xmlwrapp_errors_h_
41 #define _xmlwrapp_errors_h_
44 #include "xmlwrapp/export.h"
65 class XMLWRAPP_API
exception :
public std::runtime_error
68 explicit exception(
const std::string& what);
90 virtual void on_error(
const std::string& msg) = 0;
133 extern XMLWRAPP_API error_handler_ignore_errors
ignore_errors;
164 : message_(err_msg), type_(msg_type)
171 const std::string&
message()
const {
return message_; }
174 std::string message_;
201 return messages_.empty();
245 #endif // _xmlwrapp_errors_h_
message_type type() const
Get the error message type.
Definition: errors.h:168
void on_error(const std::string &msg)
Called by xmlwrapp to report an error.
Specialization of error_handler that throws on any error or warning.
Definition: errors.h:127
std::list< error_message > messages_type
A type to store multiple messages.
Definition: errors.h:189
const std::string & message() const
Get the error message.
Definition: errors.h:171
bool has_errors() const
Check if there are any errors.
Definition: errors.h:215
Single message in error_messages.
Definition: errors.h:148
std::string print() const
Convert error messages into a single printable string.
void on_error(const std::string &)
Called by xmlwrapp to report an error.
Definition: errors.h:105
The xml::error_handler class is used to handle libxml2 errors and warnings emitted during parsing,...
Definition: errors.h:85
bool has_warnings() const
Check if there are warnings in the error messages.
Definition: errors.h:210
virtual void on_error(const std::string &msg)=0
Called by xmlwrapp to report an error.
void on_warning(const std::string &msg)
Called by xmlwrapp to report a warning.
void on_warning(const std::string &)
Called by xmlwrapp to report a warning.
Definition: errors.h:106
error_handler_throw_on_error throw_on_error
Error handler object that throws on any error.
An error handler that ignores both errors and warnings.
Definition: errors.h:103
virtual void on_warning(const std::string &msg)=0
Called by xmlwrapp to report a warning.
const messages_type & messages() const
Get the error messages.
Definition: errors.h:194
error_handler_ignore_errors ignore_errors
Error handler ignoring all errors, its use is strongly discouraged.
error_message(const std::string &err_msg, message_type msg_type)
Create a new xml::error_message object.
Definition: errors.h:163
The xml::error_messages class is used to store all the error messages which are collected while parsi...
Definition: errors.h:186
@ type_error
error
Definition: errors.h:153
XML library namespace.
Definition: attributes.h:52
void on_error(const std::string &msg)
Called by xmlwrapp to report an error.
Definition: errors.h:117
bool empty() const
Convenience function to find if there are any messages at all.
Definition: errors.h:199
This exception class is thrown by xmlwrapp for all runtime XML-related errors.
Definition: errors.h:66
void on_warning(const std::string &)
Called by xmlwrapp to report a warning.
Definition: errors.h:118
error_handler_throw_on_error_or_warning throw_on_error_or_warning
Error handler object that throws on any error or warning.
message_type
A type for different type of errors.
Definition: errors.h:152
virtual std::string format_for_print(const error_message &msg) const
Called by print() to format a single message.
Specialization of error_handler that throws on any error.
Definition: errors.h:115
void on_warning(const std::string &msg)
Called by xmlwrapp to report a warning.
Definition: errors.h:129