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;
93 virtual void on_warning(
const std::string& msg) = 0;
164 : message_(message), type_(msg_type)
171 const std::string&
message()
const {
return message_; }
174 std::string message_;
194 const messages_type&
messages()
const {
return messages_; }
201 return messages_.empty();
224 std::string print()
const;
229 void on_error(
const std::string& msg);
230 void on_warning(
const std::string& msg);
234 virtual std::string format_for_print(
const error_message& msg)
const;
237 messages_type messages_;
245 #endif // _xmlwrapp_errors_h_ The xml::error_handler class is used to handle libxml2 errors and warnings emitted during parsing...
Definition: errors.h:84
void on_warning(const std::string &msg)
Called by xmlwrapp to report a warning.
Definition: errors.h:129
Single message in error_messages.
Definition: errors.h:147
void on_error(const std::string &)
Called by xmlwrapp to report an error.
Definition: errors.h:105
error_message(const std::string &message, message_type msg_type)
Create a new xml::error_message object.
Definition: errors.h:163
error_handler_throw_on_error throw_on_error
Error handler object that throws on any error.
error_handler_ignore_errors ignore_errors
Error handler ignoring all errors, its use is strongly discouraged.
bool has_errors() const
Check if there are any errors.
Definition: errors.h:215
void on_warning(const std::string &)
Called by xmlwrapp to report a warning.
Definition: errors.h:106
error
Definition: errors.h:153
This exception class is thrown by xmlwrapp for all runtime XML-related errors.
Definition: errors.h:65
void on_warning(const std::string &)
Called by xmlwrapp to report a warning.
Definition: errors.h:118
XML library namespace.
Definition: attributes.h:51
const messages_type & messages() const
Get the error messages.
Definition: errors.h:194
An error handler that ignores both errors and warnings.
Definition: errors.h:102
bool empty() const
Convenience function to find if there are any messages at all.
Definition: errors.h:199
Specialization of error_handler that throws on any error or warning.
Definition: errors.h:126
The xml::error_messages class is used to store all the error messages which are collected while parsi...
Definition: errors.h:185
bool has_warnings() const
Check if there are warnings in the error messages.
Definition: errors.h:210
Specialization of error_handler that throws on any error.
Definition: errors.h:114
message_type type() const
Get the error message type.
Definition: errors.h:168
const std::string & message() const
Get the error message.
Definition: errors.h:171
error_handler_throw_on_error_or_warning throw_on_error_or_warning
Error handler object that throws on any error or warning.
void on_error(const std::string &msg)
Called by xmlwrapp to report an error.
Definition: errors.h:117
std::list< error_message > messages_type
A type to store multiple messages.
Definition: errors.h:189
message_type
A type for different type of errors.
Definition: errors.h:151