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 map< String, SettingsMultiMap * >::type | SettingsBySection
| Gets an iterator for stepping through all the keys / values in the file. More...
typedef MapIterator< SettingsMultiMap > | SettingsIterator
typedef multimap< String, String >::type | SettingsMultiMap

## Public Member Functions

| ConfigFile ()
virtual | ~ConfigFile ()
void | clear (void)
| Clear the settings. More...
StringVector | getMultiSetting (const String &key, const String &section=StringUtil::BLANK) const
| Gets all settings from the file with the named key. More...
SectionIterator | getSectionIterator (void)
| Get an iterator over all the available sections in the config file. More...
String | getSetting (const String &key, const String &section=StringUtil::BLANK, const String &defaultValue=StringUtil::BLANK) const
| Gets the first setting from the file with the named key. More...
SettingsIterator | getSettingsIterator (const String &section=StringUtil::BLANK)
| Get an iterator over all the available settings in a section. More...
void | load (const String &filename, const String &separators="\=", bool trimWhitespace=true)
| load from a filename (not using resource group locations) More...
void | load (const DataStreamPtr &stream, const String &separators="\=", bool trimWhitespace=true)
| load from a data stream More...
void | loadDirect (const String &filename, const String &separators="\=", bool trimWhitespace=true)
| load from a filename (not using resource group locations) More...
void | loadFromResourceSystem (const String &filename, const String &resourceGroup, const String &separators="\=", bool trimWhitespace=true)
| load from a filename (using resource group locations) More...
void | operator delete (void *ptr)
void | operator delete (void *ptr, void *)
void | operator delete (void *ptr, const char *, int, const char *)
void | operator delete[] (void *ptr)
void | operator delete[] (void *ptr, const char *, int, const char *)
void * | operator new (size_t sz, const char *file, int line, const char *func)
| operator new, with debug line info More...
void * | operator new (size_t sz)
void * | operator new (size_t sz, void *ptr)
| placement operator new More...
void * | operator new[] (size_t sz, const char *file, int line, const char *func)
| array operator new, with debug line info More...
void * | operator new[] (size_t sz)

## Protected Attributes

SettingsBySection | mSettings

## 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].

Definition at line 62 of file OgreConfigFile.h.

## Member Typedef Documentation

## SectionIterator

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

Definition at line 90 of file OgreConfigFile.h.

## SettingsBySection

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

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

Definition at line 89 of file OgreConfigFile.h.

## SettingsIterator

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

Definition at line 87 of file OgreConfigFile.h.

## SettingsMultiMap

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

Definition at line 86 of file OgreConfigFile.h.

## Constructor & Destructor Documentation

## ConfigFile()

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

## ~ConfigFile()

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

virtual

## Member Function Documentation

## clear()

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

Clear the settings.

## getMultiSetting()

StringVector Ogre::ConfigFile::getMultiSetting | ( | const String & | key,
|  | const String & | section = `StringUtil::BLANK`
| ) |  | const

Gets all settings from the file with the named key.

## getSectionIterator()

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

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

## getSetting()

String Ogre::ConfigFile::getSetting | ( | const String & | key,
|  | const String & | section = `StringUtil::BLANK`,
|  | const String & | defaultValue = `StringUtil::BLANK`
| ) |  | 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

## getSettingsIterator()

SettingsIterator Ogre::ConfigFile::getSettingsIterator | ( | const String & | section = `StringUtil::BLANK` | ) |

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

## load() [1/2]

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

load from a filename (not using resource group locations)

## load() [2/2]

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

load from a data stream

## loadDirect()

void Ogre::ConfigFile::loadDirect | ( | const String & | filename,
|  | const String & | separators = `"\="`,
|  | 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 = `"\="`,
|  | bool | trimWhitespace = `true`
| ) |  |

load from a filename (using resource group locations)

## operator delete() [1/3]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr | ) |

inherited

Definition at line 96 of file OgreMemoryAllocatedObject.h.

## operator delete() [2/3]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr,
|  | void * |
| ) |  |

inherited

Definition at line 102 of file OgreMemoryAllocatedObject.h.

## operator delete() [3/3]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr,
|  | const char * | ,
|  | int | ,
|  | const char * |
| ) |  |

inherited

Definition at line 108 of file OgreMemoryAllocatedObject.h.

## operator delete[]() [1/2]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr | ) |

inherited

Definition at line 113 of file OgreMemoryAllocatedObject.h.

## operator delete[]() [2/2]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr,
|  | const char * | ,
|  | int | ,
|  | const char * |
| ) |  |

inherited

Definition at line 119 of file OgreMemoryAllocatedObject.h.

## operator new() [1/3]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz,
|  | const char * | file,
|  | int | line,
|  | const char * | func
| ) |  |

inherited

operator new, with debug line info

Definition at line 68 of file OgreMemoryAllocatedObject.h.

## operator new() [2/3]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz | ) |

inherited

Definition at line 73 of file OgreMemoryAllocatedObject.h.

## operator new() [3/3]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz,
|  | void * | ptr
| ) |  |

inherited

placement operator new

Definition at line 79 of file OgreMemoryAllocatedObject.h.

## operator new[]() [1/2]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz,
|  | const char * | file,
|  | int | line,
|  | const char * | func
| ) |  |

inherited

array operator new, with debug line info

Definition at line 86 of file OgreMemoryAllocatedObject.h.

## operator new[]() [2/2]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz | ) |

inherited

Definition at line 91 of file OgreMemoryAllocatedObject.h.

## Member Data Documentation

## mSettings

SettingsBySection Ogre::ConfigFile::mSettings

protected

Definition at line 101 of file OgreConfigFile.h.

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

- OgreConfigFile.h

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.