1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Class Poco::Util::AbstractConfiguration</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-24"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="namespace"><a href="Poco.Util.html" class="namespace">Poco::Util</a></h1>
<h1 class="symbol">class AbstractConfiguration</h1>
</div>
<div class="body">
<p>
<b>Library:</b> Util<br />
<b>Package:</b> Configuration<br />
<b>Header:</b> Poco/Util/AbstractConfiguration.h</p>
<h2>Description</h2>
<div class="description">
<p><a href="Poco.Util.AbstractConfiguration.html" title="class Poco::Util::AbstractConfiguration">AbstractConfiguration</a> is an abstract base class for different kinds of configuration data, such as INI files, property files, <a href="Poco.XML.html" title="namespace Poco::XML">XML</a> configuration files or the Windows Registry. </p>
<p>Configuration property keys have a hierarchical format, consisting of names separated by periods. The exact interpretation of key names is up to the actual subclass implementation of <a href="Poco.Util.AbstractConfiguration.html" title="class Poco::Util::AbstractConfiguration">AbstractConfiguration</a>. <a href="Poco.Util.AbstractConfiguration.html#16320" title="Poco::Util::AbstractConfiguration::Keys">Keys</a> are case sensitive. </p>
<p>All public methods are synchronized, so the class is safe for multithreaded use. <a href="Poco.Util.AbstractConfiguration.html" title="class Poco::Util::AbstractConfiguration">AbstractConfiguration</a> implements reference counting based garbage collection. </p>
<p>Subclasses must override the <a href="Poco.Util.AbstractConfiguration.html#16374" title="Poco::Util::AbstractConfiguration::getRaw()">getRaw</a>(), <a href="Poco.Util.AbstractConfiguration.html#16377" title="Poco::Util::AbstractConfiguration::setRaw()">setRaw</a>() and <a href="Poco.Util.AbstractConfiguration.html#16380" title="Poco::Util::AbstractConfiguration::enumerate()">enumerate</a>() methods. </p>
</div>
<h2>Inheritance</h2>
<p><b>Direct Base Classes: </b><a href="Poco.RefCountedObject.html" title="class Poco::RefCountedObject">Poco::RefCountedObject</a></p>
<p><b>All Base Classes: </b><a href="Poco.RefCountedObject.html" title="class Poco::RefCountedObject">Poco::RefCountedObject</a></p>
<p><b>Known Derived Classes: </b><a href="Poco.Util.ConfigurationMapper.html" title="class Poco::Util::ConfigurationMapper">ConfigurationMapper</a>, <a href="Poco.Util.ConfigurationView.html" title="class Poco::Util::ConfigurationView">ConfigurationView</a>, <a href="Poco.Util.FilesystemConfiguration.html" title="class Poco::Util::FilesystemConfiguration">FilesystemConfiguration</a>, <a href="Poco.Util.IniFileConfiguration.html" title="class Poco::Util::IniFileConfiguration">IniFileConfiguration</a>, <a href="Poco.Util.LayeredConfiguration.html" title="class Poco::Util::LayeredConfiguration">LayeredConfiguration</a>, <a href="Poco.Util.MapConfiguration.html" title="class Poco::Util::MapConfiguration">MapConfiguration</a>, <a href="Poco.Util.PropertyFileConfiguration.html" title="class Poco::Util::PropertyFileConfiguration">PropertyFileConfiguration</a>, <a href="Poco.Util.SystemConfiguration.html" title="class Poco::Util::SystemConfiguration">SystemConfiguration</a>, <a href="Poco.Util.WinRegistryConfiguration.html" title="class Poco::Util::WinRegistryConfiguration">WinRegistryConfiguration</a>, <a href="Poco.Util.XMLConfiguration.html" title="class Poco::Util::XMLConfiguration">XMLConfiguration</a></p>
<h2>Member Summary</h2>
<p><b>Member Functions: </b><a href="Poco.Util.AbstractConfiguration.html#16368" title="Poco::Util::AbstractConfiguration::createView()">createView</a>, <a href="Poco.Util.AbstractConfiguration.html#16380" title="Poco::Util::AbstractConfiguration::enumerate()">enumerate</a>, <a href="Poco.Util.AbstractConfiguration.html#16372" title="Poco::Util::AbstractConfiguration::expand()">expand</a>, <a href="Poco.Util.AbstractConfiguration.html#16346" title="Poco::Util::AbstractConfiguration::getBool()">getBool</a>, <a href="Poco.Util.AbstractConfiguration.html#16341" title="Poco::Util::AbstractConfiguration::getDouble()">getDouble</a>, <a href="Poco.Util.AbstractConfiguration.html#16336" title="Poco::Util::AbstractConfiguration::getInt()">getInt</a>, <a href="Poco.Util.AbstractConfiguration.html#16374" title="Poco::Util::AbstractConfiguration::getRaw()">getRaw</a>, <a href="Poco.Util.AbstractConfiguration.html#16331" title="Poco::Util::AbstractConfiguration::getRawString()">getRawString</a>, <a href="Poco.Util.AbstractConfiguration.html#16326" title="Poco::Util::AbstractConfiguration::getString()">getString</a>, <a href="Poco.Util.AbstractConfiguration.html#16324" title="Poco::Util::AbstractConfiguration::hasOption()">hasOption</a>, <a href="Poco.Util.AbstractConfiguration.html#16322" title="Poco::Util::AbstractConfiguration::hasProperty()">hasProperty</a>, <a href="Poco.Util.AbstractConfiguration.html#16363" title="Poco::Util::AbstractConfiguration::keys()">keys</a>, <a href="Poco.Util.AbstractConfiguration.html#16385" title="Poco::Util::AbstractConfiguration::parseBool()">parseBool</a>, <a href="Poco.Util.AbstractConfiguration.html#16383" title="Poco::Util::AbstractConfiguration::parseInt()">parseInt</a>, <a href="Poco.Util.AbstractConfiguration.html#16360" title="Poco::Util::AbstractConfiguration::setBool()">setBool</a>, <a href="Poco.Util.AbstractConfiguration.html#16357" title="Poco::Util::AbstractConfiguration::setDouble()">setDouble</a>, <a href="Poco.Util.AbstractConfiguration.html#16354" title="Poco::Util::AbstractConfiguration::setInt()">setInt</a>, <a href="Poco.Util.AbstractConfiguration.html#16377" title="Poco::Util::AbstractConfiguration::setRaw()">setRaw</a>, <a href="Poco.Util.AbstractConfiguration.html#16351" title="Poco::Util::AbstractConfiguration::setString()">setString</a></p>
<p><b>Inherited Functions: </b><a href="Poco.RefCountedObject.html#9659" title="Poco::RefCountedObject::duplicate()">duplicate</a>, <a href="Poco.RefCountedObject.html#9661" title="Poco::RefCountedObject::referenceCount()">referenceCount</a>, <a href="Poco.RefCountedObject.html#9660" title="Poco::RefCountedObject::release()">release</a></p>
<h2>Types</h2>
<h3><a name="16320">Keys</a></h3>
<p class="decl">typedef std::vector < std::string > <a href="Poco.Util.AbstractConfiguration.html#16320" title="Poco::Util::AbstractConfiguration::Keys">Keys</a>;</p>
<div class="description">
<p></p>
</div>
<h2>Constructors</h2>
<h3><a name="16321">AbstractConfiguration</a></h3>
<p class="decl"><a href="Poco.Util.AbstractConfiguration.html" title="class Poco::Util::AbstractConfiguration">AbstractConfiguration</a>();</p>
<div class="description">
<p>Creates the <a href="Poco.Util.AbstractConfiguration.html" title="class Poco::Util::AbstractConfiguration">AbstractConfiguration</a>. </p>
</div>
<h2>Destructor</h2>
<h3><a name="16387">~AbstractConfiguration</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">virtual ~<a href="Poco.Util.AbstractConfiguration.html" title="class Poco::Util::AbstractConfiguration">AbstractConfiguration</a>();</p>
<div class="description">
<p></p>
</div>
<h2>Member Functions</h2>
<h3><a name="16368">createView</a></h3>
<p class="decl">const <a href="Poco.Util.AbstractConfiguration.html" title="class Poco::Util::AbstractConfiguration">AbstractConfiguration</a> * createView(<br /> const std::string & prefix<br />) const;</p>
<div class="description">
<p>Creates a non-mutable view (see <a href="Poco.Util.ConfigurationView.html" title="class Poco::Util::ConfigurationView">ConfigurationView</a>) into the configuration. </p>
</div>
<h3><a name="16370">createView</a></h3>
<p class="decl"><a href="Poco.Util.AbstractConfiguration.html" title="class Poco::Util::AbstractConfiguration">AbstractConfiguration</a> * createView(<br /> const std::string & prefix<br />);</p>
<div class="description">
<p>Creates a view (see <a href="Poco.Util.ConfigurationView.html" title="class Poco::Util::ConfigurationView">ConfigurationView</a>) into the configuration. </p>
</div>
<h3><a name="16372">expand</a></h3>
<p class="decl">std::string expand(<br /> const std::string & value<br />) const;</p>
<div class="description">
<p>Replaces all occurences of ${<property>} in value with the value of the <property>. If <property> does not exist, nothing is changed. </p>
<p>If a circular property reference is detected, a <a href="Poco.CircularReferenceException.html" title="class Poco::CircularReferenceException">CircularReferenceException</a> will be thrown. </p>
</div>
<h3><a name="16346">getBool</a></h3>
<p class="decl">bool getBool(<br /> const std::string & key<br />) const;</p>
<div class="description">
<p>Returns the double value of the property with the given name. Throws a <a href="Poco.NotFoundException.html" title="class Poco::NotFoundException">NotFoundException</a> if the key does not exist. Throws a <a href="Poco.SyntaxException.html" title="class Poco::SyntaxException">SyntaxException</a> if the property can not be converted to a double. If the value contains references to other properties (${<property>}), these are expanded. </p>
</div>
<h3><a name="16348">getBool</a></h3>
<p class="decl">bool getBool(<br /> const std::string & key,<br /> bool defaultValue<br />) const;</p>
<div class="description">
<p>If a property with the given key exists, returns the property's bool value, otherwise returns the given default value. Throws a <a href="Poco.SyntaxException.html" title="class Poco::SyntaxException">SyntaxException</a> if the property can not be converted to a boolean. The following string values can be converted into a boolean: </p>
<ul>
<li>numerical values: non zero becomes true, zero becomes false </li>
<li>strings: true, yes, on become true, false, no, off become false </li>
</ul>
<p>Case does not matter. If the value contains references to other properties (${<property>}), these are expanded. </p>
</div>
<h3><a name="16341">getDouble</a></h3>
<p class="decl">double getDouble(<br /> const std::string & key<br />) const;</p>
<div class="description">
<p>Returns the double value of the property with the given name. Throws a <a href="Poco.NotFoundException.html" title="class Poco::NotFoundException">NotFoundException</a> if the key does not exist. Throws a <a href="Poco.SyntaxException.html" title="class Poco::SyntaxException">SyntaxException</a> if the property can not be converted to a double. If the value contains references to other properties (${<property>}), these are expanded. </p>
</div>
<h3><a name="16343">getDouble</a></h3>
<p class="decl">double getDouble(<br /> const std::string & key,<br /> double defaultValue<br />) const;</p>
<div class="description">
<p>If a property with the given key exists, returns the property's double value, otherwise returns the given default value. Throws a <a href="Poco.SyntaxException.html" title="class Poco::SyntaxException">SyntaxException</a> if the property can not be converted to an double. If the value contains references to other properties (${<property>}), these are expanded. </p>
</div>
<h3><a name="16336">getInt</a></h3>
<p class="decl">int getInt(<br /> const std::string & key<br />) const;</p>
<div class="description">
<p>Returns the int value of the property with the given name. Throws a <a href="Poco.NotFoundException.html" title="class Poco::NotFoundException">NotFoundException</a> if the key does not exist. Throws a <a href="Poco.SyntaxException.html" title="class Poco::SyntaxException">SyntaxException</a> if the property can not be converted to an int. Numbers starting with 0x are treated as hexadecimal. If the value contains references to other properties (${<property>}), these are expanded. </p>
</div>
<h3><a name="16338">getInt</a></h3>
<p class="decl">int getInt(<br /> const std::string & key,<br /> int defaultValue<br />) const;</p>
<div class="description">
<p>If a property with the given key exists, returns the property's int value, otherwise returns the given default value. Throws a <a href="Poco.SyntaxException.html" title="class Poco::SyntaxException">SyntaxException</a> if the property can not be converted to an int. Numbers starting with 0x are treated as hexadecimal. If the value contains references to other properties (${<property>}), these are expanded. </p>
</div>
<h3><a name="16331">getRawString</a></h3>
<p class="decl">std::string getRawString(<br /> const std::string & key<br />) const;</p>
<div class="description">
<p>Returns the raw string value of the property with the given name. Throws a <a href="Poco.NotFoundException.html" title="class Poco::NotFoundException">NotFoundException</a> if the key does not exist. References to other properties are not expanded. </p>
</div>
<h3><a name="16333">getRawString</a></h3>
<p class="decl">std::string getRawString(<br /> const std::string & key,<br /> const std::string & defaultValue<br />) const;</p>
<div class="description">
<p>If a property with the given key exists, returns the property's raw string value, otherwise returns the given default value. References to other properties are not expanded. </p>
</div>
<h3><a name="16326">getString</a></h3>
<p class="decl">std::string getString(<br /> const std::string & key<br />) const;</p>
<div class="description">
<p>Returns the string value of the property with the given name. Throws a <a href="Poco.NotFoundException.html" title="class Poco::NotFoundException">NotFoundException</a> if the key does not exist. If the value contains references to other properties (${<property>}), these are expanded. </p>
</div>
<h3><a name="16328">getString</a></h3>
<p class="decl">std::string getString(<br /> const std::string & key,<br /> const std::string & defaultValue<br />) const;</p>
<div class="description">
<p>If a property with the given key exists, returns the property's string value, otherwise returns the given default value. If the value contains references to other properties (${<property>}), these are expanded. </p>
</div>
<h3><a name="16324">hasOption</a></h3>
<p class="decl">bool hasOption(<br /> const std::string & key<br />) const;</p>
<div class="description">
<p>Returns true if and only if the property with the given key exists. Same as <a href="Poco.Util.AbstractConfiguration.html#16322" title="Poco::Util::AbstractConfiguration::hasProperty()">hasProperty</a>(). </p>
</div>
<h3><a name="16322">hasProperty</a></h3>
<p class="decl">bool hasProperty(<br /> const std::string & key<br />) const;</p>
<div class="description">
<p>Returns true if and only if the property with the given key exists. </p>
</div>
<h3><a name="16363">keys</a></h3>
<p class="decl">void keys(<br /> <a href="Poco.Util.AbstractConfiguration.html#16320" title="Poco::Util::AbstractConfiguration::Keys">Keys</a> & range<br />) const;</p>
<div class="description">
<p>Returns in range the names of all keys at root level. </p>
</div>
<h3><a name="16365">keys</a></h3>
<p class="decl">void keys(<br /> const std::string & key,<br /> <a href="Poco.Util.AbstractConfiguration.html#16320" title="Poco::Util::AbstractConfiguration::Keys">Keys</a> & range<br />) const;</p>
<div class="description">
<p>Returns in range the names of all subkeys under the given key. If an empty key is passed, all root level keys are returned. </p>
</div>
<h3><a name="16360">setBool</a></h3>
<p class="decl">void setBool(<br /> const std::string & key,<br /> bool value<br />);</p>
<div class="description">
<p>Sets the property with the given key to the given value. An already existing value for the key is overwritten. </p>
</div>
<h3><a name="16357">setDouble</a></h3>
<p class="decl">void setDouble(<br /> const std::string & key,<br /> double value<br />);</p>
<div class="description">
<p>Sets the property with the given key to the given value. An already existing value for the key is overwritten. </p>
</div>
<h3><a name="16354">setInt</a></h3>
<p class="decl">void setInt(<br /> const std::string & key,<br /> int value<br />);</p>
<div class="description">
<p>Sets the property with the given key to the given value. An already existing value for the key is overwritten. </p>
</div>
<h3><a name="16351">setString</a></h3>
<p class="decl">void setString(<br /> const std::string & key,<br /> const std::string & value<br />);</p>
<div class="description">
<p>Sets the property with the given key to the given value. An already existing value for the key is overwritten. </p>
</div>
<h3><a name="16380">enumerate</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">virtual void enumerate(<br /> const std::string & key,<br /> <a href="Poco.Util.AbstractConfiguration.html#16320" title="Poco::Util::AbstractConfiguration::Keys">Keys</a> & range<br />) const = 0;</p>
<div class="description">
<p>Returns in range the names of all subkeys under the given key. If an empty key is passed, all root level keys are returned. </p>
</div>
<h3><a name="16374">getRaw</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">virtual bool getRaw(<br /> const std::string & key,<br /> std::string & value<br />) const = 0;</p>
<div class="description">
<p>If the property with the given key exists, stores the property's value in value and returns true. Otherwise, returns false. </p>
<p>Must be overridden by subclasses. </p>
</div>
<h3><a name="16385">parseBool</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static bool parseBool(<br /> const std::string & value<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="16383">parseInt</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static int parseInt(<br /> const std::string & value<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="16377">setRaw</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">virtual void setRaw(<br /> const std::string & key,<br /> const std::string & value<br />) = 0;</p>
<div class="description">
<p>Sets the property with the given key to the given value. An already existing value for the key is overwritten. </p>
<p>Must be overridden by subclasses. </p>
</div>
<p class="footer">POCO C++ Libraries 1.3.6-all<br />
Copyright © 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p>
</div>
</body>
</html>
|