OpenASIP  2.0
Public Member Functions | Private Attributes | List of all members
DOMBuilderErrorHandler Class Reference

#include <DOMBuilderErrorHandler.hh>

Inheritance diagram for DOMBuilderErrorHandler:
Inheritance graph
Collaboration diagram for DOMBuilderErrorHandler:
Collaboration graph

Public Member Functions

 DOMBuilderErrorHandler ()
 
virtual ~DOMBuilderErrorHandler ()
 
bool handleError (const DOMError &domError)
 
int errorCount () const
 
std::string errorLog () const
 

Private Attributes

int errorCount_
 Number of errors handled. More...
 
std::string errorLog_
 Error log. More...
 

Detailed Description

Error handler used when validating XML files by XMLSerializer.

Definition at line 47 of file DOMBuilderErrorHandler.hh.

Constructor & Destructor Documentation

◆ DOMBuilderErrorHandler()

DOMBuilderErrorHandler::DOMBuilderErrorHandler ( )

Constructor.

Definition at line 42 of file DOMBuilderErrorHandler.cc.

42  :
43  errorCount_(0), errorLog_("") {
44 }

◆ ~DOMBuilderErrorHandler()

DOMBuilderErrorHandler::~DOMBuilderErrorHandler ( )
virtual

Destructor.

Definition at line 50 of file DOMBuilderErrorHandler.cc.

50  {
51 }

Member Function Documentation

◆ errorCount()

int DOMBuilderErrorHandler::errorCount ( ) const

Returns the number of errors handled.

Returns
Number of errors handled.

Definition at line 91 of file DOMBuilderErrorHandler.cc.

91  {
92  return errorCount_;
93 }

References errorCount_.

Referenced by XMLSerializer::readFile(), and XMLSerializer::readString().

◆ errorLog()

string DOMBuilderErrorHandler::errorLog ( ) const

Returns the error log.

Returns
The error log.

Definition at line 102 of file DOMBuilderErrorHandler.cc.

102  {
103  return errorLog_;
104 }

References errorLog_.

Referenced by XMLSerializer::readFile(), and XMLSerializer::readString().

◆ handleError()

bool DOMBuilderErrorHandler::handleError ( const DOMError &  domError)

Handler function to process errors that occur while building DOM documents.

Stores information to locate the error (URI, line number, column, diagnostic message) passed by a DOM builder to an error log. Called by DOMBuilder::parseURI.

Parameters
domErrorError generated by DOM builder.
Returns
Always Boolean value 'true'.

Definition at line 66 of file DOMBuilderErrorHandler.cc.

66  {
67 
68  errorCount_++;
69  DOMLocator* locator = domError.getLocation();
70 
71  errorLog_ += "Error at file ";
72  errorLog_ += Conversion::XMLChToString(locator->getURI());
73  errorLog_ += ", line ";
74  errorLog_ += Conversion::toString(locator->getLineNumber());
75  errorLog_ += ", column ";
76  errorLog_ += Conversion::toString(locator->getColumnNumber());
77  errorLog_ += "\n Message: ";
78  errorLog_ += Conversion::XMLChToString(domError.getMessage());
79  errorLog_ += "\n";
80 
81  return true;
82 }

References errorCount_, errorLog_, Conversion::toString(), and Conversion::XMLChToString().

Here is the call graph for this function:

Member Data Documentation

◆ errorCount_

int DOMBuilderErrorHandler::errorCount_
private

Number of errors handled.

Definition at line 58 of file DOMBuilderErrorHandler.hh.

Referenced by errorCount(), and handleError().

◆ errorLog_

std::string DOMBuilderErrorHandler::errorLog_
private

Error log.

Definition at line 60 of file DOMBuilderErrorHandler.hh.

Referenced by errorLog(), and handleError().


The documentation for this class was generated from the following files:
DOMBuilderErrorHandler::errorCount_
int errorCount_
Number of errors handled.
Definition: DOMBuilderErrorHandler.hh:58
DOMBuilderErrorHandler::errorLog_
std::string errorLog_
Error log.
Definition: DOMBuilderErrorHandler.hh:60
Conversion::toString
static std::string toString(const T &source)
Conversion::XMLChToString
static std::string XMLChToString(const XMLCh *source)