C++ Utilities  5.3.0
Useful C++ classes and routines such as argument parser, IO and conversion utilities
Public Types | Public Member Functions | List of all members
CppUtilities::IniFile Class Reference

The IniFile class parses and makes 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. More...
 
ScopeListdata ()
 Returns the data of the file. More...
 
const ScopeListdata () const
 
void parse (std::istream &inputStream)
 Parses all data from the specified inputStream. More...
 
void make (std::ostream &outputStream)
 Write the current data to the specified outputStream. More...
 

Detailed Description

The IniFile class parses and makes INI files.

Todo:
  • Preserve difference between absence of equal sign and empty value after equal sign.
  • Preserve order within section.
  • Preserve comments.

Definition at line 13 of file inifile.h.

Member Typedef Documentation

◆ Scope

Definition at line 17 of file inifile.h.

◆ ScopeData

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

Definition at line 16 of file inifile.h.

◆ ScopeList

Definition at line 18 of file inifile.h.

◆ ScopeName

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

Definition at line 15 of file inifile.h.

Constructor & Destructor Documentation

◆ IniFile()

CppUtilities::IniFile::IniFile ( )
inline

Constructs an empty ini file.

Definition at line 33 of file inifile.h.

Member Function Documentation

◆ data() [1/2]

const 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.
The returned pairs represent the [scope names] and the contained "key = value"-pairs.

Definition at line 43 of file inifile.h.

◆ data() [2/2]

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

◆ make()

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

Write the current data to the specified outputStream.

Definition at line 154 of file inifile.cpp.

◆ parse()

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

Parses all data from the specified inputStream.

Definition at line 21 of file inifile.cpp.


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