Ini

A class representing the <a href="http://en.wikipedia.org/wiki/INI_file">INI</a> text configuration format. <p/> An Ini instance is a map of {@link IniSection IniSection}s, keyed by section name. Each {@code IniSection} is itself a map of {@code string} name/value pairs. Name/value pairs are guaranteed to be unique within each {@code IniSection} only - not across the entire {@code Ini} instance.

@since 1.0

class Ini : Map!(string, IniSection) {}

Constructors

this
this()

Creates a new empty {@code Ini} instance.

this
this(Ini defaults)

Creates a new {@code Ini} instance with the specified defaults.

Members

Functions

addSection
IniSection addSection(string sectionName)

Ensures a section with the specified name exists, adding a new one if it does not yet exist.

byKey
InputRange!string byKey()
Undocumented in source. Be warned that the author may not have intended to support it.
byValue
InputRange!IniSection byValue()
Undocumented in source. Be warned that the author may not have intended to support it.
clear
void clear()
Undocumented in source. Be warned that the author may not have intended to support it.
containsKey
bool containsKey(string key)
Undocumented in source. Be warned that the author may not have intended to support it.
containsValue
bool containsValue(IniSection value)
Undocumented in source. Be warned that the author may not have intended to support it.
get
IniSection get(string key)
Undocumented in source. Be warned that the author may not have intended to support it.
getSection
IniSection getSection(string sectionName)

Returns the {@link IniSection} with the given name or {@code null} if no section with that name exists.

getSectionNames
string[] getSectionNames()

Returns the names of all sections managed by this {@code Ini} instance or an empty collection if there are no sections.

getSectionProperty
string getSectionProperty(string sectionName, string propertyName)

Returns the value of the specified section property, or {@code null} if the section or property do not exist.

getSectionProperty
string getSectionProperty(string sectionName, string propertyName, string defaultValue)

Returns the value of the specified section property, or the {@code defaultValue} if the section or property do not exist.

getSections
IniSection[] getSections()

Returns the sections managed by this {@code Ini} instance or an empty collection if there are no sections.

isEmpty
bool isEmpty()

Returns {@code true} if no sections have been configured, or if there are sections, but the sections themselves are all empty, {@code false} otherwise.

load
void load(string iniConfig)

Loads the specified raw INI-formatted text into this instance.

loadFromPath
void loadFromPath(string resourcePath)

Loads data from the specified resource path into this current {@code Ini} instance. The resource path may be any value interpretable by the {@link ResourceUtils#getInputStreamForPath(string) ResourceUtils.getInputStreamForPath} method.

merge
void merge(Map!(string, IniSection) m)

Merges the contents of <code>m</code>'s {@link IniSection} objects into self. This differs from {@link Ini#putAll(Map)}, in that each section is merged with the existing one. For example the following two ini blocks are merged and the result is the third<BR/> <p> Initial: <pre> <code>section1 key1 = value1

opApply
int opApply(int delegate(ref string, ref IniSection) dg)
Undocumented in source. Be warned that the author may not have intended to support it.
opApply
int opApply(int delegate(MapEntry!(string, IniSection) entry) dg)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(IObject o)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(Object obj)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
IniSection opIndex(string key)
Undocumented in source. Be warned that the author may not have intended to support it.
put
IniSection put(string key, IniSection value)
Undocumented in source. Be warned that the author may not have intended to support it.
putAll
void putAll(Map!(string, IniSection) m)
Undocumented in source. Be warned that the author may not have intended to support it.
putIfAbsent
IniSection putIfAbsent(string key, IniSection value)
Undocumented in source. Be warned that the author may not have intended to support it.
remove
bool remove(string key, IniSection value)
Undocumented in source. Be warned that the author may not have intended to support it.
remove
IniSection remove(string key)
Undocumented in source. Be warned that the author may not have intended to support it.
removeSection
IniSection removeSection(string sectionName)

Removes the section with the specified name and returns it, or {@code null} if the section did not exist.

replace
bool replace(string key, IniSection oldValue, IniSection newValue)
Undocumented in source. Be warned that the author may not have intended to support it.
replace
IniSection replace(string key, IniSection value)
Undocumented in source. Be warned that the author may not have intended to support it.
setSectionProperty
void setSectionProperty(string sectionName, string propertyName, string propertyValue)

Sets a name/value pair for the section with the given {@code sectionName}. If the section does not yet exist, it will be created. If the {@code sectionName} is null or empty, the name/value pair will be placed in the default (unnamed, empty string) section.

size
int size()
Undocumented in source. Be warned that the author may not have intended to support it.
toHash
size_t toHash()
Undocumented in source. Be warned that the author may not have intended to support it.
toString
string toString()
Undocumented in source. Be warned that the author may not have intended to support it.
values
IniSection[] values()
Undocumented in source. Be warned that the author may not have intended to support it.

Mixins

__anonymous
mixin CloneMemberTemplate!(typeof(this))
Undocumented in source.

Static functions

fromResourcePath
Ini fromResourcePath(string resourcePath)

Creates a new {@code Ini} instance loaded with the INI-formatted data in the resource at the given path. The resource path may be any value interpretable by the {@link ResourceUtils#getInputStreamForPath(string) ResourceUtils.getInputStreamForPath} method.

getSectionName
string getSectionName(string line)
Undocumented in source. Be warned that the author may not have intended to support it.
isSectionHeader
bool isSectionHeader(string line)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

COMMENT_POUND
enum string COMMENT_POUND;
Undocumented in source.
COMMENT_SEMICOLON
enum string COMMENT_SEMICOLON;
Undocumented in source.
DEFAULT_CHARSET_NAME
enum string DEFAULT_CHARSET_NAME;
Undocumented in source.
DEFAULT_SECTION_NAME
enum string DEFAULT_SECTION_NAME;
Undocumented in source.
SECTION_PREFIX
enum string SECTION_PREFIX;
Undocumented in source.
SECTION_SUFFIX
enum string SECTION_SUFFIX;
Undocumented in source.

Meta