[84] | 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"> |
---|
[145] | 3 | <title>mixpp: work/git/mixpp/bdm/userinfo.h Source File</title> |
---|
[84] | 4 | <link href="doxygen.css" rel="stylesheet" type="text/css"> |
---|
| 5 | <link href="tabs.css" rel="stylesheet" type="text/css"> |
---|
| 6 | </head><body> |
---|
[139] | 7 | <!-- Generated by Doxygen 1.5.6 --> |
---|
[91] | 8 | <div class="navigation" id="top"> |
---|
| 9 | <div class="tabs"> |
---|
| 10 | <ul> |
---|
| 11 | <li><a href="index.html"><span>Main Page</span></a></li> |
---|
| 12 | <li><a href="pages.html"><span>Related Pages</span></a></li> |
---|
[219] | 13 | <li><a href="modules.html"><span>Modules</span></a></li> |
---|
[91] | 14 | <li><a href="annotated.html"><span>Classes</span></a></li> |
---|
| 15 | <li class="current"><a href="files.html"><span>Files</span></a></li> |
---|
| 16 | </ul> |
---|
| 17 | </div> |
---|
[145] | 18 | <h1>work/git/mixpp/bdm/userinfo.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef UI_H</span> |
---|
[139] | 19 | <a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define UI_H</span> |
---|
| 20 | <a name="l00003"></a>00003 <span class="preprocessor"></span> |
---|
| 21 | <a name="l00004"></a>00004 <span class="preprocessor">#include <sstream></span> |
---|
| 22 | <a name="l00005"></a>00005 <span class="preprocessor">#include <iostream></span> |
---|
| 23 | <a name="l00006"></a>00006 <span class="preprocessor">#include <stdio.h></span> |
---|
| 24 | <a name="l00007"></a>00007 <span class="preprocessor">#include <string></span> |
---|
[162] | 25 | <a name="l00008"></a>00008 <span class="preprocessor">#include <typeinfo></span> |
---|
| 26 | <a name="l00009"></a>00009 <span class="preprocessor">#include <map></span> |
---|
| 27 | <a name="l00010"></a>00010 <span class="preprocessor">#include <utility></span> |
---|
| 28 | <a name="l00011"></a>00011 <span class="preprocessor">#include <vector></span> |
---|
| 29 | <a name="l00012"></a>00012 <span class="preprocessor">#include <xercesc/dom/DOM.hpp></span> |
---|
| 30 | <a name="l00013"></a>00013 <span class="preprocessor">#include <xercesc/util/PlatformUtils.hpp></span> |
---|
| 31 | <a name="l00014"></a>00014 <span class="preprocessor">#include <xercesc/util/XMLString.hpp></span> |
---|
| 32 | <a name="l00015"></a>00015 <span class="preprocessor">#include <iostream></span> |
---|
| 33 | <a name="l00016"></a>00016 <span class="preprocessor">#include <xercesc/framework/LocalFileFormatTarget.hpp></span> |
---|
| 34 | <a name="l00017"></a>00017 <span class="preprocessor">#include <xercesc/framework/LocalFileInputSource.hpp></span> |
---|
| 35 | <a name="l00018"></a>00018 <span class="preprocessor">#include <xercesc/dom/DOMWriter.hpp></span> |
---|
| 36 | <a name="l00019"></a>00019 <span class="preprocessor">#include <xercesc/parsers/XercesDOMParser.hpp></span> |
---|
| 37 | <a name="l00020"></a>00020 |
---|
| 38 | <a name="l00021"></a>00021 <span class="preprocessor">#ifdef XERCES_CPP_NAMESPACE_USE</span> |
---|
| 39 | <a name="l00022"></a>00022 <span class="preprocessor"></span>XERCES_CPP_NAMESPACE_USE |
---|
| 40 | <a name="l00023"></a>00023 <span class="preprocessor">#endif</span> |
---|
| 41 | <a name="l00024"></a>00024 <span class="preprocessor"></span> |
---|
| 42 | <a name="l00025"></a>00025 <span class="keyword">using</span> std::string; |
---|
| 43 | <a name="l00026"></a>00026 <span class="keyword">using namespace </span>std; |
---|
| 44 | <a name="l00027"></a>00027 |
---|
| 45 | <a name="l00040"></a><a class="code" href="classAssertXercesIsAlive.html">00040</a> <span class="keyword">class </span><a class="code" href="classAssertXercesIsAlive.html" title="Class initializing Xerces library.">AssertXercesIsAlive</a> |
---|
| 46 | <a name="l00041"></a>00041 { |
---|
| 47 | <a name="l00042"></a>00042 <span class="keyword">private</span>: |
---|
| 48 | <a name="l00044"></a>00044 <span class="keyword">class </span>XercesConnector |
---|
| 49 | <a name="l00045"></a>00045 { |
---|
| 50 | <a name="l00046"></a>00046 <span class="keyword">private</span>: |
---|
| 51 | <a name="l00049"></a>00049 XercesConnector() |
---|
| 52 | <a name="l00050"></a>00050 { |
---|
| 53 | <a name="l00051"></a>00051 <span class="comment">// initialize the XML library</span> |
---|
| 54 | <a name="l00052"></a>00052 XMLPlatformUtils::Initialize(); |
---|
| 55 | <a name="l00053"></a>00053 } |
---|
| 56 | <a name="l00054"></a>00054 |
---|
| 57 | <a name="l00055"></a>00055 ~XercesConnector() |
---|
| 58 | <a name="l00056"></a>00056 { |
---|
| 59 | <a name="l00057"></a>00057 <span class="comment">// terminate the XML library</span> |
---|
| 60 | <a name="l00058"></a>00058 XMLPlatformUtils::Terminate(); |
---|
| 61 | <a name="l00059"></a>00059 } |
---|
| 62 | <a name="l00060"></a>00060 |
---|
| 63 | <a name="l00061"></a>00061 <span class="keyword">public</span>: |
---|
| 64 | <a name="l00068"></a>00068 <span class="keyword">static</span> <span class="keywordtype">void</span> StayAlive() |
---|
| 65 | <a name="l00069"></a>00069 { |
---|
| 66 | <a name="l00070"></a>00070 <span class="keyword">static</span> XercesConnector xc; |
---|
| 67 | <a name="l00071"></a>00071 }; |
---|
| 68 | <a name="l00072"></a>00072 }; |
---|
| 69 | <a name="l00073"></a>00073 |
---|
| 70 | <a name="l00074"></a>00074 |
---|
| 71 | <a name="l00075"></a>00075 <span class="keyword">public</span>: |
---|
| 72 | <a name="l00077"></a><a class="code" href="classAssertXercesIsAlive.html#dd36033ed31fe22022e7c56c7770101e">00077</a> <a class="code" href="classAssertXercesIsAlive.html#dd36033ed31fe22022e7c56c7770101e" title="default constructor">AssertXercesIsAlive</a>() |
---|
| 73 | <a name="l00078"></a>00078 { |
---|
| 74 | <a name="l00079"></a>00079 XercesConnector::StayAlive(); |
---|
| 75 | <a name="l00080"></a>00080 } |
---|
| 76 | <a name="l00081"></a>00081 }; |
---|
| 77 | <a name="l00082"></a>00082 |
---|
| 78 | <a name="l00086"></a><a class="code" href="classBindingFrame.html">00086</a> <span class="keyword">class </span><a class="code" href="classBindingFrame.html" title="Abstract class declaring general properties of a frame for data binding.">BindingFrame</a> |
---|
| 79 | <a name="l00087"></a>00087 { |
---|
| 80 | <a name="l00088"></a>00088 <span class="keyword">private</span>: |
---|
| 81 | <a name="l00092"></a>00092 <a class="code" href="classAssertXercesIsAlive.html" title="Class initializing Xerces library.">AssertXercesIsAlive</a> dummy; |
---|
| 82 | <a name="l00093"></a>00093 |
---|
| 83 | <a name="l00094"></a>00094 <span class="keyword">protected</span>: |
---|
| 84 | <a name="l00096"></a>00096 <a class="code" href="classBindingFrame.html#65bec8fcde1865e2e211f42ca52a816f" title="default constructor">BindingFrame</a>(); |
---|
| 85 | <a name="l00097"></a>00097 |
---|
| 86 | <a name="l00099"></a>00099 <span class="keywordtype">string</span> <a class="code" href="classBindingFrame.html#2244bd5181c3d1e70f3a6be2b72e9424" title="function which transcodes Xerces&#39; XMLCh-based strings into C++ strings">XMLCh2str</a>( <span class="keyword">const</span> XMLCh* <span class="keyword">const</span> XMLCh_str ); |
---|
| 87 | <a name="l00100"></a>00100 |
---|
[181] | 88 | <a name="l00101"></a>00101 <span class="keywordtype">string</span> removeSpaces(<span class="keyword">const</span> <span class="keywordtype">string</span> &<a class="code" href="classstr.html" title="Structure of RV (used internally), i.e. expanded RVs.">str</a>) |
---|
[162] | 89 | <a name="l00102"></a>00102 { |
---|
| 90 | <a name="l00103"></a>00103 std::string temp; |
---|
| 91 | <a name="l00104"></a>00104 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i < str.length(); i++) |
---|
| 92 | <a name="l00105"></a>00105 <span class="keywordflow">if</span> (str[i] == <span class="charliteral">' '</span>) temp += <span class="charliteral">'_'</span>; |
---|
| 93 | <a name="l00106"></a>00106 <span class="keywordflow">else</span> temp += str[i]; |
---|
| 94 | <a name="l00107"></a>00107 <span class="keywordflow">return</span> temp; |
---|
| 95 | <a name="l00108"></a>00108 } |
---|
| 96 | <a name="l00109"></a>00109 |
---|
| 97 | <a name="l00110"></a>00110 <span class="keyword">public</span>: |
---|
| 98 | <a name="l00112"></a>00112 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBindingFrame.html#c6d068c261d4fc3a0a4d1305ade1483d" title="This method parse DOMElement, finds proper DOMNode and fills binded data accordingly...">AssemblyComponentsFromXML</a>( DOMElement &element ) = 0; |
---|
| 99 | <a name="l00113"></a>00113 |
---|
| 100 | <a name="l00115"></a><a class="code" href="classBindingFrame.html#8d4dc5902ee71a473983d6a8fa3c8b7a">00115</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBindingFrame.html#8d4dc5902ee71a473983d6a8fa3c8b7a" title="A method for releasing memory allocated within the &#39;AssemblyComponentsFromXML()&#39;...">ReleaseMemory</a>() {} |
---|
| 101 | <a name="l00116"></a>00116 |
---|
| 102 | <a name="l00119"></a>00119 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classBindingFrame.html#0c207ed6e5a4c975ed5bc9a758a063ca">DisassemblyComponentsToXML</a>( DOMElement &element ) = 0; |
---|
| 103 | <a name="l00120"></a>00120 }; |
---|
| 104 | <a name="l00121"></a>00121 |
---|
| 105 | <a name="l00125"></a><a class="code" href="classAttribute.html">00125</a> <span class="keyword">class </span><a class="code" href="classAttribute.html" title="Abstract class declaring general properties of a frame for data binding.">Attribute</a> |
---|
| 106 | <a name="l00126"></a>00126 { |
---|
| 107 | <a name="l00127"></a>00127 <span class="keyword">private</span>: |
---|
| 108 | <a name="l00131"></a>00131 <a class="code" href="classAssertXercesIsAlive.html" title="Class initializing Xerces library.">AssertXercesIsAlive</a> dummy; |
---|
[139] | 109 | <a name="l00132"></a>00132 |
---|
[162] | 110 | <a name="l00134"></a>00134 <span class="keyword">const</span> XMLCh* <span class="keyword">const</span> transcodedAttributeName; |
---|
| 111 | <a name="l00135"></a>00135 |
---|
| 112 | <a name="l00136"></a>00136 <span class="keyword">public</span>: |
---|
| 113 | <a name="l00138"></a>00138 <a class="code" href="classAttribute.html#4c4c80e6b59e3356324ef02d0e92d813" title="Default constructor fixing a name of the related attribute.">Attribute</a>( <span class="keywordtype">string</span> attributeName ); |
---|
| 114 | <a name="l00139"></a>00139 |
---|
| 115 | <a name="l00140"></a>00140 ~<a class="code" href="classAttribute.html" title="Abstract class declaring general properties of a frame for data binding.">Attribute</a>(); |
---|
| 116 | <a name="l00141"></a>00141 |
---|
| 117 | <a name="l00143"></a>00143 <span class="keywordtype">string</span>& <a class="code" href="classAttribute.html#6ebbcaaf9c90a979e645f469e02bb940" title="This method parse DOMElement, finds proper attribute and returns its value.">Get</a>( DOMElement &element ) <span class="keyword">const</span>; |
---|
[139] | 118 | <a name="l00144"></a>00144 |
---|
[181] | 119 | <a name="l00146"></a>00146 <span class="keywordtype">void</span> <a class="code" href="classAttribute.html#e011d84e2e3c40390807a8b8e58e3c35" title="This method adds the passed string as an new attribute into the passed DOMElement...">Set</a>( DOMElement &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &<a class="code" href="classstr.html" title="Structure of RV (used internally), i.e. expanded RVs.">str</a> ) <span class="keyword">const</span>; |
---|
[162] | 120 | <a name="l00147"></a>00147 |
---|
| 121 | <a name="l00149"></a><a class="code" href="classAttribute.html#d6474fd976f505e70e10c497199c6770">00149</a> <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="classAttribute.html" title="Abstract class declaring general properties of a frame for data binding.">Attribute</a> <a class="code" href="classAttribute.html#d6474fd976f505e70e10c497199c6770" title="Static member, an instance related to an attribute named &#39;help&#39;.">help</a>; |
---|
| 122 | <a name="l00150"></a>00150 |
---|
| 123 | <a name="l00152"></a><a class="code" href="classAttribute.html#5f6cce980606fa8943857204aacb5478">00152</a> <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="classAttribute.html" title="Abstract class declaring general properties of a frame for data binding.">Attribute</a> <a class="code" href="classAttribute.html#5f6cce980606fa8943857204aacb5478" title="Static member, a constant instance related to an attribute named &#39;type&#39;.">type</a>; |
---|
| 124 | <a name="l00153"></a>00153 |
---|
| 125 | <a name="l00155"></a><a class="code" href="classAttribute.html#452441da4ebfda23cdc668943ffe8da7">00155</a> <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="classAttribute.html" title="Abstract class declaring general properties of a frame for data binding.">Attribute</a> <a class="code" href="classAttribute.html#452441da4ebfda23cdc668943ffe8da7" title="Static member, a constant instance related to the attribute named &#39;value&#39;...">value</a>; |
---|
| 126 | <a name="l00156"></a>00156 }; |
---|
| 127 | <a name="l00157"></a>00157 |
---|
| 128 | <a name="l00158"></a>00158 |
---|
| 129 | <a name="l00159"></a>00159 |
---|
| 130 | <a name="l00167"></a><a class="code" href="classUserInfo.html">00167</a> <span class="keyword">class </span><a class="code" href="classUserInfo.html" title="UserInfo is an abstract is for internal purposes only. Use CompoundUserInfo&lt;T&gt;...">UserInfo</a> : <span class="keyword">protected</span> <a class="code" href="classBindingFrame.html" title="Abstract class declaring general properties of a frame for data binding.">BindingFrame</a> |
---|
| 131 | <a name="l00168"></a>00168 { |
---|
| 132 | <a name="l00169"></a>00169 <span class="keyword">private</span>: |
---|
| 133 | <a name="l00171"></a>00171 <span class="keyword">typedef</span> <a class="code" href="classUserInfo.html" title="UserInfo is an abstract is for internal purposes only. Use CompoundUserInfo&lt;T&gt;...">UserInfo</a>* <span class="keyword">const</span> pUserInfo; |
---|
| 134 | <a name="l00172"></a>00172 |
---|
| 135 | <a name="l00177"></a>00177 <span class="keyword">class </span>StringToUIMap |
---|
| 136 | <a name="l00178"></a>00178 { |
---|
| 137 | <a name="l00179"></a>00179 <span class="keyword">private</span>: |
---|
| 138 | <a name="l00181"></a>00181 <span class="keyword">typedef</span> map< const string, pUserInfo > MappedString2UI; |
---|
| 139 | <a name="l00182"></a>00182 |
---|
| 140 | <a name="l00184"></a>00184 <span class="keyword">static</span> MappedString2UI& privateMap(); |
---|
| 141 | <a name="l00185"></a>00185 |
---|
| 142 | <a name="l00186"></a>00186 <span class="keyword">public</span>: |
---|
| 143 | <a name="l00188"></a>00188 <span class="keyword">static</span> <span class="keywordtype">void</span> Add( <span class="keywordtype">string</span> key, pUserInfo pInstance ); |
---|
| 144 | <a name="l00189"></a>00189 |
---|
| 145 | <a name="l00191"></a>00191 <span class="keyword">static</span> pUserInfo Retrieve( <span class="keywordtype">string</span> key ); |
---|
| 146 | <a name="l00192"></a>00192 }; |
---|
| 147 | <a name="l00193"></a>00193 |
---|
| 148 | <a name="l00195"></a>00195 <span class="keyword">virtual</span> <span class="keywordtype">void</span>* AssemblyTypelessInstance() = 0; |
---|
| 149 | <a name="l00196"></a>00196 |
---|
| 150 | <a name="l00198"></a>00198 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> DisassemblyTypelessInstance(<span class="keywordtype">void</span>* pInstance) = 0; |
---|
| 151 | <a name="l00199"></a>00199 |
---|
| 152 | <a name="l00201"></a>00201 <span class="keyword">const</span> <span class="keywordtype">string</span> userFriendlyTypeName; |
---|
| 153 | <a name="l00202"></a>00202 |
---|
| 154 | <a name="l00204"></a>00204 <span class="keyword">const</span> <span class="keywordtype">string</span> typeNameByRTTI; |
---|
[139] | 155 | <a name="l00205"></a>00205 |
---|
[162] | 156 | <a name="l00206"></a>00206 <span class="keyword">protected</span>: |
---|
[139] | 157 | <a name="l00207"></a>00207 |
---|
[162] | 158 | <a name="l00209"></a><a class="code" href="classUserInfo.html#0bccb19c6b819cf9f763e985c573ae8f">00209</a> <a class="code" href="classUserInfo.html#0bccb19c6b819cf9f763e985c573ae8f" title="default constructor">UserInfo</a>( <span class="keyword">const</span> <span class="keywordtype">string</span>& userFriendlyTypeName, <span class="keyword">const</span> <span class="keywordtype">string</span>& typeNameByRTTI ) |
---|
| 159 | <a name="l00210"></a>00210 : userFriendlyTypeName ( removeSpaces( userFriendlyTypeName ) ), |
---|
| 160 | <a name="l00211"></a>00211 typeNameByRTTI( typeNameByRTTI ) |
---|
| 161 | <a name="l00212"></a>00212 { |
---|
| 162 | <a name="l00213"></a>00213 StringToUIMap::Add( userFriendlyTypeName, <span class="keyword">this</span> ); |
---|
| 163 | <a name="l00214"></a>00214 |
---|
| 164 | <a name="l00215"></a>00215 <span class="keywordflow">if</span>( userFriendlyTypeName != typeNameByRTTI ) |
---|
| 165 | <a name="l00216"></a>00216 <span class="comment">// we have a common map for both groups of names, </span> |
---|
| 166 | <a name="l00217"></a>00217 <span class="comment">// therefore, it is no use to add the same pair again</span> |
---|
| 167 | <a name="l00218"></a>00218 StringToUIMap::Add( typeNameByRTTI, <span class="keyword">this</span> ); |
---|
| 168 | <a name="l00219"></a>00219 } |
---|
| 169 | <a name="l00220"></a>00220 |
---|
| 170 | <a name="l00221"></a>00221 <span class="keyword">public</span>: |
---|
| 171 | <a name="l00225"></a>00225 <span class="keyword">template</span><<span class="keyword">class</span> T> |
---|
| 172 | <a name="l00226"></a><a class="code" href="classUserInfo.html#0f090c6525a3e8fb11634a553f467ede">00226</a> <span class="keyword">static</span> T* <a class="code" href="classUserInfo.html#0f090c6525a3e8fb11634a553f467ede">Assembly</a>( DOMElement &element, <span class="keyword">const</span> <span class="keywordtype">string</span> tagName ) |
---|
| 173 | <a name="l00227"></a>00227 { |
---|
| 174 | <a name="l00228"></a>00228 XMLCh* transcodedTagName = XMLString::transcode( tagName.c_str() ); |
---|
| 175 | <a name="l00229"></a>00229 XMLString::upperCase( transcodedTagName ); |
---|
| 176 | <a name="l00230"></a>00230 |
---|
| 177 | <a name="l00231"></a>00231 DOMNodeList* <span class="keyword">const</span> nodeList = element.getElementsByTagName( transcodedTagName ); |
---|
| 178 | <a name="l00232"></a>00232 XMLString::release( (XMLCh**)&transcodedTagName ); |
---|
| 179 | <a name="l00233"></a>00233 <span class="keywordflow">if</span>( !nodeList || nodeList->getLength() == 0 ) |
---|
| 180 | <a name="l00234"></a>00234 { |
---|
| 181 | <a name="l00235"></a>00235 cerr << <span class="stringliteral">"Warning: there is not any tag named "</span><span class="stringliteral">""</span> << tagName << <span class="stringliteral">""</span><span class="stringliteral">" in the passed DOM element of a XML docmument!"</span>; |
---|
| 182 | <a name="l00236"></a>00236 <span class="keywordflow">return</span> NULL; |
---|
| 183 | <a name="l00237"></a>00237 } |
---|
| 184 | <a name="l00238"></a>00238 |
---|
| 185 | <a name="l00239"></a>00239 <span class="keywordflow">if</span>( nodeList->getLength() > 1 ) |
---|
| 186 | <a name="l00240"></a>00240 { |
---|
| 187 | <a name="l00241"></a>00241 cerr << <span class="stringliteral">"Warning: there is to many elements named "</span><span class="stringliteral">""</span> << tagName << <span class="stringliteral">""</span><span class="stringliteral">" in the passed DOM element of a XML docmument. But the tag name has to be unique!"</span>; |
---|
| 188 | <a name="l00242"></a>00242 <span class="keywordflow">return</span> NULL; |
---|
| 189 | <a name="l00243"></a>00243 } |
---|
| 190 | <a name="l00244"></a>00244 |
---|
| 191 | <a name="l00245"></a>00245 <span class="comment">// this time we hold an element with the same name as the tagName is</span> |
---|
| 192 | <a name="l00246"></a>00246 DOMElement* pTheOnlyElement = (DOMElement*) nodeList->item(0); |
---|
| 193 | <a name="l00247"></a>00247 |
---|
| 194 | <a name="l00248"></a>00248 <span class="comment">// we get a velue stored in the "type" attribute </span> |
---|
| 195 | <a name="l00249"></a>00249 <span class="keywordtype">string</span> userFriendlyTypeName = <a class="code" href="classAttribute.html#5f6cce980606fa8943857204aacb5478" title="Static member, a constant instance related to an attribute named &#39;type&#39;.">Attribute::type</a>.<a class="code" href="classAttribute.html#6ebbcaaf9c90a979e645f469e02bb940" title="This method parse DOMElement, finds proper attribute and returns its value.">Get</a>( *pTheOnlyElement ); |
---|
| 196 | <a name="l00250"></a>00250 |
---|
| 197 | <a name="l00251"></a>00251 <span class="comment">// and finally we find a UserInfo related to this type</span> |
---|
| 198 | <a name="l00252"></a>00252 pUserInfo pRelatedUI = StringToUIMap::Retrieve( userFriendlyTypeName ); |
---|
| 199 | <a name="l00253"></a>00253 <span class="keywordflow">if</span>( !pRelatedUI ) |
---|
| 200 | <a name="l00254"></a>00254 { |
---|
| 201 | <a name="l00255"></a>00255 cerr << <span class="stringliteral">"Warning: there is not any UserInfo related to type named "</span><span class="stringliteral">""</span> << userFriendlyTypeName << <span class="stringliteral">""</span><span class="stringliteral">", instance assembling terminated!"</span>; |
---|
| 202 | <a name="l00256"></a>00256 <span class="keywordflow">return</span> NULL; |
---|
| 203 | <a name="l00257"></a>00257 } |
---|
| 204 | <a name="l00258"></a>00258 |
---|
| 205 | <a name="l00259"></a>00259 <span class="comment">// prepare all components necessary for an instance assembling</span> |
---|
| 206 | <a name="l00260"></a>00260 pRelatedUI->AssemblyComponentsFromXML( *pTheOnlyElement ); |
---|
| 207 | <a name="l00261"></a>00261 |
---|
| 208 | <a name="l00262"></a>00262 <span class="comment">// instance assembling </span> |
---|
| 209 | <a name="l00263"></a>00263 <span class="keywordtype">void</span>* pTypelessInstance = pRelatedUI->AssemblyTypelessInstance(); |
---|
| 210 | <a name="l00264"></a>00264 |
---|
| 211 | <a name="l00265"></a>00265 <span class="comment">// cleaning up</span> |
---|
| 212 | <a name="l00266"></a>00266 pRelatedUI->ReleaseMemory(); |
---|
[139] | 213 | <a name="l00267"></a>00267 |
---|
[162] | 214 | <a name="l00268"></a>00268 <span class="keywordflow">if</span>( pTypelessInstance == NULL ) |
---|
| 215 | <a name="l00269"></a>00269 { |
---|
| 216 | <a name="l00270"></a>00270 cerr << <span class="stringliteral">"Warning: there was some error when parsing a XML document, instance assembling terminated!"</span>; |
---|
| 217 | <a name="l00271"></a>00271 <span class="keywordflow">return</span> NULL; |
---|
| 218 | <a name="l00272"></a>00272 } |
---|
| 219 | <a name="l00273"></a>00273 |
---|
| 220 | <a name="l00274"></a>00274 T* pInstance = NULL; |
---|
| 221 | <a name="l00275"></a>00275 <span class="keywordflow">try</span> |
---|
| 222 | <a name="l00276"></a>00276 { |
---|
| 223 | <a name="l00277"></a>00277 <span class="comment">// a "do it yourself" type check:)</span> |
---|
| 224 | <a name="l00278"></a>00278 pInstance = (T*) pTypelessInstance; |
---|
| 225 | <a name="l00279"></a>00279 <span class="keywordtype">string</span> resultingTypeNameByRTTI = <span class="keyword">typeid</span>( *pInstance ).name(); |
---|
| 226 | <a name="l00280"></a>00280 <span class="keywordflow">if</span>( resultingTypeNameByRTTI != pRelatedUI->typeNameByRTTI ) |
---|
| 227 | <a name="l00281"></a>00281 pInstance = NULL; |
---|
| 228 | <a name="l00282"></a>00282 } |
---|
| 229 | <a name="l00283"></a>00283 <span class="keywordflow">catch</span>(...) |
---|
| 230 | <a name="l00284"></a>00284 { |
---|
| 231 | <a name="l00285"></a>00285 pInstance = NULL; |
---|
| 232 | <a name="l00286"></a>00286 } |
---|
| 233 | <a name="l00287"></a>00287 <span class="keywordflow">if</span>( pInstance == NULL ) |
---|
| 234 | <a name="l00288"></a>00288 cerr << <span class="stringliteral">"Warning: UserInfo related to type "</span><span class="stringliteral">""</span> << userFriendlyTypeName << <span class="stringliteral">""</span><span class="stringliteral">" have just returned instance of a different type! Instance assembling terminated!"</span>; |
---|
| 235 | <a name="l00289"></a>00289 |
---|
| 236 | <a name="l00290"></a>00290 <span class="keywordflow">return</span> pInstance; |
---|
| 237 | <a name="l00291"></a>00291 } |
---|
| 238 | <a name="l00292"></a>00292 |
---|
| 239 | <a name="l00296"></a>00296 <span class="keyword">template</span><<span class="keyword">class</span> T> |
---|
| 240 | <a name="l00297"></a><a class="code" href="classUserInfo.html#1d402661b82feccb5265a70f65c242e1">00297</a> <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classUserInfo.html#1d402661b82feccb5265a70f65c242e1">Disassembly</a>( T& instance, DOMElement &element, <span class="keyword">const</span> <span class="keywordtype">string</span> tagName, <span class="keyword">const</span> <span class="keywordtype">string</span> help) |
---|
| 241 | <a name="l00298"></a>00298 { |
---|
| 242 | <a name="l00299"></a>00299 pUserInfo pRelatedUI = StringToUIMap::Retrieve( <span class="keyword">typeid</span>(instance).name() ); |
---|
| 243 | <a name="l00300"></a>00300 <span class="keywordflow">if</span>( !pRelatedUI ) |
---|
| 244 | <a name="l00301"></a>00301 <span class="keywordflow">return</span> <span class="keyword">false</span>; |
---|
| 245 | <a name="l00302"></a>00302 |
---|
| 246 | <a name="l00303"></a>00303 <span class="comment">// add a new element named according the passed tagName</span> |
---|
| 247 | <a name="l00304"></a>00304 XMLCh* transcodedTagName = XMLString::transcode( tagName.c_str() ); |
---|
| 248 | <a name="l00305"></a>00305 XMLString::upperCase( transcodedTagName ); |
---|
| 249 | <a name="l00306"></a>00306 DOMDocument* pDoc = element.getOwnerDocument(); |
---|
| 250 | <a name="l00307"></a>00307 DOMElement* pCreatedElement = pDoc->createElement( transcodedTagName ); |
---|
| 251 | <a name="l00308"></a>00308 element.appendChild( pCreatedElement ); |
---|
| 252 | <a name="l00309"></a>00309 XMLString::release( (XMLCh**)&transcodedTagName ); |
---|
| 253 | <a name="l00310"></a>00310 |
---|
| 254 | <a name="l00311"></a>00311 <span class="comment">// add attributes "type" and "help"</span> |
---|
| 255 | <a name="l00312"></a>00312 <a class="code" href="classAttribute.html#5f6cce980606fa8943857204aacb5478" title="Static member, a constant instance related to an attribute named &#39;type&#39;.">Attribute::type</a>.<a class="code" href="classAttribute.html#e011d84e2e3c40390807a8b8e58e3c35" title="This method adds the passed string as an new attribute into the passed DOMElement...">Set</a>( *pCreatedElement, pRelatedUI->userFriendlyTypeName ); |
---|
| 256 | <a name="l00313"></a>00313 <a class="code" href="classAttribute.html#d6474fd976f505e70e10c497199c6770" title="Static member, an instance related to an attribute named &#39;help&#39;.">Attribute::help</a>.<a class="code" href="classAttribute.html#e011d84e2e3c40390807a8b8e58e3c35" title="This method adds the passed string as an new attribute into the passed DOMElement...">Set</a>( *pCreatedElement, help ); |
---|
| 257 | <a name="l00314"></a>00314 |
---|
| 258 | <a name="l00315"></a>00315 <span class="comment">// disassembly instance itself into its components</span> |
---|
| 259 | <a name="l00316"></a>00316 <span class="keywordtype">bool</span> result = pRelatedUI->DisassemblyTypelessInstance( (<span class="keywordtype">void</span>*) &instance ); |
---|
| 260 | <a name="l00317"></a>00317 <span class="keywordflow">if</span>( result ) |
---|
| 261 | <a name="l00318"></a>00318 <span class="comment">// disassembly all components of an instance </span> |
---|
| 262 | <a name="l00319"></a>00319 result = pRelatedUI->DisassemblyComponentsToXML( *pCreatedElement ); |
---|
| 263 | <a name="l00320"></a>00320 <span class="keywordflow">return</span> result; |
---|
| 264 | <a name="l00321"></a>00321 } |
---|
| 265 | <a name="l00322"></a>00322 |
---|
| 266 | <a name="l00326"></a>00326 <span class="keyword">template</span><<span class="keyword">class</span> T> |
---|
| 267 | <a name="l00327"></a><a class="code" href="classUserInfo.html#917b2257abc31b94c89ef3cd270e4a42">00327</a> <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classUserInfo.html#1d402661b82feccb5265a70f65c242e1">Disassembly</a>( T &instance, DOMElement &element, <span class="keyword">const</span> <span class="keywordtype">string</span> tagName ) |
---|
| 268 | <a name="l00328"></a>00328 { |
---|
| 269 | <a name="l00329"></a>00329 <span class="keywordflow">return</span> <a class="code" href="classUserInfo.html#1d402661b82feccb5265a70f65c242e1">Disassembly</a>( instance, element, tagName, <span class="stringliteral">""</span> ); |
---|
| 270 | <a name="l00330"></a>00330 } |
---|
| 271 | <a name="l00331"></a>00331 }; |
---|
| 272 | <a name="l00332"></a>00332 |
---|
| 273 | <a name="l00344"></a><a class="code" href="classTypedUserInfo.html">00344</a> <span class="keyword">template</span><<span class="keyword">typename</span> T> <span class="keyword">class </span><a class="code" href="classTypedUserInfo.html" title="TypeUserInfo is still an abstract class, but contrary to the UserInfo class it is...">TypedUserInfo</a> : <span class="keyword">public</span> <a class="code" href="classUserInfo.html" title="UserInfo is an abstract is for internal purposes only. Use CompoundUserInfo&lt;T&gt;...">UserInfo</a> |
---|
| 274 | <a name="l00345"></a>00345 { |
---|
| 275 | <a name="l00346"></a>00346 <span class="keyword">private</span>: |
---|
| 276 | <a name="l00347"></a>00347 |
---|
| 277 | <a name="l00348"></a>00348 <span class="keywordtype">bool</span> DisassemblyTypelessInstance(<span class="keywordtype">void</span>* pInstance) |
---|
| 278 | <a name="l00349"></a>00349 { |
---|
| 279 | <a name="l00350"></a>00350 <span class="keywordflow">try</span> |
---|
| 280 | <a name="l00351"></a>00351 { |
---|
| 281 | <a name="l00352"></a>00352 <span class="keywordflow">return</span> DisassemblyInstance( *(T*) pInstance ); |
---|
| 282 | <a name="l00353"></a>00353 } |
---|
| 283 | <a name="l00354"></a>00354 <span class="keywordflow">catch</span> (...) |
---|
| 284 | <a name="l00355"></a>00355 { |
---|
| 285 | <a name="l00356"></a>00356 <span class="keywordflow">return</span> <span class="keyword">false</span>; |
---|
| 286 | <a name="l00357"></a>00357 } |
---|
| 287 | <a name="l00358"></a>00358 } |
---|
| 288 | <a name="l00359"></a>00359 |
---|
| 289 | <a name="l00360"></a>00360 <span class="keywordtype">void</span>* AssemblyTypelessInstance() |
---|
| 290 | <a name="l00361"></a>00361 { |
---|
| 291 | <a name="l00362"></a>00362 <span class="keywordflow">return</span> (<span class="keywordtype">void</span>*) AssemblyInstance( ); |
---|
| 292 | <a name="l00363"></a>00363 } |
---|
| 293 | <a name="l00364"></a>00364 |
---|
| 294 | <a name="l00366"></a>00366 <span class="keyword">virtual</span> T* AssemblyInstance() = 0; |
---|
| 295 | <a name="l00367"></a>00367 |
---|
| 296 | <a name="l00369"></a>00369 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> DisassemblyInstance(T& <a class="code" href="classTypedUserInfo.html#c7ad10a9ff002383518155c965ade85c">instance</a>) = 0; |
---|
| 297 | <a name="l00370"></a>00370 |
---|
| 298 | <a name="l00371"></a>00371 <span class="keyword">protected</span>: |
---|
| 299 | <a name="l00372"></a>00372 |
---|
| 300 | <a name="l00374"></a>00374 <a class="code" href="classTypedUserInfo.html" title="TypeUserInfo is still an abstract class, but contrary to the UserInfo class it is...">TypedUserInfo<T></a>( <span class="keyword">const</span> <span class="keywordtype">string</span> &userFriendlyTypeName) |
---|
| 301 | <a name="l00375"></a>00375 : <a class="code" href="classUserInfo.html#0bccb19c6b819cf9f763e985c573ae8f" title="default constructor">UserInfo</a>( userFriendlyTypeName, <span class="keyword">typeid</span>(T).name() ) |
---|
| 302 | <a name="l00376"></a>00376 { |
---|
| 303 | <a name="l00377"></a>00377 |
---|
| 304 | <a name="l00378"></a><a class="code" href="classTypedUserInfo.html#b1bb67b76a677f0cf33e923fd9147e9a">00378</a> }; |
---|
| 305 | <a name="l00379"></a>00379 |
---|
| 306 | <a name="l00381"></a>00381 ~<a class="code" href="classTypedUserInfo.html" title="TypeUserInfo is still an abstract class, but contrary to the UserInfo class it is...">TypedUserInfo<T></a>() |
---|
| 307 | <a name="l00382"></a>00382 { |
---|
| 308 | <a name="l00383"></a>00383 } |
---|
| 309 | <a name="l00384"></a>00384 |
---|
| 310 | <a name="l00387"></a><a class="code" href="classTypedUserInfo.html#c7ad10a9ff002383518155c965ade85c">00387</a> <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="classTypedUserInfo.html" title="TypeUserInfo is still an abstract class, but contrary to the UserInfo class it is...">TypedUserInfo<T></a>& instance; |
---|
| 311 | <a name="l00388"></a>00388 }; |
---|
| 312 | <a name="l00389"></a>00389 |
---|
| 313 | <a name="l00390"></a>00390 |
---|
| 314 | <a name="l00420"></a><a class="code" href="classCompoundUserInfo.html">00420</a> <span class="keyword">template</span><<span class="keyword">typename</span> T> <span class="keyword">class </span><a class="code" href="classCompoundUserInfo.html" title="The main userinfo template class. You should derive this class whenever you need...">CompoundUserInfo</a> : <span class="keyword">public</span> <a class="code" href="classTypedUserInfo.html" title="TypeUserInfo is still an abstract class, but contrary to the UserInfo class it is...">TypedUserInfo</a><T> |
---|
| 315 | <a name="l00421"></a>00421 { |
---|
| 316 | <a name="l00422"></a>00422 <span class="keyword">private</span>: |
---|
| 317 | <a name="l00424"></a>00424 vector<BindingFrame*> bindedElements; |
---|
| 318 | <a name="l00425"></a>00425 |
---|
| 319 | <a name="l00426"></a>00426 <span class="keyword">protected</span>: |
---|
| 320 | <a name="l00427"></a>00427 |
---|
| 321 | <a name="l00432"></a><a class="code" href="classCompoundUserInfo_1_1BindedElement.html">00432</a> <span class="keyword">template</span><<span class="keyword">typename</span> U> <span class="keyword">class </span><a class="code" href="classCompoundUserInfo_1_1BindedElement.html" title="Templated class binding inner element with its XML tag and automating data transfers...">BindedElement</a>: <span class="keyword">public</span> <a class="code" href="classBindingFrame.html" title="Abstract class declaring general properties of a frame for data binding.">BindingFrame</a> |
---|
| 322 | <a name="l00433"></a>00433 { |
---|
| 323 | <a name="l00434"></a>00434 <span class="keyword">private</span>: |
---|
| 324 | <a name="l00435"></a>00435 <span class="keywordtype">string</span> name; |
---|
| 325 | <a name="l00436"></a>00436 <span class="keywordtype">string</span> help; |
---|
| 326 | <a name="l00437"></a>00437 <span class="keywordtype">bool</span> release; |
---|
| 327 | <a name="l00438"></a>00438 |
---|
| 328 | <a name="l00439"></a>00439 U* pValue; |
---|
| 329 | <a name="l00440"></a>00440 |
---|
| 330 | <a name="l00441"></a>00441 <span class="keyword">const</span> U defaultValue; |
---|
| 331 | <a name="l00442"></a>00442 |
---|
| 332 | <a name="l00443"></a>00443 |
---|
| 333 | <a name="l00444"></a>00444 <span class="keyword">public</span>: |
---|
| 334 | <a name="l00445"></a>00445 U value; |
---|
| 335 | <a name="l00446"></a>00446 |
---|
| 336 | <a name="l00447"></a>00447 <a class="code" href="classCompoundUserInfo_1_1BindedElement.html" title="Templated class binding inner element with its XML tag and automating data transfers...">BindedElement<U></a>( <a class="code" href="classCompoundUserInfo.html" title="The main userinfo template class. You should derive this class whenever you need...">CompoundUserInfo<T></a> *parent, <span class="keywordtype">string</span> name, U defaultValue, <span class="keywordtype">string</span> help ) |
---|
| 337 | <a name="l00448"></a>00448 : name( removeSpaces( name )), help(help), defaultValue( defaultValue ) |
---|
| 338 | <a name="l00449"></a>00449 { |
---|
| 339 | <a name="l00450"></a>00450 parent->bindedElements.push_back( <span class="keyword">this</span> ); |
---|
| 340 | <a name="l00451"></a>00451 pValue = NULL; |
---|
| 341 | <a name="l00452"></a>00452 value = defaultValue; |
---|
| 342 | <a name="l00453"></a>00453 } |
---|
| 343 | <a name="l00454"></a>00454 |
---|
| 344 | <a name="l00455"></a>00455 <a class="code" href="classCompoundUserInfo_1_1BindedElement.html" title="Templated class binding inner element with its XML tag and automating data transfers...">BindedElement<U></a>( <a class="code" href="classCompoundUserInfo.html" title="The main userinfo template class. You should derive this class whenever you need...">CompoundUserInfo<T></a> *parent, <span class="keywordtype">string</span> name, U defaultValue ) |
---|
| 345 | <a name="l00456"></a>00456 : name( removeSpaces( name )), help(<span class="stringliteral">""</span>), defaultValue( defaultValue ), value( defaultValue) |
---|
| 346 | <a name="l00457"></a>00457 { |
---|
| 347 | <a name="l00458"></a>00458 parent->bindedElements.push_back( <span class="keyword">this</span> ); |
---|
| 348 | <a name="l00459"></a>00459 pValue = NULL; |
---|
| 349 | <a name="l00460"></a>00460 value = defaultValue; |
---|
| 350 | <a name="l00461"></a>00461 } |
---|
| 351 | <a name="l00462"></a>00462 |
---|
| 352 | <a name="l00463"></a>00463 ~<a class="code" href="classCompoundUserInfo_1_1BindedElement.html" title="Templated class binding inner element with its XML tag and automating data transfers...">BindedElement<U></a>() |
---|
| 353 | <a name="l00464"></a>00464 { |
---|
| 354 | <a name="l00465"></a>00465 } |
---|
| 355 | <a name="l00466"></a>00466 |
---|
| 356 | <a name="l00467"></a><a class="code" href="classCompoundUserInfo_1_1BindedElement.html#159f56d7101091117dcdad68754bc195">00467</a> <span class="keywordtype">void</span> <a class="code" href="classCompoundUserInfo_1_1BindedElement.html#159f56d7101091117dcdad68754bc195" title="This method parse DOMElement, finds proper DOMNode and fills binded data accordingly...">AssemblyComponentsFromXML</a>( DOMElement &element ) |
---|
| 357 | <a name="l00468"></a>00468 { |
---|
| 358 | <a name="l00469"></a>00469 pValue = UserInfo::Assembly<U>( element, name ); |
---|
| 359 | <a name="l00470"></a>00470 <span class="keywordflow">if</span>( pValue ) value = *pValue; |
---|
| 360 | <a name="l00471"></a>00471 } |
---|
| 361 | <a name="l00472"></a>00472 |
---|
| 362 | <a name="l00473"></a><a class="code" href="classCompoundUserInfo_1_1BindedElement.html#e5a47de35cae44540b02d4c12fde54e4">00473</a> <span class="keywordtype">void</span> <a class="code" href="classCompoundUserInfo_1_1BindedElement.html#e5a47de35cae44540b02d4c12fde54e4" title="A method for releasing memory allocated within the &#39;AssemblyComponentsFromXML()&#39;...">ReleaseMemory</a>() |
---|
| 363 | <a name="l00474"></a>00474 { |
---|
| 364 | <a name="l00475"></a>00475 <span class="keywordflow">if</span>( pValue != NULL ) |
---|
| 365 | <a name="l00476"></a>00476 <span class="keyword">delete</span> pValue; |
---|
| 366 | <a name="l00477"></a>00477 } |
---|
| 367 | <a name="l00478"></a>00478 |
---|
| 368 | <a name="l00479"></a><a class="code" href="classCompoundUserInfo_1_1BindedElement.html#6ef55cedb98f5d2dbcf92730f2fed939">00479</a> <span class="keywordtype">bool</span> <a class="code" href="classCompoundUserInfo_1_1BindedElement.html#6ef55cedb98f5d2dbcf92730f2fed939">DisassemblyComponentsToXML</a>( DOMElement &element ) |
---|
| 369 | <a name="l00480"></a>00480 { |
---|
| 370 | <a name="l00481"></a>00481 <span class="keywordflow">return</span> <a class="code" href="classUserInfo.html#1d402661b82feccb5265a70f65c242e1">UserInfo::Disassembly</a>( value, element, name, help ); |
---|
| 371 | <a name="l00482"></a>00482 } |
---|
| 372 | <a name="l00483"></a>00483 }; |
---|
| 373 | <a name="l00484"></a>00484 |
---|
| 374 | <a name="l00485"></a>00485 <span class="keyword">private</span>: |
---|
| 375 | <a name="l00486"></a>00486 |
---|
| 376 | <a name="l00487"></a>00487 <span class="keywordtype">void</span> AssemblyComponentsFromXML( DOMElement &element ) |
---|
| 377 | <a name="l00488"></a>00488 { |
---|
| 378 | <a name="l00489"></a>00489 <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ind = 0; ind < bindedElements.size(); ind++ ) |
---|
| 379 | <a name="l00490"></a>00490 bindedElements[ind]->AssemblyComponentsFromXML( element ); |
---|
| 380 | <a name="l00491"></a>00491 } |
---|
| 381 | <a name="l00492"></a>00492 |
---|
| 382 | <a name="l00493"></a>00493 <span class="keywordtype">void</span> ReleaseMemory() |
---|
| 383 | <a name="l00494"></a>00494 { |
---|
| 384 | <a name="l00495"></a>00495 <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ind = 0; ind < bindedElements.size(); ind++ ) |
---|
| 385 | <a name="l00496"></a>00496 bindedElements[ind]->ReleaseMemory(); |
---|
| 386 | <a name="l00497"></a>00497 } |
---|
| 387 | <a name="l00498"></a>00498 |
---|
| 388 | <a name="l00499"></a>00499 <span class="keywordtype">bool</span> DisassemblyComponentsToXML( DOMElement &element ) |
---|
| 389 | <a name="l00500"></a>00500 { |
---|
| 390 | <a name="l00501"></a>00501 <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ind = 0; ind < bindedElements.size(); ind++ ) |
---|
| 391 | <a name="l00502"></a>00502 <span class="keywordflow">if</span>( !bindedElements[ind]->DisassemblyComponentsToXML( element ) ) |
---|
| 392 | <a name="l00503"></a>00503 <span class="keywordflow">return</span> <span class="keyword">false</span>; |
---|
| 393 | <a name="l00504"></a>00504 <span class="keywordflow">return</span> <span class="keyword">true</span>; |
---|
| 394 | <a name="l00505"></a>00505 } |
---|
| 395 | <a name="l00506"></a>00506 |
---|
| 396 | <a name="l00507"></a>00507 <span class="keyword">protected</span>: |
---|
| 397 | <a name="l00508"></a>00508 |
---|
| 398 | <a name="l00509"></a>00509 <a class="code" href="classCompoundUserInfo.html" title="The main userinfo template class. You should derive this class whenever you need...">CompoundUserInfo<T></a>( <span class="keywordtype">string</span> userFriendlyTypeName ) |
---|
| 399 | <a name="l00510"></a>00510 : <a class="code" href="classTypedUserInfo.html" title="TypeUserInfo is still an abstract class, but contrary to the UserInfo class it is...">TypedUserInfo<T></a>( userFriendlyTypeName ) |
---|
| 400 | <a name="l00511"></a>00511 { |
---|
| 401 | <a name="l00512"></a>00512 } |
---|
| 402 | <a name="l00513"></a>00513 |
---|
| 403 | <a name="l00514"></a>00514 }; |
---|
| 404 | <a name="l00515"></a>00515 |
---|
| 405 | <a name="l00516"></a>00516 |
---|
| 406 | <a name="l00527"></a><a class="code" href="classValuedUserInfo.html">00527</a> <span class="keyword">template</span><<span class="keyword">typename</span> T> <span class="keyword">class </span><a class="code" href="classValuedUserInfo.html" title="The main userinfo template class. It should be derived whenever you need a new userinfo...">ValuedUserInfo</a> : <span class="keyword">public</span> <a class="code" href="classTypedUserInfo.html" title="TypeUserInfo is still an abstract class, but contrary to the UserInfo class it is...">TypedUserInfo</a><T> |
---|
| 407 | <a name="l00528"></a>00528 { |
---|
| 408 | <a name="l00529"></a>00529 <span class="keyword">private</span>: |
---|
| 409 | <a name="l00530"></a>00530 <span class="keywordtype">void</span> AssemblyComponentsFromXML( DOMElement &element ) |
---|
| 410 | <a name="l00531"></a>00531 { |
---|
| 411 | <a name="l00532"></a>00532 <a class="code" href="classValuedUserInfo.html#10a0acb3696018386451881ebcc797ea" title="string variable which is automatically binded to a proper DOMElement attribute">value</a> = <a class="code" href="classAttribute.html#452441da4ebfda23cdc668943ffe8da7" title="Static member, a constant instance related to the attribute named &#39;value&#39;...">Attribute::value</a>.<a class="code" href="classAttribute.html#6ebbcaaf9c90a979e645f469e02bb940" title="This method parse DOMElement, finds proper attribute and returns its value.">Get</a>( element ); |
---|
| 412 | <a name="l00533"></a>00533 } |
---|
| 413 | <a name="l00534"></a>00534 |
---|
| 414 | <a name="l00535"></a>00535 <span class="keywordtype">bool</span> DisassemblyComponentsToXML( DOMElement &element ) |
---|
| 415 | <a name="l00536"></a>00536 { |
---|
| 416 | <a name="l00537"></a>00537 <a class="code" href="classAttribute.html#452441da4ebfda23cdc668943ffe8da7" title="Static member, a constant instance related to the attribute named &#39;value&#39;...">Attribute::value</a>.<a class="code" href="classAttribute.html#e011d84e2e3c40390807a8b8e58e3c35" title="This method adds the passed string as an new attribute into the passed DOMElement...">Set</a>( element, <a class="code" href="classValuedUserInfo.html#10a0acb3696018386451881ebcc797ea" title="string variable which is automatically binded to a proper DOMElement attribute">value</a> ); |
---|
| 417 | <a name="l00538"></a>00538 <span class="keywordflow">return</span> <span class="keyword">true</span>; |
---|
| 418 | <a name="l00539"></a>00539 } |
---|
| 419 | <a name="l00540"></a>00540 |
---|
| 420 | <a name="l00541"></a>00541 <span class="keyword">protected</span>: |
---|
| 421 | <a name="l00542"></a>00542 <a class="code" href="classValuedUserInfo.html" title="The main userinfo template class. It should be derived whenever you need a new userinfo...">ValuedUserInfo<T></a>( <span class="keywordtype">string</span> userFriendlyTypeName ) |
---|
| 422 | <a name="l00543"></a>00543 : <a class="code" href="classTypedUserInfo.html" title="TypeUserInfo is still an abstract class, but contrary to the UserInfo class it is...">TypedUserInfo<T></a>( userFriendlyTypeName ) |
---|
| 423 | <a name="l00544"></a>00544 { |
---|
| 424 | <a name="l00545"></a>00545 } |
---|
| 425 | <a name="l00546"></a>00546 |
---|
| 426 | <a name="l00547"></a>00547 ~<a class="code" href="classValuedUserInfo.html" title="The main userinfo template class. It should be derived whenever you need a new userinfo...">ValuedUserInfo<T></a>() |
---|
| 427 | <a name="l00548"></a>00548 { |
---|
| 428 | <a name="l00549"></a>00549 } |
---|
| 429 | <a name="l00550"></a>00550 |
---|
| 430 | <a name="l00552"></a><a class="code" href="classValuedUserInfo.html#10a0acb3696018386451881ebcc797ea">00552</a> <span class="keywordtype">string</span> <a class="code" href="classValuedUserInfo.html#10a0acb3696018386451881ebcc797ea" title="string variable which is automatically binded to a proper DOMElement attribute">value</a>; |
---|
| 431 | <a name="l00553"></a>00553 }; |
---|
| 432 | <a name="l00554"></a>00554 |
---|
| 433 | <a name="l00576"></a><a class="code" href="classRootElement.html">00576</a> <span class="keyword">class </span><a class="code" href="classRootElement.html" title="This class serves to load and/or save DOMElements into/from files stored on a hard-disk...">RootElement</a> |
---|
| 434 | <a name="l00577"></a>00577 { |
---|
| 435 | <a name="l00578"></a>00578 <span class="keyword">private</span>: |
---|
| 436 | <a name="l00582"></a>00582 <span class="keyword">const</span> <a class="code" href="classAssertXercesIsAlive.html" title="Class initializing Xerces library.">AssertXercesIsAlive</a> dummy; |
---|
| 437 | <a name="l00583"></a>00583 |
---|
| 438 | <a name="l00585"></a>00585 DOMDocument* pDoc; |
---|
| 439 | <a name="l00586"></a>00586 |
---|
| 440 | <a name="l00587"></a>00587 <span class="keyword">const</span> XMLCh* <span class="keyword">const</span> transcodedFileName; |
---|
| 441 | <a name="l00588"></a>00588 |
---|
| 442 | <a name="l00590"></a>00590 DOMImplementation *pImplementation; |
---|
| 443 | <a name="l00591"></a>00591 |
---|
| 444 | <a name="l00593"></a>00593 DOMWriter *pSerializer; |
---|
| 445 | <a name="l00594"></a>00594 |
---|
| 446 | <a name="l00595"></a>00595 <span class="keywordtype">void</span> Clean(); |
---|
| 447 | <a name="l00596"></a>00596 |
---|
| 448 | <a name="l00597"></a>00597 <span class="keyword">public</span>: |
---|
[171] | 449 | <a name="l00599"></a>00599 <a class="code" href="classRootElement.html#6238814d4d806101cf54c6d803aac46c" title="attach new RootElement instance to a file (typically with an XML extension)">RootElement</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* fileName ); |
---|
[162] | 450 | <a name="l00600"></a>00600 |
---|
| 451 | <a name="l00601"></a>00601 ~<a class="code" href="classRootElement.html" title="This class serves to load and/or save DOMElements into/from files stored on a hard-disk...">RootElement</a>(); |
---|
| 452 | <a name="l00602"></a>00602 |
---|
| 453 | <a name="l00604"></a>00604 <span class="keywordtype">bool</span> <a class="code" href="classRootElement.html#888749537060fd60a939486cd2e73b9b" title="this method loads root element and all its subnodes from the attached file">Load</a>( <span class="keywordtype">void</span> ) ; |
---|
| 454 | <a name="l00605"></a>00605 |
---|
| 455 | <a name="l00607"></a>00607 <span class="keywordtype">void</span> <a class="code" href="classRootElement.html#5ce717e64c3b7be09f695e6ede6294db" title="this method saves all the previsoulsy attached DOMElements into the file">Save</a> ( <span class="keywordtype">void</span> ); |
---|
| 456 | <a name="l00608"></a>00608 |
---|
| 457 | <a name="l00610"></a>00610 <a class="code" href="classRootElement.html#9ad2ae1c73d73b06bc98afa0f32d9ad3" title="this operator allows to use a RootElement instance whenever a DOMElement variable...">operator DOMElement&</a>(); |
---|
| 458 | <a name="l00611"></a>00611 }; |
---|
| 459 | <a name="l00612"></a>00612 |
---|
| 460 | <a name="l00613"></a>00613 |
---|
| 461 | <a name="l00617"></a>00617 |
---|
| 462 | <a name="l00618"></a>00618 <span class="keyword">class </span>BoolUI: <span class="keyword">public</span> <a class="code" href="classValuedUserInfo.html" title="The main userinfo template class. It should be derived whenever you need a new userinfo...">ValuedUserInfo</a><bool> |
---|
| 463 | <a name="l00619"></a>00619 { |
---|
| 464 | <a name="l00620"></a>00620 <span class="keyword">private</span>: |
---|
| 465 | <a name="l00621"></a>00621 |
---|
| 466 | <a name="l00622"></a>00622 <span class="keywordtype">bool</span>* AssemblyInstance() |
---|
| 467 | <a name="l00623"></a>00623 { |
---|
| 468 | <a name="l00624"></a>00624 <span class="keywordflow">if</span>( value == <span class="stringliteral">"true"</span> ) |
---|
| 469 | <a name="l00625"></a>00625 <span class="keywordflow">return</span> <span class="keyword">new</span> bool( <span class="keyword">true</span> ); |
---|
| 470 | <a name="l00626"></a>00626 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( value == <span class="stringliteral">"false"</span> ) |
---|
| 471 | <a name="l00627"></a>00627 <span class="keywordflow">return</span> <span class="keyword">new</span> bool( <span class="keyword">false</span> ); |
---|
| 472 | <a name="l00628"></a>00628 <span class="keywordflow">else</span> <span class="keywordflow">return</span> NULL; |
---|
| 473 | <a name="l00629"></a>00629 } |
---|
| 474 | <a name="l00630"></a>00630 |
---|
| 475 | <a name="l00631"></a>00631 <span class="keywordtype">bool</span> DisassemblyInstance(<span class="keywordtype">bool</span> &instance) |
---|
| 476 | <a name="l00632"></a>00632 { |
---|
| 477 | <a name="l00633"></a>00633 <span class="keywordflow">if</span>( instance ) |
---|
| 478 | <a name="l00634"></a>00634 <a class="code" href="classValuedUserInfo.html#10a0acb3696018386451881ebcc797ea" title="string variable which is automatically binded to a proper DOMElement attribute">value</a> = <span class="stringliteral">"true"</span>; |
---|
| 479 | <a name="l00635"></a>00635 <span class="keywordflow">else</span> |
---|
| 480 | <a name="l00636"></a>00636 <a class="code" href="classValuedUserInfo.html#10a0acb3696018386451881ebcc797ea" title="string variable which is automatically binded to a proper DOMElement attribute">value</a> = <span class="stringliteral">"false"</span>; |
---|
| 481 | <a name="l00637"></a>00637 <span class="keywordflow">return</span> <span class="keyword">true</span>; |
---|
| 482 | <a name="l00638"></a>00638 } |
---|
| 483 | <a name="l00639"></a>00639 |
---|
| 484 | <a name="l00640"></a>00640 <span class="keyword">public</span>: |
---|
| 485 | <a name="l00641"></a>00641 |
---|
| 486 | <a name="l00642"></a>00642 BoolUI() |
---|
| 487 | <a name="l00643"></a>00643 : <a class="code" href="classValuedUserInfo.html" title="The main userinfo template class. It should be derived whenever you need a new userinfo...">ValuedUserInfo</a><bool>(<span class="stringliteral">"bool"</span>) |
---|
| 488 | <a name="l00644"></a>00644 { |
---|
| 489 | <a name="l00645"></a>00645 } |
---|
| 490 | <a name="l00646"></a>00646 }; |
---|
| 491 | <a name="l00647"></a>00647 |
---|
| 492 | <a name="l00648"></a>00648 |
---|
| 493 | <a name="l00649"></a>00649 <span class="keyword">class </span>IntUI: <span class="keyword">public</span> <a class="code" href="classValuedUserInfo.html" title="The main userinfo template class. It should be derived whenever you need a new userinfo...">ValuedUserInfo</a><int> |
---|
| 494 | <a name="l00650"></a>00650 { |
---|
| 495 | <a name="l00651"></a>00651 <span class="keyword">private</span>: |
---|
| 496 | <a name="l00652"></a>00652 |
---|
| 497 | <a name="l00653"></a>00653 <span class="keywordtype">int</span>* AssemblyInstance() |
---|
| 498 | <a name="l00654"></a>00654 { |
---|
| 499 | <a name="l00655"></a>00655 <span class="keywordflow">return</span> <span class="keyword">new</span> int( atoi( <a class="code" href="classValuedUserInfo.html#10a0acb3696018386451881ebcc797ea" title="string variable which is automatically binded to a proper DOMElement attribute">value</a>.c_str()) ); |
---|
| 500 | <a name="l00656"></a>00656 } |
---|
| 501 | <a name="l00657"></a>00657 |
---|
| 502 | <a name="l00658"></a>00658 <span class="keywordtype">bool</span> DisassemblyInstance(<span class="keywordtype">int</span> &instance) |
---|
| 503 | <a name="l00659"></a>00659 { |
---|
| 504 | <a name="l00660"></a>00660 <span class="keywordtype">char</span> buff[30]; |
---|
| 505 | <a name="l00661"></a>00661 sprintf(buff, <span class="stringliteral">"%d"</span>, instance ); |
---|
| 506 | <a name="l00662"></a>00662 <a class="code" href="classValuedUserInfo.html#10a0acb3696018386451881ebcc797ea" title="string variable which is automatically binded to a proper DOMElement attribute">value</a> = buff; |
---|
| 507 | <a name="l00663"></a>00663 <span class="keywordflow">return</span> <span class="keyword">true</span>; |
---|
| 508 | <a name="l00664"></a>00664 } |
---|
| 509 | <a name="l00665"></a>00665 |
---|
| 510 | <a name="l00666"></a>00666 <span class="keyword">public</span>: |
---|
| 511 | <a name="l00667"></a>00667 IntUI():<a class="code" href="classValuedUserInfo.html" title="The main userinfo template class. It should be derived whenever you need a new userinfo...">ValuedUserInfo</a><int>(<span class="stringliteral">"int"</span>) |
---|
| 512 | <a name="l00668"></a>00668 { |
---|
| 513 | <a name="l00669"></a>00669 } |
---|
| 514 | <a name="l00670"></a>00670 }; |
---|
| 515 | <a name="l00671"></a>00671 |
---|
| 516 | <a name="l00672"></a>00672 |
---|
| 517 | <a name="l00673"></a>00673 |
---|
| 518 | <a name="l00674"></a>00674 <span class="keyword">class </span>DoubleUI: <span class="keyword">public</span> <a class="code" href="classValuedUserInfo.html" title="The main userinfo template class. It should be derived whenever you need a new userinfo...">ValuedUserInfo</a><double> |
---|
| 519 | <a name="l00675"></a>00675 { |
---|
| 520 | <a name="l00676"></a>00676 <span class="keyword">private</span>: |
---|
| 521 | <a name="l00677"></a>00677 |
---|
| 522 | <a name="l00678"></a>00678 <span class="keywordtype">double</span>* AssemblyInstance() |
---|
| 523 | <a name="l00679"></a>00679 { |
---|
| 524 | <a name="l00680"></a>00680 <span class="keywordflow">return</span> <span class="keyword">new</span> double( atof( <a class="code" href="classValuedUserInfo.html#10a0acb3696018386451881ebcc797ea" title="string variable which is automatically binded to a proper DOMElement attribute">value</a>.c_str()) ); |
---|
| 525 | <a name="l00681"></a>00681 } |
---|
| 526 | <a name="l00682"></a>00682 |
---|
| 527 | <a name="l00683"></a>00683 <span class="keywordtype">bool</span> DisassemblyInstance(<span class="keywordtype">double</span> &instance) |
---|
| 528 | <a name="l00684"></a>00684 { |
---|
| 529 | <a name="l00685"></a>00685 <span class="keywordtype">char</span> buff[30]; |
---|
| 530 | <a name="l00686"></a>00686 sprintf(buff, <span class="stringliteral">"%f"</span>, instance ); |
---|
| 531 | <a name="l00687"></a>00687 <a class="code" href="classValuedUserInfo.html#10a0acb3696018386451881ebcc797ea" title="string variable which is automatically binded to a proper DOMElement attribute">value</a> = buff; |
---|
| 532 | <a name="l00688"></a>00688 <span class="keywordflow">return</span> <span class="keyword">true</span>; |
---|
| 533 | <a name="l00689"></a>00689 } |
---|
| 534 | <a name="l00690"></a>00690 |
---|
| 535 | <a name="l00691"></a>00691 <span class="keyword">public</span>: |
---|
| 536 | <a name="l00692"></a>00692 DoubleUI():<a class="code" href="classValuedUserInfo.html" title="The main userinfo template class. It should be derived whenever you need a new userinfo...">ValuedUserInfo</a><double>(<span class="stringliteral">"double"</span>) |
---|
| 537 | <a name="l00693"></a>00693 { |
---|
| 538 | <a name="l00694"></a>00694 } |
---|
| 539 | <a name="l00695"></a>00695 }; |
---|
| 540 | <a name="l00696"></a>00696 |
---|
| 541 | <a name="l00697"></a>00697 |
---|
| 542 | <a name="l00698"></a>00698 <span class="keyword">class </span>StringUI: <span class="keyword">public</span> <a class="code" href="classValuedUserInfo.html" title="The main userinfo template class. It should be derived whenever you need a new userinfo...">ValuedUserInfo</a><string> |
---|
| 543 | <a name="l00699"></a>00699 { |
---|
| 544 | <a name="l00700"></a>00700 <span class="keyword">private</span>: |
---|
| 545 | <a name="l00701"></a>00701 <span class="keywordtype">string</span>* AssemblyInstance() |
---|
| 546 | <a name="l00702"></a>00702 { |
---|
| 547 | <a name="l00703"></a>00703 <span class="keywordflow">return</span> <span class="keyword">new</span> string( value ); |
---|
| 548 | <a name="l00704"></a>00704 } |
---|
| 549 | <a name="l00705"></a>00705 |
---|
| 550 | <a name="l00706"></a>00706 <span class="keywordtype">bool</span> DisassemblyInstance(<span class="keywordtype">string</span> &instance) |
---|
| 551 | <a name="l00707"></a>00707 { |
---|
| 552 | <a name="l00708"></a>00708 <a class="code" href="classValuedUserInfo.html#10a0acb3696018386451881ebcc797ea" title="string variable which is automatically binded to a proper DOMElement attribute">value</a> = instance; |
---|
| 553 | <a name="l00709"></a>00709 <span class="keywordflow">return</span> <span class="keyword">true</span>; |
---|
| 554 | <a name="l00710"></a>00710 } |
---|
| 555 | <a name="l00711"></a>00711 |
---|
| 556 | <a name="l00712"></a>00712 <span class="keyword">public</span>: |
---|
| 557 | <a name="l00713"></a>00713 StringUI():<a class="code" href="classValuedUserInfo.html" title="The main userinfo template class. It should be derived whenever you need a new userinfo...">ValuedUserInfo</a><string>(<span class="stringliteral">"string"</span>) |
---|
| 558 | <a name="l00714"></a>00714 { |
---|
| 559 | <a name="l00715"></a>00715 } |
---|
| 560 | <a name="l00716"></a>00716 }; |
---|
| 561 | <a name="l00717"></a>00717 |
---|
| 562 | <a name="l00718"></a>00718 |
---|
| 563 | <a name="l00719"></a>00719 <span class="preprocessor">#endif // #ifndef UI_H</span> |
---|
[91] | 564 | </pre></div></div> |
---|
[234] | 565 | <hr size="1"><address style="text-align: right;"><small>Generated on Thu Jan 15 10:50:25 2009 for mixpp by |
---|
[84] | 566 | <a href="http://www.doxygen.org/index.html"> |
---|
[139] | 567 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address> |
---|
[84] | 568 | </body> |
---|
| 569 | </html> |
---|