irccd  3.0.3
Classes | Typedefs | Functions
irccd::ini Namespace Reference

Namespace for ini related classes. More...

Classes

class  exception
 exception in a file. More...
 
class  token
 Describe a token read in the .ini source. More...
 
class  option
 option definition. More...
 
class  section
 Section that contains one or more options. More...
 
class  document
 Ini document description. More...
 

Typedefs

using tokens = std::vector< token >
 

Functions

auto analyse (std::istreambuf_iterator< char > it, std::istreambuf_iterator< char > end) -> tokens
 
auto analyse (std::istream &stream) -> tokens
 
auto parse (const tokens &tokens, const std::string &path=".") -> document
 
auto read_file (const std::string &filename) -> document
 
auto read_string (const std::string &buffer) -> document
 
void dump (const tokens &tokens)
 

Detailed Description

Namespace for ini related classes.

Typedef Documentation

◆ tokens

using irccd::ini::tokens = typedef std::vector<token>

List of tokens in order they are analyzed.

Function Documentation

◆ analyse() [1/2]

auto irccd::ini::analyse ( std::istream &  stream) -> tokens

Overloaded function for stream.

Parameters
streamthe stream
Returns
the list of tokens
Exceptions
exceptionon errors

◆ analyse() [2/2]

auto irccd::ini::analyse ( std::istreambuf_iterator< char >  it,
std::istreambuf_iterator< char >  end 
) -> tokens

Analyse a stream and detect potential syntax errors. This does not parse the file like including other files in include statement.

It does only analysis, for example if an option is defined under no section, this does not trigger an exception while it's invalid.

Parameters
itthe iterator
endwhere to stop
Returns
the list of tokens
Exceptions
exceptionon errors

◆ dump()

void irccd::ini::dump ( const tokens tokens)

Show all tokens and their description.

Parameters
tokensthe tokens

◆ parse()

auto irccd::ini::parse ( const tokens tokens,
const std::string &  path = "." 
) -> document

Parse the produced tokens.

Parameters
tokensthe tokens
paththe parent path
Returns
the document
Exceptions
exceptionon errors

◆ read_file()

auto irccd::ini::read_file ( const std::string &  filename) -> document

Parse a file.

Parameters
filenamethe file name
Returns
the document
Exceptions
exceptionon errors

◆ read_string()

auto irccd::ini::read_string ( const std::string &  buffer) -> document

Parse a string.

If the string contains include statements, they are relative to the current working directory.

Parameters
bufferthe buffer
Returns
the document
Exceptions
exceptionon exceptions