Public Member Functions | List of all members
sdf::SDF_VERSION_NAMESPACE::Error Class Reference

#include <Error.hh>

Public Member Functions

 Error ()
 Default constructor. More...
 
 Error (const ErrorCode _code, const std::string &_message)
 Constructor. More...
 
 Error (const ErrorCode _code, const std::string &_message, const std::string &_filePath)
 Constructor. More...
 
 Error (const ErrorCode _code, const std::string &_message, const std::string &_filePath, int _lineNumber)
 Constructor. More...
 
ErrorCode Code () const
 Get the error code. More...
 
std::optional< std::string > FilePath () const
 Get the file path associated with this error. More...
 
std::optional< int > LineNumber () const
 Get the line number associated with this error. More...
 
std::string Message () const
 Get the error message, which is a description of the error. More...
 
void SetFilePath (const std::string &_filePath)
 Sets the file path that is associated with this error. More...
 
void SetLineNumber (int _lineNumber)
 Sets the line number that is associated with this error. More...
 
void SetMessage (const std::string &_message)
 Sets the message associated with this error. More...
 
std::optional< std::string > XmlPath () const
 Get the XPath-like trace that is associated with this error. More...
 

="default"]/model[@name="robot1"]/link[@name="link"])

Sets the XML path that is associated with this error.

Parameters
[in]_xmlPathThe XML path that is related to this error. (e.g. /sdf/world[
See also
Element::SetXmlPath
void SetXmlPath (const std::string &_xmlPath)
 Safe bool conversion. More...
 
 operator bool () const
 Safe bool conversion. More...
 
bool operator== (const bool _value) const
 Compare this Error to a boolean value. More...
 

Constructor & Destructor Documentation

◆ Error() [1/4]

sdf::SDF_VERSION_NAMESPACE::Error::Error ( )

Default constructor.

◆ Error() [2/4]

sdf::SDF_VERSION_NAMESPACE::Error::Error ( const ErrorCode  _code,
const std::string &  _message 
)

Constructor.

Parameters
[in]_codeThe error code.
[in]_messageA description of the error.
See also
ErrorCode.

◆ Error() [3/4]

sdf::SDF_VERSION_NAMESPACE::Error::Error ( const ErrorCode  _code,
const std::string &  _message,
const std::string &  _filePath 
)

Constructor.

Parameters
[in]_codeThe error code.
[in]_messageA description of the error.
[in]_filePathThe file path that is related to this error.
See also
ErrorCode.

◆ Error() [4/4]

sdf::SDF_VERSION_NAMESPACE::Error::Error ( const ErrorCode  _code,
const std::string &  _message,
const std::string &  _filePath,
int  _lineNumber 
)

Constructor.

Parameters
[in]_codeThe error code.
[in]_messageA description of the error.
[in]_filePathThe file path that is related to this error.
[in]_lineNumberThe line number in the provided file path where this error was raised.
See also
ErrorCode.

Member Function Documentation

◆ Code()

ErrorCode sdf::SDF_VERSION_NAMESPACE::Error::Code ( ) const

Get the error code.

Returns
An error code.
See also
ErrorCode.

◆ FilePath()

std::optional<std::string> sdf::SDF_VERSION_NAMESPACE::Error::FilePath ( ) const

Get the file path associated with this error.

Returns
Returns the path of the file that this error is related to, nullopt otherwise.

◆ LineNumber()

std::optional<int> sdf::SDF_VERSION_NAMESPACE::Error::LineNumber ( ) const

Get the line number associated with this error.

Returns
Returns the line number. nullopt otherwise.

◆ Message()

std::string sdf::SDF_VERSION_NAMESPACE::Error::Message ( ) const

Get the error message, which is a description of the error.

Returns
Error message.

◆ operator bool()

sdf::SDF_VERSION_NAMESPACE::Error::operator bool ( ) const
explicit

Safe bool conversion.

Returns
True if this Error's Code() != NONE. In otherwords, this is true when there is an error.

◆ operator==()

bool sdf::SDF_VERSION_NAMESPACE::Error::operator== ( const bool  _value) const

Compare this Error to a boolean value.

Returns
True if the boolean evaluation of this Error equals _value. If _value == false, then true is returned when this Error's Code() is equal to NONE and false is returned otherwise. If _value == true, then true is returned when this Error's Code() is not equal to NONE and false is returned otherwise.
See also
explicit operator bool() const

◆ SetFilePath()

void sdf::SDF_VERSION_NAMESPACE::Error::SetFilePath ( const std::string &  _filePath)

Sets the file path that is associated with this error.

Parameters
[in]_filePathThe file path that is related to this error. (e.g. /tmp/test_file.sdf)

◆ SetLineNumber()

void sdf::SDF_VERSION_NAMESPACE::Error::SetLineNumber ( int  _lineNumber)

Sets the line number that is associated with this error.

Parameters
[in]_lineNumberThe line number that is related to this error.

◆ SetMessage()

void sdf::SDF_VERSION_NAMESPACE::Error::SetMessage ( const std::string &  _message)

Sets the message associated with this error.

Parameters
[in]_messageMessage that describes this error.

◆ SetXmlPath()

void sdf::SDF_VERSION_NAMESPACE::Error::SetXmlPath ( const std::string &  _xmlPath)

Safe bool conversion.

Returns
True if this Error's Code() != NONE. In otherwords, this is true when there is an error.

◆ XmlPath()

std::optional<std::string> sdf::SDF_VERSION_NAMESPACE::Error::XmlPath ( ) const

Get the XPath-like trace that is associated with this error.

Returns
Returns the XPath-like trace that this error is related to, nullopt otherwise.

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