Deepsolver
Public Types | Public Member Functions
Deepsolver::ConfigFileException Class Reference

The exception class for config file syntax errors. More...

Inheritance diagram for Deepsolver::ConfigFileException:
Deepsolver::DeepsolverException

List of all members.

Public Types

enum  {
  SectionInvalidType = 0, SectionWaitingOpenBracket = 1, SectionWaitingName = 2, SectionInvalidNameChar = 3,
  SectionWaitingCloseBracketOrArg = 4, SectionUnexpectedArgEnd = 5, SectionWaitingCloseBracket = 6, ValueWaitingName = 7,
  ValueInvalidNameChar = 8, ValueWaitingAssignOrNewName = 9, ValueWaitingNewName = 10, ValueUnexpectedValueEnd = 11
}

Public Member Functions

 ConfigFileException (int code, const std::string &fileName, size_t lineNumber, std::string::size_type pos, const std::string &line)
 The constructor.
int getCode () const
 Returns the type of encountered error.
const std::string & getFileName () const
 Returns the name of a file with invalid line.
const std::string & getLine () const
 Returns the text of the invalid line.
size_t getLineNumber () const
 Returns number of an invalid line.
std::string getMessage () const
 Returns a single line error description.
std::string::size_type getPos () const
 Returns the invalid character position.
std::string getType () const
 Returns a string with error type.
virtual ~ConfigFileException ()
 The destructor.

Detailed Description

This class instance is thrown when configuration file syntax error is encountered. The client application can access various information with it about the problem like file name, line number, character position, line content and error code. Be careful, character position is given in unibyte string representation and in case of using UTF-8 sequences it require additional processing. Note, that this class does not provide any text descriptions.

See also:
ConfigException AbstractConfigFileHandler ConfigFile

Constructor & Destructor Documentation

Deepsolver::ConfigFileException::ConfigFileException ( int  code,
const std::string &  fileName,
size_t  lineNumber,
std::string::size_type  pos,
const std::string &  line 
) [inline]
Parameters:
[in]codeThe error code describing the type of error
[in]fileNameName of a file being processed
[in]lineNumberThe number of a line with encountered error
[in]posThe problem character position with unibyte coding
[in]lineThe text of an invalid line

Member Function Documentation

int Deepsolver::ConfigFileException::getCode ( ) const [inline]

Use this method to get type of error.

Returns:
The encountered error code
const std::string& Deepsolver::ConfigFileException::getFileName ( ) const [inline]

Use this method to get name of a file with an invalid line.

Returns:
Name of a file with an invalid line
const std::string& Deepsolver::ConfigFileException::getLine ( ) const [inline]

Use this method to get text of the invalid line.

Returns:
The content of the invalid line
size_t Deepsolver::ConfigFileException::getLineNumber ( ) const [inline]

Use this method to get number of line with the syntax problem.

Returns:
Number of an invalid line
std::string Deepsolver::ConfigFileException::getMessage ( ) const [inline, virtual]

This method returns a single line string value with error description. Usually it is the value printed to user in error message. The value may not include error type since it can be obtained with getType() method.

Returns:
A single line error description

Implements Deepsolver::DeepsolverException.

std::string::size_type Deepsolver::ConfigFileException::getPos ( ) const [inline]

Use this method to get the invalid character position in unibyte character coding.

Returns:
The number of the invalid character
std::string Deepsolver::ConfigFileException::getType ( ) const [inline, virtual]

This method returns a short string with one or two words describing the error type. For example, this method can return values like "system", "back-end" etc. A value returned by this method usually is used for error message construction.

Returns:
A short string with error type description

Implements Deepsolver::DeepsolverException.