OGRE-Next  3.0.0unstable
Object-Oriented Graphics Rendering Engine
Ogre::ConfigFile Class Reference

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

#include <OgreConfigFile.h>

+ Inheritance diagram for Ogre::ConfigFile:

Public Types

typedef MapIterator< SettingsBySectionSectionIterator
 
typedef map< String, SettingsMultiMap * >::type SettingsBySection
 Gets an iterator for stepping through all the keys / values in the file. More...
 
typedef MapIterator< SettingsMultiMapSettingsIterator
 
typedef multimap< String, String >::type SettingsMultiMap
 

Public Member Functions

 ConfigFile ()
 
virtual ~ConfigFile ()
 
void clear ()
 Clear the settings. More...
 
StringVector getMultiSetting (const String &key, const String &section=BLANKSTRING) const
 Gets all settings from the file with the named key. More...
 
SectionIterator getSectionIterator ()
 Get an iterator over all the available sections in the config file. More...
 
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. More...
 
SettingsIterator getSettingsIterator (const String &section=BLANKSTRING)
 Get an iterator over all the available settings in a section. More...
 
void load (const DataStreamPtr &stream, const String &separators="\t:=", bool trimWhitespace=true)
 load from a data stream More...
 
void load (const String &filename, const String &resourceGroup, const String &separators="\t:=", bool trimWhitespace=true)
 load from a filename (using resource group locations) More...
 
void load (const String &filename, const String &separators="\t:=", bool trimWhitespace=true)
 load from a filename (not using resource group locations) More...
 
void loadDirect (const String &filename, const String &separators="\t:=", bool trimWhitespace=true)
 load from a filename (not using resource group locations) More...
 
void loadFromResourceSystem (const String &filename, const String &resourceGroup, const String &separators="\t:=", bool trimWhitespace=true)
 load from a filename (using resource group locations) More...
 

Detailed Description

Class for quickly loading settings from a text file.

Remarks
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

◆ SectionIterator

◆ SettingsBySection

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

◆ SettingsIterator

◆ SettingsMultiMap

Constructor & Destructor Documentation

◆ ConfigFile()

Ogre::ConfigFile::ConfigFile ( )

◆ ~ConfigFile()

virtual Ogre::ConfigFile::~ConfigFile ( )
virtual

Member Function Documentation

◆ clear()

void Ogre::ConfigFile::clear ( )

Clear the settings.

◆ getMultiSetting()

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

Gets all settings from the file with the named key.

◆ getSectionIterator()

SectionIterator Ogre::ConfigFile::getSectionIterator ( )

Get an iterator over all the available sections in the config file.

◆ 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
keyThe name of the setting
sectionThe name of the section it must be in (if any)
defaultValueThe value to return if the setting is not found

◆ getSettingsIterator()

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

Get an iterator over all the available settings in a section.

◆ load() [1/3]

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

load from a data stream

◆ 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 String filename,
const String separators = "\t:=",
bool  trimWhitespace = true 
)

load from a filename (not using resource group locations)

◆ 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)


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