root/library/doc/html/classbdm_1_1SettingResolver.html @ 398

Revision 398, 12.3 kB (checked in by smidl, 15 years ago)

doc 2

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3<title>mixpp: bdm::SettingResolver Class Reference</title>
4<link href="tabs.css" rel="stylesheet" type="text/css">
5<link href="doxygen.css" rel="stylesheet" type="text/css">
6</head><body>
7<!-- Generated by Doxygen 1.5.8 -->
8<script type="text/javascript">
9<!--
10function changeDisplayState (e){
11  var num=this.id.replace(/[^[0-9]/g,'');
12  var button=this.firstChild;
13  var sectionDiv=document.getElementById('dynsection'+num);
14  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
15    sectionDiv.style.display='block';
16    button.src='open.gif';
17  }else{
18    sectionDiv.style.display='none';
19    button.src='closed.gif';
20  }
21}
22function initDynSections(){
23  var divs=document.getElementsByTagName('div');
24  var sectionCounter=1;
25  for(var i=0;i<divs.length-1;i++){
26    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
27      var header=divs[i];
28      var section=divs[i+1];
29      var button=header.firstChild;
30      if (button!='IMG'){
31        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
32        button=document.createElement('img');
33        divs[i].insertBefore(button,divs[i].firstChild);
34      }
35      header.style.cursor='pointer';
36      header.onclick=changeDisplayState;
37      header.id='dynheader'+sectionCounter;
38      button.src='closed.gif';
39      section.id='dynsection'+sectionCounter;
40      section.style.display='none';
41      section.style.marginLeft='14px';
42      sectionCounter++;
43    }
44  }
45}
46window.onload = initDynSections;
47-->
48</script>
49<div class="navigation" id="top">
50  <div class="tabs">
51    <ul>
52      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
53      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
54      <li><a href="modules.html"><span>Modules</span></a></li>
55      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
56      <li><a href="files.html"><span>Files</span></a></li>
57    </ul>
58  </div>
59  <div class="tabs">
60    <ul>
61      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
62      <li><a href="classes.html"><span>Class&nbsp;Index</span></a></li>
63      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
64      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
65    </ul>
66  </div>
67  <div class="navpath"><b>bdm</b>::<a class="el" href="classbdm_1_1SettingResolver.html">SettingResolver</a>
68  </div>
69</div>
70<div class="contents">
71<h1>bdm::SettingResolver Class Reference</h1><!-- doxytag: class="bdm::SettingResolver" --><!-- doxytag: inherits="bdm::root" -->This class serves to expand links used within configuration files. 
72<a href="#_details">More...</a>
73<p>
74<code>#include &lt;<a class="el" href="user__info_8h-source.html">user_info.h</a>&gt;</code>
75<p>
76
77<p>
78<a href="classbdm_1_1SettingResolver-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
79<tr><td></td></tr>
80<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
81<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="e2299746b95bf8af54a867aaf52fc8da"></a><!-- doxytag: member="bdm::SettingResolver::SettingResolver" ref="e2299746b95bf8af54a867aaf52fc8da" args="(const Setting &amp;potential_link)" -->
82&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbdm_1_1SettingResolver.html#e2299746b95bf8af54a867aaf52fc8da">SettingResolver</a> (const Setting &amp;potential_link)</td></tr>
83
84<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">If potential_link contains a link to some other setting, it is resolved here. Anyway, the Setting reference <a class="el" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a> is prepared for use. <br></td></tr>
85<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c8b29999710e2db98c1a3979e25e6bbc"></a><!-- doxytag: member="bdm::SettingResolver::~SettingResolver" ref="c8b29999710e2db98c1a3979e25e6bbc" args="()" -->
86&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbdm_1_1SettingResolver.html#c8b29999710e2db98c1a3979e25e6bbc">~SettingResolver</a> ()</td></tr>
87
88<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">An opened <a class="el" href="classbdm_1_1UIFile.html" title="This class serves to load and/or save user-infos into/from configuration files stored...">UIFile</a> file is closed here if necessary. <br></td></tr>
89<tr><td colspan="2"><br><h2>Public Attributes</h2></td></tr>
90<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="adfcd0a81d025c52c8335b6aea07b498"></a><!-- doxytag: member="bdm::SettingResolver::result" ref="adfcd0a81d025c52c8335b6aea07b498" args="" -->
91const Setting &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498">result</a></td></tr>
92
93<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Reference to a resolved link or to the original Setting in the case it does not contain a link. <br></td></tr>
94<tr><td colspan="2"><br><h2>Private Member Functions</h2></td></tr>
95<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="af0e6941ba5919cae1bc530e2181b109"></a><!-- doxytag: member="bdm::SettingResolver::to_string" ref="af0e6941ba5919cae1bc530e2181b109" args="()" -->
96virtual string&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbdm_1_1root.html#af0e6941ba5919cae1bc530e2181b109">to_string</a> ()</td></tr>
97
98<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method returns a basic info about the current instance. <br></td></tr>
99<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="0551e3121091c5199bf4413b50522176"></a><!-- doxytag: member="bdm::SettingResolver::from_setting" ref="0551e3121091c5199bf4413b50522176" args="(const Setting &amp;set)" -->
100virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbdm_1_1root.html#0551e3121091c5199bf4413b50522176">from_setting</a> (const Setting &amp;set)</td></tr>
101
102<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method arrange instance properties according the data stored in the Setting structure. <br></td></tr>
103<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="67d954d255ede776eade7334d4895790"></a><!-- doxytag: member="bdm::SettingResolver::to_setting" ref="67d954d255ede776eade7334d4895790" args="(Setting &amp;set) const " -->
104virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbdm_1_1root.html#67d954d255ede776eade7334d4895790">to_setting</a> (Setting &amp;set) const </td></tr>
105
106<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method save all the instance properties into the Setting structure. <br></td></tr>
107<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="1c314bd6d6dacb8ba78ea5eb88fd9516"></a><!-- doxytag: member="bdm::SettingResolver::validate" ref="1c314bd6d6dacb8ba78ea5eb88fd9516" args="()" -->
108virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbdm_1_1root.html#1c314bd6d6dacb8ba78ea5eb88fd9516">validate</a> ()</td></tr>
109
110<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method TODO. <br></td></tr>
111</table>
112<hr><a name="_details"></a><h2>Detailed Description</h2>
113This class serves to expand links used within configuration files.
114<p>
115Value of any type but string can be linked to some other value of the same type defined elsewhere in the current configuration file or even in some different configuration file.<p>
116Link have three parts, &lt;name&gt; : &lt;path&gt; &lt;@filename&gt;. Field &lt;name&gt; contains the name of the new setting, &lt;path&gt; is the relative path to the referenced setting, which has to be taken from the root Setting element. The last part &lt;@filename&gt; is optional, it contains filename in the case the link should refer to a variable stored in a different file. From the previous part &lt;path&gt;, it has to be separated by '@'.<p>
117<div class="fragment"><pre class="fragment">    ...
118        jardovo :
119        {
120          <span class="keyword">class </span>= "Car";
121          year = 1992;
122          manufacturer = <span class="stringliteral">"liaz"</span>;
123          kilometers = 1555000;
124        };
125        ondrejovo :
126        {
127          <span class="keyword">class </span>= "Bike";
128          year = 1996;
129          manufacturer = <span class="stringliteral">"author"</span>;
130          electricLights = <span class="keyword">true</span>;
131          matr = ( 2, 2, [ 1.0, 0.0, 0.0, 1.0 ] );
132        };
133       
134<span class="preprocessor">        #this is the example of local link to another mean of transport </span>
135<span class="preprocessor"></span>        elisky = <span class="stringliteral">"jardovo"</span>;
136
137        ...
138
139        # and <span class="keyword">this</span> link is external link pointing to file <span class="stringliteral">"other_cars.cfg"</span> stored in the
140<span class="preprocessor">        # same directory, in that file, it refers to the local Setting "magic_cars.skubankovo"</span>
141<span class="preprocessor"></span>        kati = <span class="stringliteral">"magic_cars.skubankovo@other_cars.cfg"</span>;
142
143    ...
144</pre></div><p>
145When you want to expand a possible linked setting "element" within your code, it has to be treated this way:<p>
146<div class="fragment"><pre class="fragment">        ...
147
148        <span class="keyword">const</span> <a class="code" href="classbdm_1_1SettingResolver.html#e2299746b95bf8af54a867aaf52fc8da" title="If potential_link contains a link to some other setting, it is resolved here. Anyway...">SettingResolver</a> link( element );
149
150        ...
151
152        <span class="keywordtype">int</span> len = link.result.getLength();
153
154        ...
155</pre></div><p>
156The whole point is that a resolved link (class member <a class="el" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a>, i.e., "link.result" in the previous example) could point into a different configuration file. In that case there has to be an <a class="el" href="classbdm_1_1UIFile.html" title="This class serves to load and/or save user-infos into/from configuration files stored...">UIFile</a> instance managing reading from this file. As the libconfig::Config deletes all its Settings when dealocated, <a class="el" href="classbdm_1_1UIFile.html" title="This class serves to load and/or save user-infos into/from configuration files stored...">UIFile</a> must not be dealocated until all the necessary operation on the linked Setting are finished (otherwise, the link <a class="el" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a> would be invalid just after the <a class="el" href="classbdm_1_1UIFile.html" title="This class serves to load and/or save user-infos into/from configuration files stored...">UIFile</a> dealocation). And that is exactly the mechanism implemented within <a class="el" href="classbdm_1_1SettingResolver.html" title="This class serves to expand links used within configuration files.">SettingResolver</a> class. It assures, that the <a class="el" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a> Setting reference is valid within the scope of <a class="el" href="classbdm_1_1SettingResolver.html" title="This class serves to expand links used within configuration files.">SettingResolver</a> instance. <hr>The documentation for this class was generated from the following files:<ul>
157<li><a class="el" href="user__info_8h-source.html">user_info.h</a><li>user_info.cpp</ul>
158</div>
159<hr size="1"><address style="text-align: right;"><small>Generated on Wed Jun 24 21:53:05 2009 for mixpp by&nbsp;
160<a href="http://www.doxygen.org/index.html">
161<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
162</body>
163</html>
Note: See TracBrowser for help on using the browser.