USBGuard
Software framework that protects your computer against rogue USB devices by implementing basic whitelisting and blacklisting capabilities.
Public Member Functions | Protected Attributes | List of all members
usbguard::RuleParserError Class Reference

Represents error during the rule parsing. More...

#include <RuleParser.hpp>

Inheritance diagram for usbguard::RuleParserError:

Public Member Functions

 RuleParserError (const std::string &rule_spec, const std::string &hint="", const std::string &file="", size_t error_line=0, unsigned int error_offset=0)
 Constructs RuleParserError. More...
 
void setHint (const std::string &hint)
 Sets the describtion of the error. More...
 
void setOffset (size_t offset)
 Sets the offset where the error occured. More...
 
void setFileInfo (const std::string &file, size_t error_line, size_t error_offset=0)
 Sets exact location where the error occured. More...
 
const char * what () const noexcept
 Describes the exception. More...
 
const std::string & rule () const
 Returns string representation of the rule. More...
 
const std::string & hint () const
 Returns error hint. More...
 
bool hasFileInfo () const
 Decides whether information about error location is set. More...
 
const std::string fileInfo () const
 Returns string containing file, line and offset where the error occured. More...
 
const std::string & file () const
 File where the rule is located. More...
 
size_t line () const
 Line number where the rule is located. More...
 
size_t offset () const
 Offset where the error occured. More...
 

Protected Attributes

const std::string _rule_spec
 
std::string _hint
 
size_t _offset
 
std::string _file
 
size_t _line
 

Detailed Description

Represents error during the rule parsing.

Constructor & Destructor Documentation

◆ RuleParserError()

usbguard::RuleParserError::RuleParserError ( const std::string &  rule_spec,
const std::string &  hint = "",
const std::string &  file = "",
size_t  error_line = 0,
unsigned int  error_offset = 0 
)
inline

Constructs RuleParserError.

Parameters
rule_specString representation of the rule.
hintDescribes what happened.
fileFile where the rule is located.
error_lineLine in the file where the error occured.
error_offsetOffset where the error occured.

Member Function Documentation

◆ file()

const std::string& usbguard::RuleParserError::file ( ) const
inline

File where the rule is located.

Returns
File where the rule is located.

◆ fileInfo()

const std::string usbguard::RuleParserError::fileInfo ( ) const
inline

Returns string containing file, line and offset where the error occured.

Returns
String containing file, line and offset where the error occured.

◆ hasFileInfo()

bool usbguard::RuleParserError::hasFileInfo ( ) const
inline

Decides whether information about error location is set.

Returns
True if information about error location is set, false otherwise.

◆ hint()

const std::string& usbguard::RuleParserError::hint ( ) const
inline

Returns error hint.

Returns
Hint.

◆ line()

size_t usbguard::RuleParserError::line ( ) const
inline

Line number where the rule is located.

Returns
line number where the rule is located.

◆ offset()

size_t usbguard::RuleParserError::offset ( ) const
inline

Offset where the error occured.

Returns
offset where the error occured.

◆ rule()

const std::string& usbguard::RuleParserError::rule ( ) const
inline

Returns string representation of the rule.

Returns
string representation of the rule.

◆ setFileInfo()

void usbguard::RuleParserError::setFileInfo ( const std::string &  file,
size_t  error_line,
size_t  error_offset = 0 
)
inline

Sets exact location where the error occured.

Parameters
fileFile where the rule is located.
error_lineLine in the file where the error occured.
error_offsetOffset where the error occured.

◆ setHint()

void usbguard::RuleParserError::setHint ( const std::string &  hint)
inline

Sets the describtion of the error.

Parameters
hintDescribes what happened.

◆ setOffset()

void usbguard::RuleParserError::setOffset ( size_t  offset)
inline

Sets the offset where the error occured.

Parameters
offsetOffset where the error occured.

◆ what()

const char* usbguard::RuleParserError::what ( ) const
inlinenoexcept

Describes the exception.

Returns
Describes what happened.

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