C++ Utilities: CppUtilities::IniFile Class Reference

C++ Utilities 5.33.0 Useful C++ classes and routines such as argument parser, IO and conversion utilities

Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
CppUtilities::IniFile Class Reference

The IniFile class allows parsing and writing INI files. More...

`#include <inifile.h>`

## Public Types
using | ScopeName = std::string
using | ScopeData = std::multimap<std::string, std::string>
using | Scope = std::pair<ScopeName, ScopeData>
using | ScopeList = std::vector<Scope>

## Public Member Functions
| IniFile ()
| Constructs an empty ini file.
ScopeList & | data ()
| Returns the data of the file.
const ScopeList & | data () const
| Returns the data of the file.
void | parse (std::istream &inputStream)
| Parses all data from the specified inputStream.
void | make (std::ostream &outputStream)
| Write the current data to the specified outputStream.

## Detailed Description

The IniFile class allows parsing and writing INI files.

See also
  See AdvancedIniFile for a more advanced version which preserves more particularities of the original file.

Definition at line 16 of file inifile.h.

## Member Typedef Documentation

## ◆ Scope

using CppUtilities::IniFile::Scope = std::pair<ScopeName, ScopeData>

Definition at line 20 of file inifile.h.

## ◆ ScopeData

using CppUtilities::IniFile::ScopeData = std::multimap<std::string, std::string>

Definition at line 19 of file inifile.h.

## ◆ ScopeList

using CppUtilities::IniFile::ScopeList = std::vector<Scope>

Definition at line 21 of file inifile.h.

## ◆ ScopeName

using CppUtilities::IniFile::ScopeName = std::string

Definition at line 18 of file inifile.h.

## Constructor & Destructor Documentation

## ◆ IniFile()

CppUtilities::IniFile::IniFile | ( |  | ) |
| inline

Constructs an empty ini file.

Definition at line 36 of file inifile.h.

## Member Function Documentation

## ◆ data() [1/2]

IniFile::ScopeList & CppUtilities::IniFile::data | ( |  | ) |
| inline

Returns the data of the file.

Remarks
  - The returned pairs represent the [scope names] and the contained "key = value"-pairs.
  - The data might be modified and then saved using the make() method.

Definition at line 46 of file inifile.h.

## ◆ data() [2/2]

const IniFile::ScopeList & CppUtilities::IniFile::data | ( |  | ) | const
| inline

Returns the data of the file.

Remarks
  The returned pairs represent the [scope names] and the contained "key = value"-pairs.

Definition at line 55 of file inifile.h.

## ◆ make()

void CppUtilities::IniFile::make | ( | std::ostream & | outputStream | ) |

Write the current data to the specified outputStream.

Exceptions

  Throws | an std::ios_base::failure when an IO error occurs.

Definition at line 157 of file inifile.cpp.

## ◆ parse()

void CppUtilities::IniFile::parse | ( | std::istream & | inputStream | ) |

Parses all data from the specified inputStream.

Exceptions

  Throws | an std::ios_base::failure when an IO error (other than end-of-file) occurs.

Definition at line 38 of file inifile.cpp.

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

- io/inifile.h
- io/inifile.cpp