Photon Common Library 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::IniFile Class Referencefinal

INI file I/O. This class is useful for recording various settings across the entire engine project. As a low-level I/O class in Common library, it can be used regardless the engine initialization state (see init_render_engine() and exit_render_engine() in Engine library for more details). More...

#include <IniFile.h>

Public Member Functions

 IniFile ()
 Creates a file with no content. An empty section is made current.
 
 IniFile (const std::string &iniFilePath)
 
void save (const std::string &iniFilePath)
 
void clear ()
 
std::size_t numSections () const
 
std::string_view getSectionName (std::size_t sectionIdx) const
 
std::string_view getCurrentSectionName () const
 
std::optional< std::size_t > findSectionIndex (std::string_view sectionName) const
 
void setCurrentSection (std::size_t sectionIdx)
 
void setCurrentSection (std::string_view sectionName, bool createIfNotExist=true)
 
std::size_t numProperties () const
 
std::string_view getPropertyName (std::size_t propertyIdx) const
 
std::string_view getPropertyValue (std::size_t propertyIdx) const
 
std::optional< std::size_t > findPropertyIndex (std::string_view propertyName) const
 
void setProperty (std::size_t propertyIdx, std::string_view propertyValue)
 Set a property under current section by index.
 
void setProperty (std::string_view propertyName, std::string_view propertyValue, bool createIfNotExist=true)
 Set a property under current section by name.
 
void append (const IniFile &other)
 Add another INI file to this one. All properties from the other file will be added to this one. New sections will be created if they were not in this file. Properties will be overwritten if they were already defined in this file.
 

Static Public Member Functions

static IniFile read (const std::string &iniFilePath)
 

Detailed Description

INI file I/O. This class is useful for recording various settings across the entire engine project. As a low-level I/O class in Common library, it can be used regardless the engine initialization state (see init_render_engine() and exit_render_engine() in Engine library for more details).

Constructor & Destructor Documentation

◆ IniFile() [1/2]

ph::IniFile::IniFile ( )

Creates a file with no content. An empty section is made current.

◆ IniFile() [2/2]

ph::IniFile::IniFile ( const std::string & iniFilePath)
explicit

Member Function Documentation

◆ append()

void ph::IniFile::append ( const IniFile & other)

Add another INI file to this one. All properties from the other file will be added to this one. New sections will be created if they were not in this file. Properties will be overwritten if they were already defined in this file.

◆ clear()

void ph::IniFile::clear ( )
inline

◆ findPropertyIndex()

std::optional< std::size_t > ph::IniFile::findPropertyIndex ( std::string_view propertyName) const

◆ findSectionIndex()

std::optional< std::size_t > ph::IniFile::findSectionIndex ( std::string_view sectionName) const

◆ getCurrentSectionName()

std::string_view ph::IniFile::getCurrentSectionName ( ) const
inline

◆ getPropertyName()

std::string_view ph::IniFile::getPropertyName ( std::size_t propertyIdx) const
inline

◆ getPropertyValue()

std::string_view ph::IniFile::getPropertyValue ( std::size_t propertyIdx) const
inline

◆ getSectionName()

std::string_view ph::IniFile::getSectionName ( std::size_t sectionIdx) const
inline

◆ numProperties()

std::size_t ph::IniFile::numProperties ( ) const
inline

◆ numSections()

std::size_t ph::IniFile::numSections ( ) const
inline

◆ read()

IniFile ph::IniFile::read ( const std::string & iniFilePath)
static

◆ save()

void ph::IniFile::save ( const std::string & iniFilePath)

◆ setCurrentSection() [1/2]

void ph::IniFile::setCurrentSection ( std::size_t sectionIdx)
inline

◆ setCurrentSection() [2/2]

void ph::IniFile::setCurrentSection ( std::string_view sectionName,
bool createIfNotExist = true )

◆ setProperty() [1/2]

void ph::IniFile::setProperty ( std::size_t propertyIdx,
std::string_view propertyValue )
inline

Set a property under current section by index.

◆ setProperty() [2/2]

void ph::IniFile::setProperty ( std::string_view propertyName,
std::string_view propertyValue,
bool createIfNotExist = true )

Set a property under current section by name.


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