Public Member Functions | List of all members
sdf::v11::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...
 
 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::v11::Error::Error ( )

Default constructor.

◆ Error() [2/4]

sdf::v11::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::v11::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::v11::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::v11::Error::Code ( ) const

Get the error code.

Returns
An error code.
See also
ErrorCode.

◆ FilePath()

std::optional<std::string> sdf::v11::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::v11::Error::LineNumber ( ) const

Get the line number associated with this error.

Returns
Returns the line number. nullopt otherwise.

◆ Message()

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

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

Returns
Error message.

◆ operator bool()

sdf::v11::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::v11::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

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