ini

Portable module for reading and writing INI files. ini.d version 0.6

class IniKey: ini.IniLine;
Key in an INI file.

char[] name();
Property:
get key name.

char[] value();
Property:
get key value.

class IniSection;
Section of keys in an INI file.

char[] name();
Property:
get section name.

void name(char[] newName);
Property:
set section name.

int opApply(int delegate(inout IniKey) dg);
foreach key.

IniKey[] keys();
Property:
get all keys.

IniKey key(char[] keyName);
Returns:
key matching keyName, or null if not present.

void setValue(IniKey ikey, char[] newValue);
Set an existing key's value.

void setValue(char[] keyName, char[] newValue);
Find or create key keyName and set its value to newValue.

void value(IniKey ikey, char[] newValue);
Same as setValue(ikey, newValue).

void value(char[] keyName, char[] newValue);
Same as setValue(keyName, newValue).

char[] getValue(char[] keyName, char[] defaultValue = null);
Returns:
value of the existing key keyName, or defaultValue if not present.

char[] value(char[] keyName);
Same as getValue(keyName, null).

char[] opIndex(char[] keyName);
Shortcut for getValue(keyName).

void opIndexAssign(char[] newValue, char[] keyName);
Shortcut for setValue(keyName, newValue).

void remove(char[] keyName);
Remove key keyName.

class Ini;
An INI file.

this(char[] file);
Construct a new INI file.

bool match(char[] s1, char[] s2);
Comparison function for section and key names. Override to change behavior.

void open(char[] file);
Open an INI file.

void rehash();
Reload INI file; any unsaved changes are lost.

void dump();
Release memory without saving changes; contents become empty.

bool modified();
Property:
get whether or not the INI file was modified since it was loaded or saved.

protected final void saveToStream(Stream f);
Params:
Stream f an opened-for-write stream; save() uses BufferedFile by default. Override save() to change stream.

void save();
Write contents to disk, even if no changes were made. It is common to do if(modified)save();

IniSection section(char[] name);
Finds a section; returns null if one named name does not exist.

IniSection opIndex(char[] sectionName);
Shortcut for section(sectionName).

IniSection addSection(char[] name);
The section is created if one named name does not exist.

Returns:
Section named name.

int opApply(int delegate(inout IniSection) dg);
foreach section.

IniSection[] sections();
Property:
get all sections.

void remove(char[] sectionName);
Remove section named sectionName.


Page generated by Ddoc.