Etterna 0.74.4
Loading...
Searching...
No Matches
Public Member Functions | List of all members
IniFile Class Reference

The functions to read and write .INI files. More...

#include <IniFile.h>

Inheritance diagram for IniFile:
Inheritance graph
[legend]
Collaboration diagram for IniFile:
Collaboration graph
[legend]

Public Member Functions

 IniFile ()
 Set up an INI file with the defaults.
 
auto GetPath () const -> std::string
 Retrieve the filename of the last file loaded.
 
auto GetError () const -> const std::string &
 Retrieve any errors that have occurred.
 
auto ReadFile (const std::string &sPath) -> bool
 
auto ReadFile (RageFileBasic &sFile) -> bool
 
auto WriteFile (const std::string &sPath) const -> bool
 
auto WriteFile (RageFileBasic &sFile) const -> bool
 
template<typename T >
auto GetValue (const std::string &sKey, const std::string &sValueName, T &value) const -> bool
 
template<typename T >
void SetValue (const std::string &sKey, const std::string &sValueName, const T &value)
 
template<typename T >
void SetKeyValue (XNode *keynode, const std::string &sValueName, const T &value)
 
auto DeleteKey (const std::string &keyname) -> bool
 
auto DeleteValue (const std::string &keyname, const std::string &valuename) -> bool
 
auto RenameKey (const std::string &from, const std::string &to) -> bool
 Rename a key.
 
- Public Member Functions inherited from XNode
void SetName (const std::string &sName)
 
auto GetName () const -> const std::string &
 
template<typename T >
void GetTextValue (T &out) const
 
auto GetAttr (const std::string &sAttrName) const -> const XNodeValue *
 
auto GetAttr (const std::string &sAttrName) -> XNodeValue *
 
template<typename T >
auto GetAttrValue (const std::string &sName, T &out) const -> bool
 
auto PushAttrValue (lua_State *L, const std::string &sName) const -> bool
 
auto GetChildrenBegin () -> XNodes::iterator
 
auto GetChildrenBegin () const -> XNodes::const_iterator
 
auto GetChildrenEnd () -> XNodes::iterator
 
auto GetChildrenEnd () const -> XNodes::const_iterator
 
auto ChildrenEmpty () const -> bool
 
auto GetChild (const std::string &sName) const -> const XNode *
 
auto GetChild (const std::string &sName) -> XNode *
 
template<typename T >
auto GetChildValue (const std::string &sName, T &out) const -> bool
 
auto PushChildValue (lua_State *L, const std::string &sName) const -> bool
 
template<typename T >
auto AppendChild (const std::string &sName, T value) -> XNode *
 
auto AppendChild (const std::string &sName) -> XNode *
 
auto AppendChild (XNode *node) -> XNode *
 
auto RemoveChild (XNode *node, bool bDelete=true) -> bool
 
void RemoveChildFromByName (XNode *node)
 
void RenameChildInByName (XNode *node)
 
auto AppendAttrFrom (const std::string &sName, XNodeValue *pValue, bool bOverwrite=true) -> XNodeValue *
 
auto AppendAttr (const std::string &sName) -> XNodeValue *
 
template<typename T >
auto AppendAttr (const std::string &sName, T value) -> XNodeValue *
 
auto RemoveAttr (const std::string &sName) -> bool
 
 XNode (const std::string &sName)
 
 XNode (const XNode &cpy)
 
void Clear ()
 

Additional Inherited Members

- Public Attributes inherited from XNode
std::string m_sName
 
XAttrs m_attrs
 
- Static Public Attributes inherited from XNode
static const std::string TEXT_ATTRIBUTE = "__TEXT__"
 

Detailed Description

The functions to read and write .INI files.

Member Function Documentation

◆ GetError()

auto IniFile::GetError ( ) const -> const std::string&
inline

Retrieve any errors that have occurred.

Returns
the latest error.

◆ GetPath()

auto IniFile::GetPath ( ) const -> std::string
inline

Retrieve the filename of the last file loaded.

Returns
the filename.

◆ RenameKey()

bool IniFile::RenameKey ( const std::string &  from,
const std::string &  to 
) -> bool

Rename a key.

For example, call RenameKey("foo", "main") after reading an INI where [foo] is an alias to [main]. If to already exists, nothing happens.

Parameters
fromthe key to rename.
tothe new key name.
Returns
its success or failure.

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