OGRE: Ogre::ConfigFile Class Reference

| OGRE 14.5 Object-Oriented Graphics Rendering Engine

Loading...
Searching...
No Matches
Ogre::ConfigFile Class Reference
Core » General

Class for quickly loading settings from a text file. More...

`#include <OgreConfigFile.h>`

Inheritance diagram for Ogre::ConfigFile:
[legend]

## Public Types
typedef MapIterator< SettingsBySection > | SectionIterator
typedef std::map< String, SettingsMultiMap * > | SettingsBySection
| Gets an iterator for stepping through all the keys / values in the file.
typedef std::map< String, SettingsMultiMap > | SettingsBySection_
typedef MapIterator< SettingsMultiMap > | SettingsIterator
typedef std::multimap< String, String > | SettingsMultiMap

## Public Member Functions
| ConfigFile ()
void | clear (void)
| Clear the settings.
StringVector | getMultiSetting (const String &key, const String &section=BLANKSTRING) const
| Gets all settings from the file with the named key.
SectionIterator | getSectionIterator (void)
String | getSetting (const String &key, const String &section=BLANKSTRING, const String &defaultValue=BLANKSTRING) const
| Gets the first setting from the file with the named key.
const SettingsMultiMap & | getSettings (const String &section=BLANKSTRING) const
| Get all the available settings in a section.
const SettingsBySection_ & | getSettingsBySection () const
| Get all the available settings grouped by sections.
SettingsIterator | getSettingsIterator (const String &section=BLANKSTRING)
void | load (const DataStreamPtr &stream, const String &separators="\t:=", bool trimWhitespace=true)
| load from a data stream
void | load (const String &filename, const String &resourceGroup, const String &separators="\t:=", bool trimWhitespace=true)
| load from a filename (using resource group locations)
void | load (const String &filename, const String &separators="\t:=", bool trimWhitespace=true)
| load from a filename (not using resource group locations)
void | loadDirect (const String &filename, const String &separators="\t:=", bool trimWhitespace=true)
| load from a filename (not using resource group locations)
void | loadFromResourceSystem (const String &filename, const String &resourceGroup, const String &separators="\t:=", bool trimWhitespace=true)
| load from a filename (using resource group locations)

## Detailed Description

Class for quickly loading settings from a text file.

This class is designed to quickly parse a simple file containing key/value pairs, mainly for use in configuration settings.

  This is a very simplified approach, no multiple values per key are allowed, no grouping or context is being kept etc.

  By default the key/values pairs are tokenised based on a separator of Tab, the colon (:) or equals (=) character. Each key - value pair must end in a carriage return.

  Settings can be optionally grouped in sections, using a header beforehand of the form [SectionName].

## Member Typedef Documentation

## ◆ SettingsMultiMap

typedef std::multimap<String, String> Ogre::ConfigFile::SettingsMultiMap

## ◆ SettingsIterator

typedef MapIterator<SettingsMultiMap> Ogre::ConfigFile::SettingsIterator

## ◆ SettingsBySection

typedef std::map<String, SettingsMultiMap*> Ogre::ConfigFile::SettingsBySection

Gets an iterator for stepping through all the keys / values in the file.

## ◆ SettingsBySection_

typedef std::map<String, SettingsMultiMap> Ogre::ConfigFile::SettingsBySection_

## ◆ SectionIterator

typedef MapIterator<SettingsBySection> Ogre::ConfigFile::SectionIterator

## Constructor & Destructor Documentation

## ◆ ConfigFile()

Ogre::ConfigFile::ConfigFile | ( |  | ) |

## Member Function Documentation

## ◆ load() [1/3]

void Ogre::ConfigFile::load | ( | const String & | filename,
|  | const String & | separators = "\t:=",
|  | bool | trimWhitespace = true )

load from a filename (not using resource group locations)

## ◆ load() [2/3]

void Ogre::ConfigFile::load | ( | const String & | filename,
|  | const String & | resourceGroup,
|  | const String & | separators = "\t:=",
|  | bool | trimWhitespace = true )

load from a filename (using resource group locations)

## ◆ load() [3/3]

void Ogre::ConfigFile::load | ( | const DataStreamPtr & | stream,
|  | const String & | separators = "\t:=",
|  | bool | trimWhitespace = true )

load from a data stream

## ◆ loadDirect()

void Ogre::ConfigFile::loadDirect | ( | const String & | filename,
|  | const String & | separators = "\t:=",
|  | bool | trimWhitespace = true )

load from a filename (not using resource group locations)

## ◆ loadFromResourceSystem()

void Ogre::ConfigFile::loadFromResourceSystem | ( | const String & | filename,
|  | const String & | resourceGroup,
|  | const String & | separators = "\t:=",
|  | bool | trimWhitespace = true )

load from a filename (using resource group locations)

## ◆ getSetting()

String Ogre::ConfigFile::getSetting | ( | const String & | key,
|  | const String & | section = BLANKSTRING,
|  | const String & | defaultValue = BLANKSTRING ) const

Gets the first setting from the file with the named key.

Parameters

  key | The name of the setting
  section | The name of the section it must be in (if any)
  defaultValue | The value to return if the setting is not found

References Ogre::BLANKSTRING.

## ◆ getMultiSetting()

StringVector Ogre::ConfigFile::getMultiSetting | ( | const String & | key,
|  | const String & | section = BLANKSTRING ) const

Gets all settings from the file with the named key.

References Ogre::BLANKSTRING.

## ◆ getSectionIterator()

SectionIterator Ogre::ConfigFile::getSectionIterator | ( | void |  | ) |

Deprecated
  use getSettingsBySection()

## ◆ getSettingsBySection()

const SettingsBySection_ & Ogre::ConfigFile::getSettingsBySection | ( |  | ) | const
| inline

Get all the available settings grouped by sections.

## ◆ getSettingsIterator()

SettingsIterator Ogre::ConfigFile::getSettingsIterator | ( | const String & | section = BLANKSTRING | ) |

Deprecated
  use getSettings()

References Ogre::BLANKSTRING.

## ◆ getSettings()

const SettingsMultiMap & Ogre::ConfigFile::getSettings | ( | const String & | section = BLANKSTRING | ) | const

Get all the available settings in a section.

References Ogre::BLANKSTRING.

## ◆ clear()

void Ogre::ConfigFile::clear | ( | void |  | ) |

Clear the settings.

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

- OgreConfigFile.h