NCBI C++ ToolKit
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
xml::error_message Class Reference

Search Toolkit Book for xml::error_message

The xml::error_message class is used to store a single error message which may appear while parsing or validating an XML document. More...

#include <misc/xmlwrapp/errors.hpp>

+ Collaboration diagram for xml::error_message:

Public Types

enum  message_type { type_fatal_error , type_error , type_warning }
 A type for different type of errors. More...
 

Public Member Functions

 error_message (const std::string &message, message_type msg_type, long line, const std::string &filename)
 Create a new xml::error_message object. More...
 
message_type get_message_type (void) const
 Get the error message type. More...
 
std::string get_message (void) const
 Get the error message. More...
 
long get_line (void) const
 Get the line number. More...
 
std::string get_filename (void) const
 Get the file name. More...
 
 error_message (const error_message &&other)
 Moving constructor. More...
 
error_messageoperator= (const error_message &&other)
 Moving assignment. More...
 
 error_message (const error_message &other)=default
 
error_messageoperator= (const error_message &other)=default
 

Static Public Member Functions

static std::string message_type_str (message_type mt)
 Convert an error type to a string. More...
 

Private Attributes

message_type message_type_
 
std::string message_
 
long line_
 
std::string filename_
 

Detailed Description

The xml::error_message class is used to store a single error message which may appear while parsing or validating an XML document.

Definition at line 50 of file errors.hpp.

Member Enumeration Documentation

◆ message_type

A type for different type of errors.

Enumerator
type_fatal_error 

fatal error

type_error 

error

type_warning 

warning

Definition at line 53 of file errors.hpp.

Constructor & Destructor Documentation

◆ error_message() [1/3]

error_message::error_message ( const std::string message,
message_type  msg_type,
long  line,
const std::string filename 
)

Create a new xml::error_message object.

Parameters
messageThe error message.
msg_typeThe error type.
linefile line realting to error message. 0 if none.
filenamefile name if available or an empty string.

Definition at line 53 of file errors.cpp.

◆ error_message() [2/3]

error_message::error_message ( const error_message &&  other)

Moving constructor.

Parameters
otherThe other error_message.

Definition at line 77 of file errors.cpp.

◆ error_message() [3/3]

xml::error_message::error_message ( const error_message other)
default

Member Function Documentation

◆ get_filename()

std::string error_message::get_filename ( void  ) const

Get the file name.

Returns
The file name, empty string if not available.

Definition at line 73 of file errors.cpp.

References filename_.

◆ get_line()

long error_message::get_line ( void  ) const

Get the line number.

Returns
The line number, 0 if not available.

Definition at line 69 of file errors.cpp.

References line_.

◆ get_message()

std::string error_message::get_message ( void  ) const

Get the error message.

Returns
The error message.

Definition at line 64 of file errors.cpp.

References message_.

◆ get_message_type()

error_message::message_type error_message::get_message_type ( void  ) const

Get the error message type.

Returns
The error type.

Definition at line 60 of file errors.cpp.

References message_type_.

◆ message_type_str()

std::string error_message::message_type_str ( message_type  mt)
static

Convert an error type to a string.

Parameters
mtThe error type.
Returns
The string representation of the error type.

Definition at line 43 of file errors.cpp.

References string, type_error, type_fatal_error, and type_warning.

Referenced by xml::error_messages::print().

◆ operator=() [1/2]

error_message & error_message::operator= ( const error_message &&  other)

Moving assignment.

Parameters
otherThe other error_message.

Definition at line 84 of file errors.cpp.

References filename_, line_, message_, and message_type_.

◆ operator=() [2/2]

error_message& xml::error_message::operator= ( const error_message other)
default

Member Data Documentation

◆ filename_

std::string xml::error_message::filename_
private

Definition at line 127 of file errors.hpp.

Referenced by get_filename(), and operator=().

◆ line_

long xml::error_message::line_
private

Definition at line 126 of file errors.hpp.

Referenced by get_line(), and operator=().

◆ message_

std::string xml::error_message::message_
private

Definition at line 125 of file errors.hpp.

Referenced by get_message(), and operator=().

◆ message_type_

message_type xml::error_message::message_type_
private

Definition at line 124 of file errors.hpp.

Referenced by get_message_type(), and operator=().


The documentation for this class was generated from the following files:
Modified on Mon Apr 22 04:05:07 2024 by modify_doxy.py rev. 669887