BDE 4.14.0 Production release
Loading...
Searching...
No Matches
balxml::ErrorInfo Class Reference

#include <balxml_errorinfo.h>

Public Types

enum  Severity {
  e_NO_ERROR , e_WARNING , e_ERROR , e_FATAL_ERROR ,
  BAEXML_NO_ERROR = e_NO_ERROR , BAEXML_WARNING = e_WARNING , BAEXML_ERROR = e_ERROR , BAEXML_FATAL_ERROR = e_FATAL_ERROR
}
 

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (ErrorInfo, bslma::UsesBslmaAllocator)
 
 ErrorInfo (bslma::Allocator *basicAllocator=0)
 
 ErrorInfo (const ErrorInfo &other, bslma::Allocator *basicAllocator=0)
 
 ~ErrorInfo ()
 Destroy this object.
 
ErrorInfooperator= (const ErrorInfo &rhs)
 
void setError (Severity severity, int lineNumber, int columnNumber, const bsl::string_view &source, const bsl::string_view &errorMsg)
 
void setError (const ErrorInfo &other)
 
void reset ()
 
bool isNoError () const
 
bool isWarning () const
 
bool isError () const
 
bool isFatalError () const
 
bool isAnyError () const
 
Severity severity () const
 Return the severity level.
 
int lineNumber () const
 
int columnNumber () const
 
const bsl::stringsource () const
 Return the string that identifies the document being parsed.
 
const bsl::stringmessage () const
 Return the string describing the error or warning.
 

Detailed Description

This class provides detailed information for errors encountered during XML parsing. Such information is common for most parsers and contains the following data: line number, column number, severity code, identification of source document and the parser error message.

Member Enumeration Documentation

◆ Severity

Enumerator
e_NO_ERROR 
e_WARNING 
e_ERROR 
e_FATAL_ERROR 
BAEXML_NO_ERROR 
BAEXML_WARNING 
BAEXML_ERROR 
BAEXML_FATAL_ERROR 

Constructor & Destructor Documentation

◆ ErrorInfo() [1/2]

balxml::ErrorInfo::ErrorInfo ( bslma::Allocator basicAllocator = 0)

Construct an error info object using the (optionally) specified basicAllocator, or the default allocator of none is specified. After construction, severity() will return BAEXML_NO_ERROR, lineNumber() and columnNumber() will each return 0, and source() and message() will each return an empty string.

◆ ErrorInfo() [2/2]

balxml::ErrorInfo::ErrorInfo ( const ErrorInfo other,
bslma::Allocator basicAllocator = 0 
)

Construct a copy of the specified other object using the (optionally) specified basicAllocator, or the default allocator of none is specified.

◆ ~ErrorInfo()

balxml::ErrorInfo::~ErrorInfo ( )

Member Function Documentation

◆ BSLMF_NESTED_TRAIT_DECLARATION()

balxml::ErrorInfo::BSLMF_NESTED_TRAIT_DECLARATION ( ErrorInfo  ,
bslma::UsesBslmaAllocator   
)

◆ columnNumber()

int balxml::ErrorInfo::columnNumber ( ) const
inline

Return the column number. By convention, the first column is numbered 1. The constructors and reset functions set the column number to 0, since there is no error column to report.

◆ isAnyError()

bool balxml::ErrorInfo::isAnyError ( ) const
inline

Return true if the severity() >=BAEXML_ERROR' (i.e., BAEXML_ERROR or BAEXML_FATAL_ERROR) and false otherwise.

◆ isError()

bool balxml::ErrorInfo::isError ( ) const
inline

Return true if the severity() ==BAEXML_ERROR' and false otherwise.

◆ isFatalError()

bool balxml::ErrorInfo::isFatalError ( ) const
inline

Return true if the severity() ==BAEXML_FATAL_ERROR' and false otherwise.

◆ isNoError()

bool balxml::ErrorInfo::isNoError ( ) const
inline

Return true if the severity() ==BAEXML_NO_ERROR' and false otherwise.

◆ isWarning()

bool balxml::ErrorInfo::isWarning ( ) const
inline

Return true if the severity() ==BAEXML_WARNING' and false otherwise.

◆ lineNumber()

int balxml::ErrorInfo::lineNumber ( ) const
inline

Return the line number of the warning or error. By convention, the first line is numbered 1. The constructors and reset functions set the line number to 0, since there is no error line to report.

◆ message()

const bsl::string & balxml::ErrorInfo::message ( ) const
inline

◆ operator=()

ErrorInfo & balxml::ErrorInfo::operator= ( const ErrorInfo rhs)

Copy the value of the specified rhs object into this object and return a modifiable reference to this object.

◆ reset()

void balxml::ErrorInfo::reset ( )

Reset this object to initial state, as if it were default constructed.

◆ setError() [1/2]

void balxml::ErrorInfo::setError ( const ErrorInfo other)
inline

If the severity of the specified other object is greater than the current value of this->severity(), then assign this object the value of other, otherwise do nothing.

◆ setError() [2/2]

void balxml::ErrorInfo::setError ( Severity  severity,
int  lineNumber,
int  columnNumber,
const bsl::string_view source,
const bsl::string_view errorMsg 
)

If the specified severity is greater than the current value of this->severity(), then set this object's severity to severity, line number to the specified lineNumber, column number to the specified columnNumber, source name to the specified source, and error message to the specified errorMsg, otherwise do nothing.

◆ severity()

ErrorInfo::Severity balxml::ErrorInfo::severity ( ) const
inline

◆ source()

const bsl::string & balxml::ErrorInfo::source ( ) const
inline

The documentation for this class was generated from the following file: