nsnake
Classic snake game for the terminal
Loading...
Searching...
No Matches
INI::Parser Class Reference

Loads, reads and parses the contents of an INI file (or string). More...

#include <INI.hpp>

Public Member Functions

 Parser ()
 Creates a blank new INI file.
 
 Parser (std::string filename)
 Load and parse #filename.
 
 Parser (std::istream &stream)
 Parse a stream.
 
void dump (std::ostream &stream)
 Outputs the contents of the INI file to #stream.
 
Leveltop ()
 Returns the top level of this INI file.
 
const std::string & operator[] (const std::string &name)
 Shortcut to access a key within the top level.
 
Leveloperator() (const std::string &name)
 Shortcut to access a Level within the top level.
 
void create ()
 Creates a blank INI registry.
 
void saveAs (std::string filename)
 Save all the internal INI contents on a file with #filename.
 

Detailed Description

Loads, reads and parses the contents of an INI file (or string).

Definition at line 156 of file INI.hpp.

Constructor & Destructor Documentation

◆ Parser() [1/3]

INI::Parser::Parser ( )

Creates a blank new INI file.

See also
Parser::create()

Definition at line 55 of file INI.cpp.

◆ Parser() [2/3]

INI::Parser::Parser ( std::string filename)

Load and parse #filename.

Definition at line 61 of file INI.cpp.

◆ Parser() [3/3]

INI::Parser::Parser ( std::istream & stream)

Parse a stream.

It can be used to parse strings from memory.

Definition at line 72 of file INI.cpp.

Member Function Documentation

◆ create()

void INI::Parser::create ( )

Creates a blank INI registry.

It resets itself, allowing you to create brand new INI files from scratch.

See also
Level::addKey()
level::addGroup()
Note
It drops everything that may already have been loaded.

Definition at line 215 of file INI.cpp.

◆ dump()

void INI::Parser::dump ( std::ostream & stream)

Outputs the contents of the INI file to #stream.

It dumps a valid INI file, according to this parsers modifications.

Definition at line 84 of file INI.cpp.

◆ operator()()

Level & INI::Parser::operator() ( const std::string & name)
inline

Shortcut to access a Level within the top level.

Definition at line 193 of file INI.hpp.

◆ operator[]()

const std::string & INI::Parser::operator[] ( const std::string & name)
inline

Shortcut to access a key within the top level.

Definition at line 187 of file INI.hpp.

◆ saveAs()

void INI::Parser::saveAs ( std::string filename)

Save all the internal INI contents on a file with #filename.

Definition at line 206 of file INI.cpp.

◆ top()

INI::Level & INI::Parser::top ( )

Returns the top level of this INI file.

You can then access all it's keys and nested groups with the Level methods.

See also
Level

Definition at line 79 of file INI.cpp.


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