Skip to content

Class inih::INIReader

ClassList > inih > INIReader

Public Functions

Type Name
const std::unordered_map< std::string, std::string > Get (std::string section) const
T Get (const std::string & section, const std::string & name)
Return the value of the given key in the given section.
T Get (const std::string & section, const std::string & name, T & default_v)
Return the value of the given key in the given section, return default if not found.
std::vector< T > GetVector (const std::string & section, const std::string & name)
Return the value array of the given key in the given section.
std::vector< T > GetVector (const std::string & section, const std::string & name, const std::vector< T > & default_v)
Return the value array of the given key in the given section, return default if not found.
INIReader ()
INIReader (std::string filename)
INIReader (FILE * file)
void InsertEntry (const std::string & section, const std::string & name, const T & v)
void InsertEntry (const std::string & section, const std::string & name, const std::vector< T > & vs)
const std::set< std::string > Keys (std::string section) const
Return the list of keys in the given section.
int ParseError () const
const std::set< std::string > Sections () const
Return the list of sections found in ini file.
void UpdateEntry (const std::string & section, const std::string & name, const T & v)
void UpdateEntry (const std::string & section, const std::string & name, const std::vector< T > & vs)

Protected Attributes

Type Name
int _error
std::unordered_map< std::string, std::unordered_map< std::string, std::string > > _values

Protected Functions

Type Name
const bool BoolConverter (std::string s) const
T Converter (const std::string & s) const
std::string V2String (const T & v) const
std::string Vec2String (const std::vector< T > & v) const

Protected Static Functions

Type Name
int ValueHandler (void * user, const char * section, const char * name, const char * value)

Public Functions Documentation

function Get [⅓]

inline const std::unordered_map< std::string, std::string > inih::INIReader::Get (
    std::string section
) const

function Get [⅔]

Return the value of the given key in the given section.

template<typename T>
inline T inih::INIReader::Get (
    const std::string & section,
    const std::string & name
) 

Parameters:

  • section The section name
  • name The key name

Returns:

The value of the given key in the given section


function Get [3/3]

Return the value of the given key in the given section, return default if not found.

template<typename T>
inline T inih::INIReader::Get (
    const std::string & section,
    const std::string & name,
    T & default_v
) 

Parameters:

  • section The section name
  • name The key name
  • default_v The default value

Returns:

The value of the given key in the given section, return default if not found


function GetVector [½]

Return the value array of the given key in the given section.

template<typename T>
inline std::vector< T > inih::INIReader::GetVector (
    const std::string & section,
    const std::string & name
) 

Parameters:

  • section The section name
  • name The key name

Returns:

The value array of the given key in the given section.

For example:

[section]
key = 1 2 3 4

const auto vs = ini.GetVector<std::vector<int>>("section", "key");
// vs = {1, 2, 3, 4}

function GetVector [2/2]

Return the value array of the given key in the given section, return default if not found.

template<typename T>
inline std::vector< T > inih::INIReader::GetVector (
    const std::string & section,
    const std::string & name,
    const std::vector< T > & default_v
) 

Parameters:

  • section The section name
  • name The key name
  • default_v The default value

Returns:

The value array of the given key in the given section, return default if not found

See also: INIReader::GetVector


function INIReader [⅓]

inline inih::INIReader::INIReader () 

function INIReader [⅔]

inline inih::INIReader::INIReader (
    std::string filename
) 

function INIReader [3/3]

inline inih::INIReader::INIReader (
    FILE * file
) 

function InsertEntry [½]

template<typename T>
inline void inih::INIReader::InsertEntry (
    const std::string & section,
    const std::string & name,
    const T & v
) 

function InsertEntry [2/2]

template<typename T>
inline void inih::INIReader::InsertEntry (
    const std::string & section,
    const std::string & name,
    const std::vector< T > & vs
) 

function Keys

Return the list of keys in the given section.

inline const std::set< std::string > inih::INIReader::Keys (
    std::string section
) const

Parameters:

  • section The section name

Returns:

The list of keys in the given section


function ParseError

inline int inih::INIReader::ParseError () const

function Sections

Return the list of sections found in ini file.

inline const std::set< std::string > inih::INIReader::Sections () const

Returns:

The list of sections found in ini file


function UpdateEntry [½]

template<typename T>
inline void inih::INIReader::UpdateEntry (
    const std::string & section,
    const std::string & name,
    const T & v
) 

function UpdateEntry [2/2]

template<typename T>
inline void inih::INIReader::UpdateEntry (
    const std::string & section,
    const std::string & name,
    const std::vector< T > & vs
) 

Protected Attributes Documentation

variable _error

int inih::INIReader::_error;

variable _values

std::unordered_map<std::string, std::unordered_map<std::string, std::string> > inih::INIReader::_values;

Protected Functions Documentation

function BoolConverter

inline const bool inih::INIReader::BoolConverter (
    std::string s
) const

function Converter

template<typename T>
inline T inih::INIReader::Converter (
    const std::string & s
) const

function V2String

template<typename T>
inline std::string inih::INIReader::V2String (
    const T & v
) const

function Vec2String

template<typename T>
inline std::string inih::INIReader::Vec2String (
    const std::vector< T > & v
) const

Protected Static Functions Documentation

function ValueHandler

static inline int inih::INIReader::ValueHandler (
    void * user,
    const char * section,
    const char * name,
    const char * value
) 


The documentation for this class was generated from the following file src/utils/Ini.h