73 | | <a name="l00061"></a>00061 vec tmp; |
74 | | <a name="l00062"></a>00062 tmp.set_size ( S.getLength() ); |
75 | | <a name="l00063"></a>00063 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<S.getLength();i++ ) { |
76 | | <a name="l00064"></a>00064 <span class="keywordflow">switch</span> ( S[i].getType() ) { |
77 | | <a name="l00065"></a>00065 <span class="keywordflow">case</span> Setting::TypeFloat : |
78 | | <a name="l00066"></a>00066 tmp[i]=double ( S[i] );<span class="keywordflow">break</span>; |
79 | | <a name="l00067"></a>00067 <span class="keywordflow">case</span> Setting::TypeInt : |
80 | | <a name="l00068"></a>00068 tmp[i]=int ( S[i] );<span class="keywordflow">break</span>; |
81 | | <a name="l00069"></a>00069 <span class="keywordflow">case</span> Setting::TypeBoolean : |
82 | | <a name="l00070"></a>00070 tmp[i]=bool ( S[i] );<span class="keywordflow">break</span>; |
83 | | <a name="l00071"></a>00071 <span class="keywordflow">default</span>: it_error ( <span class="stringliteral">"libconfig error?"</span> ); |
84 | | <a name="l00072"></a>00072 } |
85 | | <a name="l00073"></a>00073 } |
86 | | <a name="l00074"></a>00074 <span class="keywordflow">return</span> tmp; |
87 | | <a name="l00075"></a>00075 }; |
88 | | <a name="l00076"></a>00076 <span class="keyword">public</span>: |
89 | | <a name="l00078"></a><a class="code" href="classbdm_1_1UIbuilder.html#c75103dd58395644e80f1eea886c656b">00078</a> <a class="code" href="classbdm_1_1UIbuilder.html#c75103dd58395644e80f1eea886c656b" title="Constructor needs to be run only once macro UIREGISTER.">UIbuilder</a> ( <span class="keyword">const</span> <span class="keywordtype">string</span> &typ ) {<a class="code" href="namespacebdm.html#edbf34217028dd95a3680c346af85fea" title="global map of UIbulder names to instances of UIbuilders. Created by UIREGISTER macro...">__uimap__</a>.insert ( make_pair ( typ,<span class="keyword">this</span> ) );} |
90 | | <a name="l00080"></a>00080 <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a>* <a class="code" href="classbdm_1_1UIbuilder.html#193cede6302669ff48dfd8ab3b7e31f8" title="Function building the computational object.">build</a> ( Setting &S ) <span class="keyword">const</span> =0; |
91 | | <a name="l00081"></a>00081 }; |
92 | | <a name="l00082"></a>00082 |
93 | | <a name="l00083"></a>00083 <span class="keyword">class </span>UIexternal:<span class="keyword">public</span> UIbuilder { |
94 | | <a name="l00084"></a>00084 <span class="keyword">public</span>: |
95 | | <a name="l00085"></a>00085 UIexternal() :UIbuilder ( <span class="stringliteral">"external"</span> ) {} |
96 | | <a name="l00086"></a>00086 bdmroot* build ( Setting &S ) <span class="keyword">const</span>; |
97 | | <a name="l00087"></a>00087 }; |
98 | | <a name="l00088"></a>00088 |
99 | | <a name="l00089"></a>00089 <span class="keyword">class </span>UIinternal:<span class="keyword">public</span> UIbuilder { |
100 | | <a name="l00090"></a>00090 <span class="keyword">public</span>: |
101 | | <a name="l00091"></a>00091 UIinternal() :<a class="code" href="classbdm_1_1UIbuilder.html#c75103dd58395644e80f1eea886c656b" title="Constructor needs to be run only once macro UIREGISTER.">UIbuilder</a> ( <span class="stringliteral">"internal"</span> ) {} |
102 | | <a name="l00092"></a>00092 bdmroot* build ( Setting &S ) <span class="keyword">const</span>; |
103 | | <a name="l00093"></a>00093 }; |
104 | | <a name="l00094"></a>00094 |
105 | | <a name="l00096"></a>00096 <span class="keywordtype">void</span> <a class="code" href="namespacebdm.html#f420706e534b420cf6561aa529be9a9e" title="[Debugging] Print values in current S to cout">UI_DBG</a> ( Setting &S, <span class="keyword">const</span> <span class="keywordtype">string</span> &spc ); |
106 | | <a name="l00097"></a>00097 |
107 | | <a name="l00099"></a>00099 <span class="keyword">template</span><<span class="keyword">class</span> T> |
108 | | <a name="l00100"></a><a class="code" href="namespacebdm.html#b547b14af614cba1ab6c8942dde34462">00100</a> <span class="keywordtype">void</span> <a class="code" href="namespacebdm.html#b547b14af614cba1ab6c8942dde34462" title="Prototype of a UI builder. Return value is by the second argument since it type checking...">UIbuild</a> ( Setting &S, T* &ret ) { |
109 | | <a name="l00101"></a>00101 CHECK_UITYPE ( S,TypeGroup ); |
110 | | <a name="l00102"></a>00102 <span class="comment">// Check if field "type" is present, if not it is not a valid UI</span> |
111 | | <a name="l00103"></a>00103 it_assert_debug ( S.exists ( <span class="stringliteral">"type"</span> ), string ( S.getPath() ) +<span class="stringliteral">" is not a valid UI!"</span> ); |
112 | | <a name="l00104"></a>00104 |
113 | | <a name="l00105"></a>00105 <span class="keyword">const</span> <span class="keywordtype">string</span> typ=S[<span class="stringliteral">"type"</span>]; |
114 | | <a name="l00106"></a>00106 <span class="comment">// Find "type" in list of registred UI builders</span> |
115 | | <a name="l00107"></a>00107 UImap::const_iterator iter = <a class="code" href="namespacebdm.html#edbf34217028dd95a3680c346af85fea" title="global map of UIbulder names to instances of UIbuilders. Created by UIREGISTER macro...">__uimap__</a>.find ( typ ); |
116 | | <a name="l00108"></a>00108 <span class="keywordflow">if</span> ( iter == <a class="code" href="namespacebdm.html#edbf34217028dd95a3680c346af85fea" title="global map of UIbulder names to instances of UIbuilders. Created by UIREGISTER macro...">__uimap__</a>.end() ) { |
117 | | <a name="l00109"></a>00109 it_error ( <span class="stringliteral">"UI of type \""</span> + typ + <span class="stringliteral">"\" is not registered!"</span> ); |
118 | | <a name="l00110"></a>00110 } |
119 | | <a name="l00111"></a>00111 |
120 | | <a name="l00112"></a>00112 <span class="comment">//BUILD the result</span> |
121 | | <a name="l00113"></a>00113 <span class="keywordflow">try</span> { |
122 | | <a name="l00114"></a>00114 ret = <span class="keyword">dynamic_cast<</span>T*<span class="keyword">></span> ( iter->second->build ( S ) ); |
123 | | <a name="l00115"></a>00115 } |
124 | | <a name="l00116"></a>00116 <span class="keywordflow">catch</span> ( SettingTypeException e ) { |
125 | | <a name="l00117"></a>00117 <a class="code" href="namespacebdm.html#f420706e534b420cf6561aa529be9a9e" title="[Debugging] Print values in current S to cout">UI_DBG</a>(S,<span class="stringliteral">""</span>); |
126 | | <a name="l00118"></a>00118 it_error ( <span class="stringliteral">"Setting "</span> +<span class="keywordtype">string</span> ( e.getPath() ) +<span class="stringliteral">" is of incorrect Type"</span> );} |
127 | | <a name="l00119"></a>00119 <span class="keywordflow">catch</span> ( SettingNotFoundException e ) { |
128 | | <a name="l00120"></a>00120 <a class="code" href="namespacebdm.html#f420706e534b420cf6561aa529be9a9e" title="[Debugging] Print values in current S to cout">UI_DBG</a>(S,<span class="stringliteral">""</span>); |
129 | | <a name="l00121"></a>00121 it_error ( <span class="stringliteral">"Setting "</span> + <span class="keywordtype">string</span> ( e.getPath() ) +<span class="stringliteral">" was not found"</span> );} |
130 | | <a name="l00122"></a>00122 }; |
131 | | <a name="l00123"></a>00123 |
132 | | <a name="l00125"></a>00125 <span class="keyword">template</span><<span class="keyword">class</span> T> |
133 | | <a name="l00126"></a><a class="code" href="namespacebdm.html#0760231b120a0b42f80b09515456d57b">00126</a> <span class="keywordtype">void</span> <a class="code" href="namespacebdm.html#0760231b120a0b42f80b09515456d57b" title="Auxiliary function allowing recursivity in S (too complex, remove?).">UIcall</a> ( Setting &S, <span class="keywordtype">void</span> ( *func ) ( Setting&, T ), T Tmp ) { |
134 | | <a name="l00127"></a>00127 CHECK_UITYPE ( S,TypeGroup ); |
135 | | <a name="l00128"></a>00128 <span class="comment">// Check if field "type" is present, if not it is not a valid UI</span> |
136 | | <a name="l00129"></a>00129 it_assert_debug ( S.exists ( <span class="stringliteral">"type"</span> ), string ( S.getPath() ) +<span class="stringliteral">" is not a valid UI!"</span> ); |
137 | | <a name="l00130"></a>00130 |
138 | | <a name="l00131"></a>00131 <span class="keyword">const</span> <span class="keywordtype">string</span> typ=S[<span class="stringliteral">"type"</span>]; |
139 | | <a name="l00132"></a>00132 <span class="keywordflow">if</span> ( typ==<span class="stringliteral">"internal"</span> ) { |
140 | | <a name="l00133"></a>00133 <span class="keywordflow">try</span> { |
141 | | <a name="l00134"></a>00134 Setting* Stmp = &S; |
142 | | <a name="l00135"></a>00135 <span class="keywordflow">do</span> {Stmp=& ( Stmp->getParent() );} |
143 | | <a name="l00136"></a>00136 <span class="keywordflow">while</span> ( !Stmp->isRoot() ); |
144 | | <a name="l00137"></a>00137 Setting& intS=Stmp->lookup ( ( <span class="keyword">const</span> <span class="keywordtype">char</span>* ) S[<span class="stringliteral">"path"</span>] ); |
145 | | <a name="l00138"></a>00138 func ( intS, Tmp ); <span class="comment">// <======== calling func</span> |
146 | | <a name="l00139"></a>00139 <span class="keywordflow">return</span>; |
147 | | <a name="l00140"></a>00140 } |
148 | | <a name="l00141"></a>00141 <span class="keywordflow">catch</span> ( ... ) { |
149 | | <a name="l00142"></a>00142 it_error ( <span class="stringliteral">"Internal field "</span> + <span class="keywordtype">string</span> ( S.getPath() ) + <span class="stringliteral">" not valid"</span> ); |
150 | | <a name="l00143"></a>00143 } |
151 | | <a name="l00144"></a>00144 } |
152 | | <a name="l00145"></a>00145 <span class="keywordflow">if</span> ( typ==<span class="stringliteral">"external"</span> ) { |
153 | | <a name="l00146"></a>00146 UIFile C(S[<span class="stringliteral">"filename"</span>]); |
154 | | <a name="l00147"></a>00147 <span class="keywordflow">try</span> { |
155 | | <a name="l00148"></a>00148 func ( C.lookup ( ( <span class="keyword">const</span> <span class="keywordtype">char</span>* ) S[<span class="stringliteral">"path"</span>] ), Tmp ); |
156 | | <a name="l00149"></a>00149 } |
157 | | <a name="l00150"></a>00150 <span class="keywordflow">catch</span> ( ... ) { |
158 | | <a name="l00151"></a>00151 it_error ( <span class="stringliteral">"External field "</span> + <span class="keywordtype">string</span> ( S.getPath() ) + <span class="stringliteral">" not valid"</span> ); |
159 | | <a name="l00152"></a>00152 } |
160 | | <a name="l00153"></a>00153 <span class="keywordflow">return</span>; |
161 | | <a name="l00154"></a>00154 } |
162 | | <a name="l00155"></a>00155 |
163 | | <a name="l00156"></a>00156 <span class="comment">// v======================= calling final func</span> |
164 | | <a name="l00157"></a>00157 func ( S, Tmp ); |
165 | | <a name="l00158"></a>00158 }; |
166 | | <a name="l00159"></a>00159 |
167 | | <a name="l00160"></a>00160 } |
168 | | <a name="l00161"></a>00161 <span class="preprocessor">#endif //UIBUILD</span> |
| 73 | <a name="l00061"></a>00061 mat tmp; |
| 74 | <a name="l00062"></a>00062 <span class="keywordtype">int</span> nrows=S.getLength()/ncols; |
| 75 | <a name="l00063"></a>00063 <span class="keywordtype">int</span> r=0,c=0; |
| 76 | <a name="l00064"></a>00064 tmp.set_size ( nrows, ncols ); |
| 77 | <a name="l00065"></a>00065 <span class="comment">// Build matrix row-wise</span> |
| 78 | <a name="l00066"></a>00066 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<S.getLength();i++ ) { |
| 79 | <a name="l00067"></a>00067 <span class="keywordflow">switch</span> ( S[i].getType() ) { |
| 80 | <a name="l00068"></a>00068 <span class="keywordflow">case</span> Setting::TypeFloat : |
| 81 | <a name="l00069"></a>00069 tmp(r,c)=double ( S[i] );<span class="keywordflow">break</span>; |
| 82 | <a name="l00070"></a>00070 <span class="keywordflow">case</span> Setting::TypeInt : |
| 83 | <a name="l00071"></a>00071 tmp(r,c)=int ( S[i] );<span class="keywordflow">break</span>; |
| 84 | <a name="l00072"></a>00072 <span class="keywordflow">case</span> Setting::TypeBoolean : |
| 85 | <a name="l00073"></a>00073 tmp(r,c)=bool ( S[i] );<span class="keywordflow">break</span>; |
| 86 | <a name="l00074"></a>00074 <span class="keywordflow">default</span>: it_error ( <span class="stringliteral">"libconfig error?"</span> ); |
| 87 | <a name="l00075"></a>00075 } |
| 88 | <a name="l00076"></a>00076 c++; <span class="keywordflow">if</span> (c==ncols) {c=0;r++;} |
| 89 | <a name="l00077"></a>00077 } |
| 90 | <a name="l00078"></a>00078 <span class="keywordflow">return</span> tmp; |
| 91 | <a name="l00079"></a>00079 }; |
| 92 | <a name="l00080"></a>00080 <span class="keyword">const</span> vec getivec ( Setting& S )<span class="keyword"> const </span>{ |
| 93 | <a name="l00081"></a>00081 CHECK_UITYPE ( S,TypeArray ); |
| 94 | <a name="l00082"></a>00082 vec tmp; |
| 95 | <a name="l00083"></a>00083 tmp.set_size ( S.getLength() ); |
| 96 | <a name="l00084"></a>00084 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<S.getLength();i++ ) { |
| 97 | <a name="l00085"></a>00085 <span class="keywordflow">switch</span> ( S[i].getType() ) { |
| 98 | <a name="l00086"></a>00086 <span class="keywordflow">case</span> Setting::TypeFloat : |
| 99 | <a name="l00087"></a>00087 tmp[i]=double ( S[i] );<span class="keywordflow">break</span>; |
| 100 | <a name="l00088"></a>00088 <span class="keywordflow">case</span> Setting::TypeInt : |
| 101 | <a name="l00089"></a>00089 tmp[i]=int ( S[i] );<span class="keywordflow">break</span>; |
| 102 | <a name="l00090"></a>00090 <span class="keywordflow">case</span> Setting::TypeBoolean : |
| 103 | <a name="l00091"></a>00091 tmp[i]=bool ( S[i] );<span class="keywordflow">break</span>; |
| 104 | <a name="l00092"></a>00092 <span class="keywordflow">default</span>: it_error ( <span class="stringliteral">"libconfig error?"</span> ); |
| 105 | <a name="l00093"></a>00093 } |
| 106 | <a name="l00094"></a>00094 } |
| 107 | <a name="l00095"></a>00095 <span class="keywordflow">return</span> tmp; |
| 108 | <a name="l00096"></a>00096 }; |
| 109 | <a name="l00097"></a>00097 <span class="keyword">public</span>: |
| 110 | <a name="l00099"></a><a class="code" href="classbdm_1_1UIbuilder.html#c75103dd58395644e80f1eea886c656b">00099</a> <a class="code" href="classbdm_1_1UIbuilder.html#c75103dd58395644e80f1eea886c656b" title="Constructor needs to be run only once macro UIREGISTER.">UIbuilder</a> ( <span class="keyword">const</span> <span class="keywordtype">string</span> &typ ) {<a class="code" href="namespacebdm.html#edbf34217028dd95a3680c346af85fea" title="global map of UIbulder names to instances of UIbuilders. Created by UIREGISTER macro...">__uimap__</a>.insert ( make_pair ( typ,<span class="keyword">this</span> ) );} |
| 111 | <a name="l00101"></a>00101 <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a>* <a class="code" href="classbdm_1_1UIbuilder.html#193cede6302669ff48dfd8ab3b7e31f8" title="Function building the computational object.">build</a> ( Setting &S ) <span class="keyword">const</span> =0; |
| 112 | <a name="l00102"></a>00102 }; |
| 113 | <a name="l00103"></a>00103 |
| 114 | <a name="l00104"></a>00104 <span class="keyword">class </span>UIexternal:<span class="keyword">public</span> UIbuilder { |
| 115 | <a name="l00105"></a>00105 <span class="keyword">public</span>: |
| 116 | <a name="l00106"></a>00106 UIexternal() :UIbuilder ( <span class="stringliteral">"external"</span> ) {} |
| 117 | <a name="l00107"></a>00107 bdmroot* build ( Setting &S ) <span class="keyword">const</span>; |
| 118 | <a name="l00108"></a>00108 }; |
| 119 | <a name="l00109"></a>00109 |
| 120 | <a name="l00110"></a>00110 <span class="keyword">class </span>UIinternal:<span class="keyword">public</span> UIbuilder { |
| 121 | <a name="l00111"></a>00111 <span class="keyword">public</span>: |
| 122 | <a name="l00112"></a>00112 UIinternal() :<a class="code" href="classbdm_1_1UIbuilder.html#c75103dd58395644e80f1eea886c656b" title="Constructor needs to be run only once macro UIREGISTER.">UIbuilder</a> ( <span class="stringliteral">"internal"</span> ) {} |
| 123 | <a name="l00113"></a>00113 bdmroot* build ( Setting &S ) <span class="keyword">const</span>; |
| 124 | <a name="l00114"></a>00114 }; |
| 125 | <a name="l00115"></a>00115 |
| 126 | <a name="l00117"></a>00117 <span class="keywordtype">void</span> <a class="code" href="namespacebdm.html#f420706e534b420cf6561aa529be9a9e" title="[Debugging] Print values in current S to cout">UI_DBG</a> ( Setting &S, <span class="keyword">const</span> <span class="keywordtype">string</span> &spc ); |
| 127 | <a name="l00118"></a>00118 |
| 128 | <a name="l00120"></a>00120 <span class="keyword">template</span><<span class="keyword">class</span> T> |
| 129 | <a name="l00121"></a><a class="code" href="namespacebdm.html#b547b14af614cba1ab6c8942dde34462">00121</a> <span class="keywordtype">void</span> <a class="code" href="namespacebdm.html#b547b14af614cba1ab6c8942dde34462" title="Prototype of a UI builder. Return value is by the second argument since it type checking...">UIbuild</a> ( Setting &S, T* &ret ) { |
| 130 | <a name="l00122"></a>00122 CHECK_UITYPE ( S,TypeGroup ); |
| 131 | <a name="l00123"></a>00123 <span class="comment">// Check if field "type" is present, if not it is not a valid UI</span> |
| 132 | <a name="l00124"></a>00124 it_assert_debug ( S.exists ( <span class="stringliteral">"type"</span> ), string ( S.getPath() ) +<span class="stringliteral">" is not a valid UI!"</span> ); |
| 133 | <a name="l00125"></a>00125 |
| 134 | <a name="l00126"></a>00126 <span class="keyword">const</span> <span class="keywordtype">string</span> typ=S[<span class="stringliteral">"type"</span>]; |
| 135 | <a name="l00127"></a>00127 <span class="comment">// Find "type" in list of registred UI builders</span> |
| 136 | <a name="l00128"></a>00128 UImap::const_iterator iter = <a class="code" href="namespacebdm.html#edbf34217028dd95a3680c346af85fea" title="global map of UIbulder names to instances of UIbuilders. Created by UIREGISTER macro...">__uimap__</a>.find ( typ ); |
| 137 | <a name="l00129"></a>00129 <span class="keywordflow">if</span> ( iter == <a class="code" href="namespacebdm.html#edbf34217028dd95a3680c346af85fea" title="global map of UIbulder names to instances of UIbuilders. Created by UIREGISTER macro...">__uimap__</a>.end() ) { |
| 138 | <a name="l00130"></a>00130 it_error ( <span class="stringliteral">"UI of type \""</span> + typ + <span class="stringliteral">"\" is not registered!"</span> ); |
| 139 | <a name="l00131"></a>00131 } |
| 140 | <a name="l00132"></a>00132 |
| 141 | <a name="l00133"></a>00133 <span class="comment">//BUILD the result</span> |
| 142 | <a name="l00134"></a>00134 <span class="keywordflow">try</span> { |
| 143 | <a name="l00135"></a>00135 ret = <span class="keyword">dynamic_cast<</span>T*<span class="keyword">></span> ( iter->second->build ( S ) ); |
| 144 | <a name="l00136"></a>00136 } |
| 145 | <a name="l00137"></a>00137 <span class="keywordflow">catch</span> ( SettingTypeException e ) { |
| 146 | <a name="l00138"></a>00138 <a class="code" href="namespacebdm.html#f420706e534b420cf6561aa529be9a9e" title="[Debugging] Print values in current S to cout">UI_DBG</a>(S,<span class="stringliteral">""</span>); |
| 147 | <a name="l00139"></a>00139 it_error ( <span class="stringliteral">"Setting "</span> +<span class="keywordtype">string</span> ( e.getPath() ) +<span class="stringliteral">" is of incorrect Type"</span> );} |
| 148 | <a name="l00140"></a>00140 <span class="keywordflow">catch</span> ( SettingNotFoundException e ) { |
| 149 | <a name="l00141"></a>00141 <a class="code" href="namespacebdm.html#f420706e534b420cf6561aa529be9a9e" title="[Debugging] Print values in current S to cout">UI_DBG</a>(S,<span class="stringliteral">""</span>); |
| 150 | <a name="l00142"></a>00142 it_error ( <span class="stringliteral">"Setting "</span> + <span class="keywordtype">string</span> ( e.getPath() ) +<span class="stringliteral">" was not found"</span> );} |
| 151 | <a name="l00143"></a>00143 }; |
| 152 | <a name="l00144"></a>00144 |
| 153 | <a name="l00146"></a>00146 <span class="keyword">template</span><<span class="keyword">class</span> T> |
| 154 | <a name="l00147"></a><a class="code" href="namespacebdm.html#0760231b120a0b42f80b09515456d57b">00147</a> <span class="keywordtype">void</span> <a class="code" href="namespacebdm.html#0760231b120a0b42f80b09515456d57b" title="Auxiliary function allowing recursivity in S (too complex, remove?).">UIcall</a> ( Setting &S, <span class="keywordtype">void</span> ( *func ) ( Setting&, T ), T Tmp ) { |
| 155 | <a name="l00148"></a>00148 CHECK_UITYPE ( S,TypeGroup ); |
| 156 | <a name="l00149"></a>00149 <span class="comment">// Check if field "type" is present, if not it is not a valid UI</span> |
| 157 | <a name="l00150"></a>00150 it_assert_debug ( S.exists ( <span class="stringliteral">"type"</span> ), string ( S.getPath() ) +<span class="stringliteral">" is not a valid UI!"</span> ); |
| 158 | <a name="l00151"></a>00151 |
| 159 | <a name="l00152"></a>00152 <span class="keyword">const</span> <span class="keywordtype">string</span> typ=S[<span class="stringliteral">"type"</span>]; |
| 160 | <a name="l00153"></a>00153 <span class="keywordflow">if</span> ( typ==<span class="stringliteral">"internal"</span> ) { |
| 161 | <a name="l00154"></a>00154 <span class="keywordflow">try</span> { |
| 162 | <a name="l00155"></a>00155 Setting* Stmp = &S; |
| 163 | <a name="l00156"></a>00156 <span class="keywordflow">do</span> {Stmp=& ( Stmp->getParent() );} |
| 164 | <a name="l00157"></a>00157 <span class="keywordflow">while</span> ( !Stmp->isRoot() ); |
| 165 | <a name="l00158"></a>00158 Setting& intS=Stmp->lookup ( ( <span class="keyword">const</span> <span class="keywordtype">char</span>* ) S[<span class="stringliteral">"path"</span>] ); |
| 166 | <a name="l00159"></a>00159 func ( intS, Tmp ); <span class="comment">// <======== calling func</span> |
| 167 | <a name="l00160"></a>00160 <span class="keywordflow">return</span>; |
| 168 | <a name="l00161"></a>00161 } |
| 169 | <a name="l00162"></a>00162 <span class="keywordflow">catch</span> ( ... ) { |
| 170 | <a name="l00163"></a>00163 it_error ( <span class="stringliteral">"Internal field "</span> + <span class="keywordtype">string</span> ( S.getPath() ) + <span class="stringliteral">" not valid"</span> ); |
| 171 | <a name="l00164"></a>00164 } |
| 172 | <a name="l00165"></a>00165 } |
| 173 | <a name="l00166"></a>00166 <span class="keywordflow">if</span> ( typ==<span class="stringliteral">"external"</span> ) { |
| 174 | <a name="l00167"></a>00167 UIFile C(S[<span class="stringliteral">"filename"</span>]); |
| 175 | <a name="l00168"></a>00168 <span class="keywordflow">try</span> { |
| 176 | <a name="l00169"></a>00169 func ( C.lookup ( ( <span class="keyword">const</span> <span class="keywordtype">char</span>* ) S[<span class="stringliteral">"path"</span>] ), Tmp ); |
| 177 | <a name="l00170"></a>00170 } |
| 178 | <a name="l00171"></a>00171 <span class="keywordflow">catch</span> ( ... ) { |
| 179 | <a name="l00172"></a>00172 it_error ( <span class="stringliteral">"External field "</span> + <span class="keywordtype">string</span> ( S.getPath() ) + <span class="stringliteral">" not valid"</span> ); |
| 180 | <a name="l00173"></a>00173 } |
| 181 | <a name="l00174"></a>00174 <span class="keywordflow">return</span>; |
| 182 | <a name="l00175"></a>00175 } |
| 183 | <a name="l00176"></a>00176 |
| 184 | <a name="l00177"></a>00177 <span class="comment">// v======================= calling final func</span> |
| 185 | <a name="l00178"></a>00178 func ( S, Tmp ); |
| 186 | <a name="l00179"></a>00179 }; |
| 187 | <a name="l00180"></a>00180 |
| 188 | <a name="l00181"></a>00181 } |
| 189 | <a name="l00182"></a>00182 <span class="preprocessor">#endif //UIBUILD</span> |