| 24 | | <a name="l00008"></a>00008 <span class="preprocessor">#include <map></span> |
| 25 | | <a name="l00009"></a>00009 <span class="preprocessor">#include <utility></span> |
| 26 | | <a name="l00010"></a>00010 <span class="preprocessor">#include <xercesc/dom/DOM.hpp></span> |
| 27 | | <a name="l00011"></a>00011 <span class="preprocessor">#include <xercesc/util/PlatformUtils.hpp></span> |
| 28 | | <a name="l00012"></a>00012 <span class="preprocessor">#include <xercesc/util/XMLString.hpp></span> |
| 29 | | <a name="l00013"></a>00013 <span class="preprocessor">#include <iostream></span> |
| 30 | | <a name="l00014"></a>00014 <span class="preprocessor">#include <xercesc/framework/LocalFileFormatTarget.hpp></span> |
| 31 | | <a name="l00015"></a>00015 <span class="preprocessor">#include <xercesc/framework/LocalFileInputSource.hpp></span> |
| 32 | | <a name="l00016"></a>00016 <span class="preprocessor">#include <xercesc/dom/DOMWriter.hpp></span> |
| 33 | | <a name="l00017"></a>00017 <span class="preprocessor">#include <xercesc/parsers/XercesDOMParser.hpp></span> |
| 34 | | <a name="l00018"></a>00018 |
| 35 | | <a name="l00019"></a>00019 <span class="preprocessor">#ifdef XERCES_CPP_NAMESPACE_USE</span> |
| 36 | | <a name="l00020"></a>00020 <span class="preprocessor"></span>XERCES_CPP_NAMESPACE_USE |
| 37 | | <a name="l00021"></a>00021 <span class="preprocessor">#endif</span> |
| 38 | | <a name="l00022"></a>00022 <span class="preprocessor"></span> |
| 39 | | <a name="l00023"></a>00023 <span class="keyword">using</span> std::string; |
| 40 | | <a name="l00024"></a>00024 <span class="keyword">using namespace </span>std; |
| 41 | | <a name="l00025"></a>00025 |
| 42 | | <a name="l00026"></a>00026 |
| 43 | | <a name="l00032"></a><a class="code" href="classGlobalXercesConnector.html">00032</a> <span class="keyword">class </span><a class="code" href="classGlobalXercesConnector.html" title="Xerces interface class.">GlobalXercesConnector</a> |
| 44 | | <a name="l00033"></a>00033 { |
| 45 | | <a name="l00034"></a>00034 <span class="keyword">public</span>: |
| 46 | | <a name="l00036"></a><a class="code" href="classGlobalXercesConnector.html#8d2d2a3f1b2a21a9647f7bc4c7e82c73">00036</a> DOMImplementation *<a class="code" href="classGlobalXercesConnector.html#8d2d2a3f1b2a21a9647f7bc4c7e82c73" title="DOMImplementation is a base class for the all DOM oparations.">pImplementation</a>; |
| 47 | | <a name="l00038"></a><a class="code" href="classGlobalXercesConnector.html#c6c620829e2a2fface1bea202b0608a6">00038</a> DOMWriter *<a class="code" href="classGlobalXercesConnector.html#c6c620829e2a2fface1bea202b0608a6" title="This DOMWriter is used to export internal data into xml files.">pSerializer</a>; |
| 48 | | <a name="l00040"></a><a class="code" href="classGlobalXercesConnector.html#ca92055e0f5a5ea3d8cb1c4d6bf0dd51">00040</a> XercesDOMParser *<a class="code" href="classGlobalXercesConnector.html#ca92055e0f5a5ea3d8cb1c4d6bf0dd51" title="This DOMWriter is used to import external data from xml files.">pParser</a>; |
| 49 | | <a name="l00041"></a>00041 |
| 50 | | <a name="l00042"></a>00042 |
| 51 | | <a name="l00044"></a>00044 <a class="code" href="classGlobalXercesConnector.html#5bf4f5c7f9e7b54a318e99bb0e3f186d" title="default constructor">GlobalXercesConnector</a>(); |
| 52 | | <a name="l00046"></a>00046 <a class="code" href="classGlobalXercesConnector.html#d61ca15a9bf7d358c5afd8fd1e42c3ca" title="destructor">~GlobalXercesConnector</a>(); |
| 53 | | <a name="l00047"></a>00047 |
| 54 | | <a name="l00048"></a>00048 |
| 55 | | <a name="l00050"></a>00050 <span class="keyword">static</span> <span class="keywordtype">string</span> <a class="code" href="classGlobalXercesConnector.html#9800b81014bc6497815e28ad4bd3cf3a" title="function transcodes Xerces&#39; XMLCh-based strings into C++ strings">XMLCh2str</a>( <span class="keyword">const</span> XMLCh* <span class="keyword">const</span> XMLCh_str ); |
| 56 | | <a name="l00051"></a>00051 |
| 57 | | <a name="l00052"></a>00052 <span class="keyword">class </span>Comparator |
| 58 | | <a name="l00053"></a>00053 { |
| 59 | | <a name="l00054"></a>00054 <span class="keyword">public</span>: |
| 60 | | <a name="l00056"></a>00056 <span class="keywordtype">bool</span> operator()( <span class="keyword">const</span> XMLCh* <span class="keyword">const</span> a , <span class="keyword">const</span> XMLCh* <span class="keyword">const</span> b) <span class="keyword">const</span>; |
| 61 | | <a name="l00057"></a>00057 }; |
| 62 | | <a name="l00058"></a>00058 }; |
| 63 | | <a name="l00059"></a>00059 |
| 64 | | <a name="l00061"></a>00061 <span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="classGlobalXercesConnector.html" title="Xerces interface class.">GlobalXercesConnector</a> XMLConnector; |
| 65 | | <a name="l00062"></a>00062 |
| 66 | | <a name="l00063"></a>00063 |
| 67 | | <a name="l00070"></a><a class="code" href="classAttribute.html">00070</a> <span class="keyword">class </span><a class="code" href="classAttribute.html" title="User Info base class.">Attribute</a> |
| 68 | | <a name="l00071"></a>00071 { |
| 69 | | <a name="l00072"></a>00072 <span class="keyword">private</span>: |
| 70 | | <a name="l00075"></a>00075 XMLCh* <span class="keyword">const</span> transcodedName; |
| 71 | | <a name="l00076"></a>00076 |
| 72 | | <a name="l00077"></a>00077 <span class="keyword">public</span>: |
| 73 | | <a name="l00079"></a><a class="code" href="classAttribute.html#342750acf29e4c37d009301ef5075111">00079</a> <span class="keyword">typedef</span> map<const XMLCh* const, Attribute* const, GlobalXercesConnector::Comparator> <a class="code" href="classAttribute.html#342750acf29e4c37d009301ef5075111" title="Type definition of mapping which transforms names to the related attributes.">MappedAttributes</a>; |
| 74 | | <a name="l00080"></a>00080 |
| 75 | | <a name="l00082"></a>00082 <a class="code" href="classAttribute.html#31c94d75bbe6b2834b1ef633cb8565fb" title="The only constructor which fills the transcodedName attribute.">Attribute</a>( <span class="keyword">const</span> <span class="keywordtype">string</span> name ); |
| 76 | | <a name="l00084"></a>00084 <a class="code" href="classAttribute.html#28ab087bb886728670e4ae5791bc2ea8" title="Destructor.">~Attribute</a>(); |
| 77 | | <a name="l00085"></a>00085 |
| 78 | | <a name="l00087"></a>00087 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classAttribute.html#bfb68f3502af06cda0f61390526e1c2f" title="Set accessor to this attribute converting input string into a properly-typed value...">Set</a>( <span class="keyword">const</span> <span class="keywordtype">string</span> str ) = 0; |
| 79 | | <a name="l00089"></a>00089 <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">string</span> <a class="code" href="classAttribute.html#ebeef001a0f4176900f643f529c549b8" title="Get accessor converting stored value into a string.">Get</a>() = 0; |
| 80 | | <a name="l00091"></a>00091 <span class="keywordtype">void</span> <a class="code" href="classAttribute.html#abd94a0487d662f28264f4faa214d894" title="This method is the key method to connect the attribute to the related UI element...">Attach</a>( <a class="code" href="classAttribute.html#342750acf29e4c37d009301ef5075111" title="Type definition of mapping which transforms names to the related attributes.">MappedAttributes</a> &externalAttributes); |
| 81 | | <a name="l00093"></a>00093 <span class="keywordtype">void</span> <a class="code" href="classAttribute.html#387a68e5de7b1e31022022493f00cbff" title="This method add and DOMAttribute node to the DOMElement passed as an argument.">FillAttribute</a>(DOMElement &element); |
| 82 | | <a name="l00094"></a>00094 }; |
| 83 | | <a name="l00095"></a>00095 |
| 84 | | <a name="l00099"></a><a class="code" href="classDoubleAttribute.html">00099</a> <span class="keyword">class </span><a class="code" href="classDoubleAttribute.html" title="Class encapsulating all the necessary stuff to work with the double attribute.">DoubleAttribute</a>: <span class="keyword">public</span> <a class="code" href="classAttribute.html" title="User Info base class.">Attribute</a> |
| 85 | | <a name="l00100"></a>00100 { |
| 86 | | <a name="l00101"></a>00101 <span class="keyword">public</span>: |
| 87 | | <a name="l00102"></a>00102 <span class="keywordtype">double</span> value; |
| 88 | | <a name="l00103"></a>00103 <a class="code" href="classDoubleAttribute.html" title="Class encapsulating all the necessary stuff to work with the double attribute.">DoubleAttribute</a>( <span class="keyword">const</span> <span class="keywordtype">string</span> name); |
| 89 | | <a name="l00104"></a>00104 <span class="keywordtype">void</span> <a class="code" href="classDoubleAttribute.html#7d921d52c0ea0765aa26775ddeaaf6e9" title="Set accessor to this attribute converting input string into a properly-typed value...">Set</a>( <span class="keyword">const</span> <span class="keywordtype">string</span> str ); |
| 90 | | <a name="l00105"></a>00105 <span class="keyword">const</span> <span class="keywordtype">string</span> <a class="code" href="classDoubleAttribute.html#b1eca4e8345b1f09e6966c4ff6f32e21" title="Get accessor converting stored value into a string.">Get</a>(); |
| 91 | | <a name="l00106"></a>00106 }; |
| 92 | | <a name="l00107"></a>00107 |
| 93 | | <a name="l00108"></a>00108 |
| 94 | | <a name="l00112"></a><a class="code" href="classIntAttribute.html">00112</a> <span class="keyword">class </span><a class="code" href="classIntAttribute.html" title="Class encapsulating all the necessary stuff to work with an int attribute.">IntAttribute</a> : <span class="keyword">public</span> <a class="code" href="classAttribute.html" title="User Info base class.">Attribute</a> |
| 95 | | <a name="l00113"></a>00113 { |
| 96 | | <a name="l00114"></a>00114 <span class="keyword">public</span>: |
| 97 | | <a name="l00115"></a>00115 <span class="keywordtype">int</span> value; |
| 98 | | <a name="l00116"></a>00116 <a class="code" href="classIntAttribute.html#5f958f133ecb1970de50345808d6120a" title="User Info base class.">IntAttribute</a>( <span class="keyword">const</span> <span class="keywordtype">string</span> name ); |
| 99 | | <a name="l00117"></a>00117 <span class="keywordtype">void</span> <a class="code" href="classIntAttribute.html#27d584df58c76251f45a15931ee6df3e" title="Set accessor to this attribute converting input string into a properly-typed value...">Set</a>( <span class="keyword">const</span> <span class="keywordtype">string</span> str ); |
| 100 | | <a name="l00118"></a>00118 <span class="keyword">const</span> <span class="keywordtype">string</span> <a class="code" href="classIntAttribute.html#a7bc8b5ec5291125e6eee9fd09fa54b7" title="Get accessor converting stored value into a string.">Get</a>(); |
| 101 | | <a name="l00119"></a>00119 }; |
| 102 | | <a name="l00120"></a>00120 |
| 103 | | <a name="l00124"></a><a class="code" href="classStringAttribute.html">00124</a> <span class="keyword">class </span><a class="code" href="classStringAttribute.html" title="Class encapsulating all the necessary stuff to work with a string attribute.">StringAttribute</a> : <span class="keyword">public</span> <a class="code" href="classAttribute.html" title="User Info base class.">Attribute</a> |
| 104 | | <a name="l00125"></a>00125 { |
| 105 | | <a name="l00126"></a>00126 <span class="keyword">public</span>: |
| 106 | | <a name="l00127"></a>00127 <span class="keywordtype">string</span> value; |
| 107 | | <a name="l00128"></a>00128 <a class="code" href="classStringAttribute.html#a507cdfd19fa54e8a6cf22ffb45e5c81" title="User Info base class.">StringAttribute</a>( <span class="keyword">const</span> <span class="keywordtype">string</span> name ); |
| 108 | | <a name="l00129"></a>00129 <span class="keywordtype">void</span> <a class="code" href="classStringAttribute.html#a02e791125f2f8e53e5d9beda8291408" title="Set accessor to this attribute converting input string into a properly-typed value...">Set</a>( <span class="keyword">const</span> <span class="keywordtype">string</span> str ); |
| 109 | | <a name="l00130"></a>00130 <span class="keyword">const</span> <span class="keywordtype">string</span> <a class="code" href="classStringAttribute.html#2e43e29b9da9b9c1eab65e11f4bf4518" title="Get accessor converting stored value into a string.">Get</a>(); |
| 110 | | <a name="l00131"></a>00131 }; |
| | 24 | <a name="l00008"></a>00008 <span class="preprocessor">#include <typeinfo></span> |
| | 25 | <a name="l00009"></a>00009 <span class="preprocessor">#include <map></span> |
| | 26 | <a name="l00010"></a>00010 <span class="preprocessor">#include <utility></span> |
| | 27 | <a name="l00011"></a>00011 <span class="preprocessor">#include <vector></span> |
| | 28 | <a name="l00012"></a>00012 <span class="preprocessor">#include <xercesc/dom/DOM.hpp></span> |
| | 29 | <a name="l00013"></a>00013 <span class="preprocessor">#include <xercesc/util/PlatformUtils.hpp></span> |
| | 30 | <a name="l00014"></a>00014 <span class="preprocessor">#include <xercesc/util/XMLString.hpp></span> |
| | 31 | <a name="l00015"></a>00015 <span class="preprocessor">#include <iostream></span> |
| | 32 | <a name="l00016"></a>00016 <span class="preprocessor">#include <xercesc/framework/LocalFileFormatTarget.hpp></span> |
| | 33 | <a name="l00017"></a>00017 <span class="preprocessor">#include <xercesc/framework/LocalFileInputSource.hpp></span> |
| | 34 | <a name="l00018"></a>00018 <span class="preprocessor">#include <xercesc/dom/DOMWriter.hpp></span> |
| | 35 | <a name="l00019"></a>00019 <span class="preprocessor">#include <xercesc/parsers/XercesDOMParser.hpp></span> |
| | 36 | <a name="l00020"></a>00020 |
| | 37 | <a name="l00021"></a>00021 <span class="preprocessor">#ifdef XERCES_CPP_NAMESPACE_USE</span> |
| | 38 | <a name="l00022"></a>00022 <span class="preprocessor"></span>XERCES_CPP_NAMESPACE_USE |
| | 39 | <a name="l00023"></a>00023 <span class="preprocessor">#endif</span> |
| | 40 | <a name="l00024"></a>00024 <span class="preprocessor"></span> |
| | 41 | <a name="l00025"></a>00025 <span class="keyword">using</span> std::string; |
| | 42 | <a name="l00026"></a>00026 <span class="keyword">using namespace </span>std; |
| | 43 | <a name="l00027"></a>00027 |
| | 44 | <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> |
| | 45 | <a name="l00041"></a>00041 { |
| | 46 | <a name="l00042"></a>00042 <span class="keyword">private</span>: |
| | 47 | <a name="l00044"></a>00044 <span class="keyword">class </span>XercesConnector |
| | 48 | <a name="l00045"></a>00045 { |
| | 49 | <a name="l00046"></a>00046 <span class="keyword">private</span>: |
| | 50 | <a name="l00049"></a>00049 XercesConnector() |
| | 51 | <a name="l00050"></a>00050 { |
| | 52 | <a name="l00051"></a>00051 <span class="comment">// initialize the XML library</span> |
| | 53 | <a name="l00052"></a>00052 XMLPlatformUtils::Initialize(); |
| | 54 | <a name="l00053"></a>00053 } |
| | 55 | <a name="l00054"></a>00054 |
| | 56 | <a name="l00055"></a>00055 ~XercesConnector() |
| | 57 | <a name="l00056"></a>00056 { |
| | 58 | <a name="l00057"></a>00057 <span class="comment">// terminate the XML library</span> |
| | 59 | <a name="l00058"></a>00058 XMLPlatformUtils::Terminate(); |
| | 60 | <a name="l00059"></a>00059 } |
| | 61 | <a name="l00060"></a>00060 |
| | 62 | <a name="l00061"></a>00061 <span class="keyword">public</span>: |
| | 63 | <a name="l00068"></a>00068 <span class="keyword">static</span> <span class="keywordtype">void</span> StayAlive() |
| | 64 | <a name="l00069"></a>00069 { |
| | 65 | <a name="l00070"></a>00070 <span class="keyword">static</span> XercesConnector xc; |
| | 66 | <a name="l00071"></a>00071 }; |
| | 67 | <a name="l00072"></a>00072 }; |
| | 68 | <a name="l00073"></a>00073 |
| | 69 | <a name="l00074"></a>00074 |
| | 70 | <a name="l00075"></a>00075 <span class="keyword">public</span>: |
| | 71 | <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>() |
| | 72 | <a name="l00078"></a>00078 { |
| | 73 | <a name="l00079"></a>00079 XercesConnector::StayAlive(); |
| | 74 | <a name="l00080"></a>00080 } |
| | 75 | <a name="l00081"></a>00081 }; |
| | 76 | <a name="l00082"></a>00082 |
| | 77 | <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> |
| | 78 | <a name="l00087"></a>00087 { |
| | 79 | <a name="l00088"></a>00088 <span class="keyword">private</span>: |
| | 80 | <a name="l00092"></a>00092 <a class="code" href="classAssertXercesIsAlive.html" title="Class initializing Xerces library.">AssertXercesIsAlive</a> dummy; |
| | 81 | <a name="l00093"></a>00093 |
| | 82 | <a name="l00094"></a>00094 <span class="keyword">protected</span>: |
| | 83 | <a name="l00096"></a>00096 <a class="code" href="classBindingFrame.html#65bec8fcde1865e2e211f42ca52a816f" title="default constructor">BindingFrame</a>(); |
| | 84 | <a name="l00097"></a>00097 |
| | 85 | <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 ); |
| | 86 | <a name="l00100"></a>00100 |
| | 87 | <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).">str</a>) |
| | 88 | <a name="l00102"></a>00102 { |
| | 89 | <a name="l00103"></a>00103 std::string temp; |
| | 90 | <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++) |
| | 91 | <a name="l00105"></a>00105 <span class="keywordflow">if</span> (str[i] == <span class="charliteral">' '</span>) temp += <span class="charliteral">'_'</span>; |
| | 92 | <a name="l00106"></a>00106 <span class="keywordflow">else</span> temp += str[i]; |
| | 93 | <a name="l00107"></a>00107 <span class="keywordflow">return</span> temp; |
| | 94 | <a name="l00108"></a>00108 } |
| | 95 | <a name="l00109"></a>00109 |
| | 96 | <a name="l00110"></a>00110 <span class="keyword">public</span>: |
| | 97 | <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; |
| | 98 | <a name="l00113"></a>00113 |
| | 99 | <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>() {} |
| | 100 | <a name="l00116"></a>00116 |
| | 101 | <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; |
| | 102 | <a name="l00120"></a>00120 }; |
| | 103 | <a name="l00121"></a>00121 |
| | 104 | <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> |
| | 105 | <a name="l00126"></a>00126 { |
| | 106 | <a name="l00127"></a>00127 <span class="keyword">private</span>: |
| | 107 | <a name="l00131"></a>00131 <a class="code" href="classAssertXercesIsAlive.html" title="Class initializing Xerces library.">AssertXercesIsAlive</a> dummy; |
| 117 | | <a name="l00146"></a>00146 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classUserInfoCore.html#282c9bfd140bd09777aff395158c35ab" title="Fills DOMElement according internal attributes and descendant elements.">FillElement</a>(DOMElement &element) = 0; |
| 118 | | <a name="l00147"></a>00147 }; |
| 119 | | <a name="l00148"></a>00148 |
| 120 | | <a name="l00154"></a><a class="code" href="classUserInfo.html">00154</a> <span class="keyword">template</span><<span class="keyword">typename</span> T> <span class="keyword">class </span><a class="code" href="classUserInfo.html" title="The main user info template class.">UserInfo</a> : <span class="keyword">public</span> <a class="code" href="classUserInfoCore.html" title="UserInfoCore class is for internal purposes only. Use UserInfo&lt;T&gt; instead.">UserInfoCore</a> |
| 121 | | <a name="l00155"></a>00155 { |
| 122 | | <a name="l00156"></a>00156 <span class="keyword">private</span>: |
| 123 | | <a name="l00159"></a>00159 XMLCh* transcodedName; |
| 124 | | <a name="l00160"></a>00160 |
| 125 | | <a name="l00162"></a>00162 <span class="keyword">typedef</span> map<const XMLCh* const, UserInfoCore* const, GlobalXercesConnector::Comparator> MappedElements; |
| 126 | | <a name="l00163"></a>00163 |
| 127 | | <a name="l00164"></a>00164 <span class="keyword">protected</span>: |
| 128 | | <a name="l00166"></a><a class="code" href="classUserInfo.html#20783b9cdbef32b584be96851a8f9862">00166</a> MappedElements <a class="code" href="classUserInfo.html#20783b9cdbef32b584be96851a8f9862" title="MappiLength of the output vector.">elements</a>; |
| 129 | | <a name="l00168"></a><a class="code" href="classUserInfo.html#aa6753c220a54aba613bfa3cc115d1c8">00168</a> <a class="code" href="classAttribute.html#342750acf29e4c37d009301ef5075111" title="Type definition of mapping which transforms names to the related attributes.">Attribute::MappedAttributes</a> <a class="code" href="classUserInfo.html#aa6753c220a54aba613bfa3cc115d1c8" title="Length of the output vector.">attributes</a>; |
| 130 | | <a name="l00169"></a>00169 |
| 131 | | <a name="l00170"></a>00170 <span class="keyword">public</span>: |
| 132 | | <a name="l00172"></a><a class="code" href="classUserInfo.html#b63907af7cfccefeab209f8381962092">00172</a> <a class="code" href="classStringAttribute.html" title="Class encapsulating all the necessary stuff to work with a string attribute.">StringAttribute</a> <a class="code" href="classUserInfo.html#b63907af7cfccefeab209f8381962092" title="Explanation for an user is the only obligatory attribute.">help</a>; |
| 133 | | <a name="l00173"></a>00173 |
| 134 | | <a name="l00175"></a>00175 <a class="code" href="classUserInfo.html" title="The main user info template class.">UserInfo<T></a>( |
| 135 | | <a name="l00176"></a>00176 <span class="keyword">const</span> <span class="keywordtype">string</span> name, |
| 136 | | <a name="l00177"></a>00177 <span class="keyword">const</span> <span class="keywordtype">string</span> help_msg = <span class="stringliteral">""</span> ) |
| 137 | | <a name="l00178"></a>00178 : <a class="code" href="classUserInfo.html#b63907af7cfccefeab209f8381962092" title="Explanation for an user is the only obligatory attribute.">help</a>(<span class="stringliteral">"help"</span>), |
| 138 | | <a name="l00179"></a>00179 transcodedName( XMLString::transcode( name.c_str() ) ) |
| 139 | | <a name="l00180"></a>00180 { |
| 140 | | <a name="l00181"></a>00181 XMLString::upperCase( transcodedName ); |
| 141 | | <a name="l00182"></a>00182 <a class="code" href="classUserInfo.html#b63907af7cfccefeab209f8381962092" title="Explanation for an user is the only obligatory attribute.">help</a>.<a class="code" href="classAttribute.html#abd94a0487d662f28264f4faa214d894" title="This method is the key method to connect the attribute to the related UI element...">Attach</a>( <a class="code" href="classUserInfo.html#aa6753c220a54aba613bfa3cc115d1c8" title="Length of the output vector.">attributes</a> ); |
| 142 | | <a name="l00183"></a>00183 <a class="code" href="classUserInfo.html#b63907af7cfccefeab209f8381962092" title="Explanation for an user is the only obligatory attribute.">help</a>.<a class="code" href="classStringAttribute.html#e55ae245a8ae9e16236695bd5121f744">value</a> = help_msg; |
| 143 | | <a name="l00184"></a><a class="code" href="classUserInfo.html#7583dc01223fcd3dfb2a97d80efe4565">00184</a> }; |
| 144 | | <a name="l00186"></a>00186 ~<a class="code" href="classUserInfo.html" title="The main user info template class.">UserInfo<T></a>() |
| 145 | | <a name="l00187"></a>00187 { |
| 146 | | <a name="l00188"></a>00188 XMLString::release( (XMLCh**)&transcodedName ); |
| 147 | | <a name="l00189"></a>00189 } |
| 148 | | <a name="l00190"></a>00190 |
| 149 | | <a name="l00192"></a>00192 <span class="keyword">virtual</span> T* <a class="code" href="classUserInfo.html#a7cab74e8214a87e5f226e9e88ff3d61" title="returns object of templated type filled with data stored in this UserInfo instance...">build</a>(<span class="keywordtype">void</span>) = 0; |
| 150 | | <a name="l00193"></a>00193 |
| 151 | | <a name="l00195"></a><a class="code" href="classUserInfo.html#089b8a3ad514b17ae564a27328655126">00195</a> <span class="keywordtype">void</span> <a class="code" href="classUserInfo.html#089b8a3ad514b17ae564a27328655126" title="Save UserInfo to the file (typically with an XML extension).">Save</a> ( <span class="keywordtype">char</span>* fileName ) |
| 152 | | <a name="l00196"></a>00196 { |
| 153 | | <a name="l00197"></a>00197 XMLCh* transcodedFileName = XMLString::transcode( fileName ); |
| 154 | | <a name="l00198"></a>00198 LocalFileFormatTarget outputTarget( transcodedFileName ); |
| 155 | | <a name="l00199"></a>00199 XMLString::release( &transcodedFileName ); |
| 156 | | <a name="l00200"></a>00200 |
| 157 | | <a name="l00201"></a>00201 DOMDocument* pDoc = XMLConnector.<a class="code" href="classGlobalXercesConnector.html#8d2d2a3f1b2a21a9647f7bc4c7e82c73" title="DOMImplementation is a base class for the all DOM oparations.">pImplementation</a>->createDocument( |
| 158 | | <a name="l00202"></a>00202 XMLString::transcode( <span class="stringliteral">"M3K USER INFO"</span> ), |
| 159 | | <a name="l00203"></a>00203 XMLString::transcode( <span class="stringliteral">"ROOT"</span> ), NULL ); |
| 160 | | <a name="l00204"></a>00204 DOMElement *pRoot = pDoc->getDocumentElement(); |
| | 118 | <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).">str</a> ) <span class="keyword">const</span>; |
| | 119 | <a name="l00147"></a>00147 |
| | 120 | <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>; |
| | 121 | <a name="l00150"></a>00150 |
| | 122 | <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>; |
| | 123 | <a name="l00153"></a>00153 |
| | 124 | <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>; |
| | 125 | <a name="l00156"></a>00156 }; |
| | 126 | <a name="l00157"></a>00157 |
| | 127 | <a name="l00158"></a>00158 |
| | 128 | <a name="l00159"></a>00159 |
| | 129 | <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> |
| | 130 | <a name="l00168"></a>00168 { |
| | 131 | <a name="l00169"></a>00169 <span class="keyword">private</span>: |
| | 132 | <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; |
| | 133 | <a name="l00172"></a>00172 |
| | 134 | <a name="l00177"></a>00177 <span class="keyword">class </span>StringToUIMap |
| | 135 | <a name="l00178"></a>00178 { |
| | 136 | <a name="l00179"></a>00179 <span class="keyword">private</span>: |
| | 137 | <a name="l00181"></a>00181 <span class="keyword">typedef</span> map< const string, pUserInfo > MappedString2UI; |
| | 138 | <a name="l00182"></a>00182 |
| | 139 | <a name="l00184"></a>00184 <span class="keyword">static</span> MappedString2UI& privateMap(); |
| | 140 | <a name="l00185"></a>00185 |
| | 141 | <a name="l00186"></a>00186 <span class="keyword">public</span>: |
| | 142 | <a name="l00188"></a>00188 <span class="keyword">static</span> <span class="keywordtype">void</span> Add( <span class="keywordtype">string</span> key, pUserInfo pInstance ); |
| | 143 | <a name="l00189"></a>00189 |
| | 144 | <a name="l00191"></a>00191 <span class="keyword">static</span> pUserInfo Retrieve( <span class="keywordtype">string</span> key ); |
| | 145 | <a name="l00192"></a>00192 }; |
| | 146 | <a name="l00193"></a>00193 |
| | 147 | <a name="l00195"></a>00195 <span class="keyword">virtual</span> <span class="keywordtype">void</span>* AssemblyTypelessInstance() = 0; |
| | 148 | <a name="l00196"></a>00196 |
| | 149 | <a name="l00198"></a>00198 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> DisassemblyTypelessInstance(<span class="keywordtype">void</span>* pInstance) = 0; |
| | 150 | <a name="l00199"></a>00199 |
| | 151 | <a name="l00201"></a>00201 <span class="keyword">const</span> <span class="keywordtype">string</span> userFriendlyTypeName; |
| | 152 | <a name="l00202"></a>00202 |
| | 153 | <a name="l00204"></a>00204 <span class="keyword">const</span> <span class="keywordtype">string</span> typeNameByRTTI; |
| 164 | | <a name="l00208"></a>00208 XMLConnector.<a class="code" href="classGlobalXercesConnector.html#c6c620829e2a2fface1bea202b0608a6" title="This DOMWriter is used to export internal data into xml files.">pSerializer</a>->writeNode( &outputTarget, *pDoc); |
| 165 | | <a name="l00209"></a>00209 <span class="keyword">delete</span> pDoc; |
| 166 | | <a name="l00210"></a>00210 } |
| 167 | | <a name="l00212"></a><a class="code" href="classUserInfo.html#920c54d79132041a520180d083a6c503">00212</a> <span class="keywordtype">void</span> <a class="code" href="classUserInfo.html#920c54d79132041a520180d083a6c503" title="Load UserInfo from the file (typically with an XML extension).">Load</a> ( <span class="keywordtype">char</span>* fileName ) |
| 168 | | <a name="l00213"></a>00213 { |
| 169 | | <a name="l00214"></a>00214 <span class="keywordtype">bool</span> bFailed = <span class="keyword">false</span>; |
| 170 | | <a name="l00215"></a>00215 |
| 171 | | <a name="l00216"></a>00216 <span class="keywordflow">try</span> |
| 172 | | <a name="l00217"></a>00217 { |
| 173 | | <a name="l00218"></a>00218 XMLCh* transcodedFileName = XMLString::transcode( fileName ) ; |
| 174 | | <a name="l00219"></a>00219 <span class="keyword">const</span> LocalFileInputSource inputSource( transcodedFileName ); |
| 175 | | <a name="l00220"></a>00220 XMLString::release( &transcodedFileName ); |
| 176 | | <a name="l00221"></a>00221 |
| 177 | | <a name="l00222"></a>00222 XMLConnector.<a class="code" href="classGlobalXercesConnector.html#ca92055e0f5a5ea3d8cb1c4d6bf0dd51" title="This DOMWriter is used to import external data from xml files.">pParser</a>->parse( inputSource ); |
| 178 | | <a name="l00223"></a>00223 bFailed = ( XMLConnector.<a class="code" href="classGlobalXercesConnector.html#ca92055e0f5a5ea3d8cb1c4d6bf0dd51" title="This DOMWriter is used to import external data from xml files.">pParser</a>->getErrorCount() != 0 ); |
| 179 | | <a name="l00224"></a>00224 } |
| 180 | | <a name="l00225"></a>00225 <span class="keywordflow">catch</span> (...) |
| 181 | | <a name="l00226"></a>00226 { |
| 182 | | <a name="l00227"></a>00227 bFailed = <span class="keyword">true</span>; |
| 183 | | <a name="l00228"></a>00228 } |
| 184 | | <a name="l00229"></a>00229 |
| 185 | | <a name="l00230"></a>00230 <span class="keywordflow">if</span>( !bFailed) |
| 186 | | <a name="l00231"></a>00231 { |
| 187 | | <a name="l00232"></a>00232 DOMDocument *pDoc = XMLConnector.<a class="code" href="classGlobalXercesConnector.html#ca92055e0f5a5ea3d8cb1c4d6bf0dd51" title="This DOMWriter is used to import external data from xml files.">pParser</a>->getDocument(); |
| 188 | | <a name="l00233"></a>00233 DOMElement *pRoot = pDoc->getDocumentElement(); |
| 189 | | <a name="l00234"></a>00234 bFailed = <span class="keyword">true</span>; |
| 190 | | <a name="l00235"></a>00235 <span class="keywordflow">for</span>( DOMNode* node = pRoot->getFirstChild(); node != NULL; node = node->getNextSibling() ) |
| 191 | | <a name="l00236"></a>00236 <span class="keywordflow">if</span>( node->getNodeType() == DOMNode::ELEMENT_NODE ) |
| 192 | | <a name="l00237"></a>00237 { |
| 193 | | <a name="l00238"></a>00238 <a class="code" href="classUserInfo.html#f673ea7ee23cc87e89d1530f94817800" title="Fills internal attributes and descendant elements according DOMElement.">ParseElement</a>( (DOMElement*) node ); |
| 194 | | <a name="l00239"></a>00239 bFailed = <span class="keyword">false</span>; |
| 195 | | <a name="l00240"></a>00240 <span class="keywordflow">break</span>; |
| 196 | | <a name="l00241"></a>00241 } |
| 197 | | <a name="l00242"></a>00242 } |
| 198 | | <a name="l00243"></a>00243 |
| 199 | | <a name="l00244"></a>00244 <span class="keywordflow">if</span>( bFailed ) |
| 200 | | <a name="l00245"></a>00245 { |
| 201 | | <a name="l00246"></a>00246 <span class="comment">// exception?!</span> |
| 202 | | <a name="l00247"></a>00247 } |
| 203 | | <a name="l00248"></a>00248 } |
| 204 | | <a name="l00250"></a><a class="code" href="classUserInfo.html#51c1823208b719eec546b98bb855e272">00250</a> <span class="keywordtype">void</span> <a class="code" href="classUserInfo.html#51c1823208b719eec546b98bb855e272" title="This method is the key method to connect the element to its parent UI element.">Attach</a>( MappedElements &externalElements) |
| 205 | | <a name="l00251"></a>00251 { |
| 206 | | <a name="l00252"></a>00252 pair<const XMLCh* const, UserInfoCore* const> newPair( transcodedName, <span class="keyword">this</span> ); |
| 207 | | <a name="l00253"></a>00253 externalElements.insert(newPair); |
| 208 | | <a name="l00254"></a>00254 } |
| 209 | | <a name="l00255"></a>00255 |
| 210 | | <a name="l00256"></a><a class="code" href="classUserInfo.html#f673ea7ee23cc87e89d1530f94817800">00256</a> <span class="keywordtype">void</span> <a class="code" href="classUserInfo.html#f673ea7ee23cc87e89d1530f94817800" title="Fills internal attributes and descendant elements according DOMElement.">ParseElement</a>(DOMElement *element) |
| 211 | | <a name="l00257"></a>00257 { |
| 212 | | <a name="l00258"></a>00258 DOMNodeList* nodeList = element->getChildNodes(); |
| 213 | | <a name="l00259"></a>00259 <span class="keywordflow">if</span>( nodeList ) |
| 214 | | <a name="l00260"></a>00260 <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i = 0; i < nodeList->getLength(); i++ ) |
| 215 | | <a name="l00261"></a>00261 { |
| 216 | | <a name="l00262"></a>00262 DOMNode* node = nodeList->item(i); |
| 217 | | <a name="l00263"></a>00263 <span class="keywordflow">if</span>( node->getNodeType() == DOMNode::ELEMENT_NODE ) |
| 218 | | <a name="l00264"></a>00264 { |
| 219 | | <a name="l00265"></a>00265 DOMElement* childElement = (DOMElement*) node; |
| 220 | | <a name="l00266"></a>00266 MappedElements::const_iterator iter = <a class="code" href="classUserInfo.html#20783b9cdbef32b584be96851a8f9862" title="MappiLength of the output vector.">elements</a>.find( childElement->getTagName() ); |
| | 157 | <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 ) |
| | 158 | <a name="l00210"></a>00210 : userFriendlyTypeName ( removeSpaces( userFriendlyTypeName ) ), |
| | 159 | <a name="l00211"></a>00211 typeNameByRTTI( typeNameByRTTI ) |
| | 160 | <a name="l00212"></a>00212 { |
| | 161 | <a name="l00213"></a>00213 StringToUIMap::Add( userFriendlyTypeName, <span class="keyword">this</span> ); |
| | 162 | <a name="l00214"></a>00214 |
| | 163 | <a name="l00215"></a>00215 <span class="keywordflow">if</span>( userFriendlyTypeName != typeNameByRTTI ) |
| | 164 | <a name="l00216"></a>00216 <span class="comment">// we have a common map for both groups of names, </span> |
| | 165 | <a name="l00217"></a>00217 <span class="comment">// therefore, it is no use to add the same pair again</span> |
| | 166 | <a name="l00218"></a>00218 StringToUIMap::Add( typeNameByRTTI, <span class="keyword">this</span> ); |
| | 167 | <a name="l00219"></a>00219 } |
| | 168 | <a name="l00220"></a>00220 |
| | 169 | <a name="l00221"></a>00221 <span class="keyword">public</span>: |
| | 170 | <a name="l00225"></a>00225 <span class="keyword">template</span><<span class="keyword">class</span> T> |
| | 171 | <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 ) |
| | 172 | <a name="l00227"></a>00227 { |
| | 173 | <a name="l00228"></a>00228 XMLCh* transcodedTagName = XMLString::transcode( tagName.c_str() ); |
| | 174 | <a name="l00229"></a>00229 XMLString::upperCase( transcodedTagName ); |
| | 175 | <a name="l00230"></a>00230 |
| | 176 | <a name="l00231"></a>00231 DOMNodeList* <span class="keyword">const</span> nodeList = element.getElementsByTagName( transcodedTagName ); |
| | 177 | <a name="l00232"></a>00232 XMLString::release( (XMLCh**)&transcodedTagName ); |
| | 178 | <a name="l00233"></a>00233 <span class="keywordflow">if</span>( !nodeList || nodeList->getLength() == 0 ) |
| | 179 | <a name="l00234"></a>00234 { |
| | 180 | <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>; |
| | 181 | <a name="l00236"></a>00236 <span class="keywordflow">return</span> NULL; |
| | 182 | <a name="l00237"></a>00237 } |
| | 183 | <a name="l00238"></a>00238 |
| | 184 | <a name="l00239"></a>00239 <span class="keywordflow">if</span>( nodeList->getLength() > 1 ) |
| | 185 | <a name="l00240"></a>00240 { |
| | 186 | <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>; |
| | 187 | <a name="l00242"></a>00242 <span class="keywordflow">return</span> NULL; |
| | 188 | <a name="l00243"></a>00243 } |
| | 189 | <a name="l00244"></a>00244 |
| | 190 | <a name="l00245"></a>00245 <span class="comment">// this time we hold an element with the same name as the tagName is</span> |
| | 191 | <a name="l00246"></a>00246 DOMElement* pTheOnlyElement = (DOMElement*) nodeList->item(0); |
| | 192 | <a name="l00247"></a>00247 |
| | 193 | <a name="l00248"></a>00248 <span class="comment">// we get a velue stored in the "type" attribute </span> |
| | 194 | <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 ); |
| | 195 | <a name="l00250"></a>00250 |
| | 196 | <a name="l00251"></a>00251 <span class="comment">// and finally we find a UserInfo related to this type</span> |
| | 197 | <a name="l00252"></a>00252 pUserInfo pRelatedUI = StringToUIMap::Retrieve( userFriendlyTypeName ); |
| | 198 | <a name="l00253"></a>00253 <span class="keywordflow">if</span>( !pRelatedUI ) |
| | 199 | <a name="l00254"></a>00254 { |
| | 200 | <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>; |
| | 201 | <a name="l00256"></a>00256 <span class="keywordflow">return</span> NULL; |
| | 202 | <a name="l00257"></a>00257 } |
| | 203 | <a name="l00258"></a>00258 |
| | 204 | <a name="l00259"></a>00259 <span class="comment">// prepare all components necessary for an instance assembling</span> |
| | 205 | <a name="l00260"></a>00260 pRelatedUI->AssemblyComponentsFromXML( *pTheOnlyElement ); |
| | 206 | <a name="l00261"></a>00261 |
| | 207 | <a name="l00262"></a>00262 <span class="comment">// instance assembling </span> |
| | 208 | <a name="l00263"></a>00263 <span class="keywordtype">void</span>* pTypelessInstance = pRelatedUI->AssemblyTypelessInstance(); |
| | 209 | <a name="l00264"></a>00264 |
| | 210 | <a name="l00265"></a>00265 <span class="comment">// cleaning up</span> |
| | 211 | <a name="l00266"></a>00266 pRelatedUI->ReleaseMemory(); |
| 222 | | <a name="l00268"></a>00268 <span class="keywordflow">if</span>( iter != <a class="code" href="classUserInfo.html#20783b9cdbef32b584be96851a8f9862" title="MappiLength of the output vector.">elements</a>.end()) |
| 223 | | <a name="l00269"></a>00269 iter->second->ParseElement( childElement ); |
| 224 | | <a name="l00270"></a>00270 } |
| 225 | | <a name="l00271"></a>00271 } |
| 226 | | <a name="l00272"></a>00272 |
| 227 | | <a name="l00273"></a>00273 DOMNamedNodeMap* nodeMap = element->getAttributes(); |
| 228 | | <a name="l00274"></a>00274 <span class="keywordflow">if</span>( nodeMap ) |
| 229 | | <a name="l00275"></a>00275 <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i = 0; i < nodeMap->getLength(); i++ ) |
| 230 | | <a name="l00276"></a>00276 { |
| 231 | | <a name="l00277"></a>00277 DOMNode* node = nodeMap->item(i); |
| 232 | | <a name="l00278"></a>00278 <span class="keywordflow">if</span>( node->getNodeType() == DOMNode::ATTRIBUTE_NODE ) |
| 233 | | <a name="l00279"></a>00279 { |
| 234 | | <a name="l00280"></a>00280 DOMAttr* attribute = (DOMAttr*) node; |
| 235 | | <a name="l00281"></a>00281 Attribute::MappedAttributes::const_iterator iter = <a class="code" href="classUserInfo.html#aa6753c220a54aba613bfa3cc115d1c8" title="Length of the output vector.">attributes</a>.find( attribute->getName() ); |
| 236 | | <a name="l00282"></a>00282 |
| 237 | | <a name="l00283"></a>00283 <span class="keywordflow">if</span>( iter != <a class="code" href="classUserInfo.html#aa6753c220a54aba613bfa3cc115d1c8" title="Length of the output vector.">attributes</a>.end()) |
| 238 | | <a name="l00284"></a>00284 { |
| 239 | | <a name="l00285"></a>00285 <span class="keywordtype">string</span> attributeValue = <a class="code" href="classGlobalXercesConnector.html#9800b81014bc6497815e28ad4bd3cf3a" title="function transcodes Xerces&#39; XMLCh-based strings into C++ strings">GlobalXercesConnector::XMLCh2str</a>( attribute->getValue() ); |
| 240 | | <a name="l00286"></a>00286 iter->second->Set( attributeValue ); |
| 241 | | <a name="l00287"></a>00287 } |
| 242 | | <a name="l00288"></a>00288 } |
| 243 | | <a name="l00289"></a>00289 } |
| 244 | | <a name="l00290"></a>00290 } |
| 245 | | <a name="l00291"></a>00291 |
| 246 | | <a name="l00292"></a><a class="code" href="classUserInfo.html#22ca1ef5a10740e4107cd5a7e9a72856">00292</a> <span class="keywordtype">void</span> <a class="code" href="classUserInfo.html#22ca1ef5a10740e4107cd5a7e9a72856" title="Fills DOMElement according internal attributes and descendant elements.">FillElement</a>(DOMElement &element) |
| 247 | | <a name="l00293"></a>00293 { |
| 248 | | <a name="l00294"></a>00294 DOMDocument* pDoc = element.getOwnerDocument(); |
| 249 | | <a name="l00295"></a>00295 |
| 250 | | <a name="l00296"></a>00296 DOMElement* pHead = pDoc->createElement( transcodedName ); |
| 251 | | <a name="l00297"></a>00297 element.appendChild( pHead ); |
| 252 | | <a name="l00298"></a>00298 |
| 253 | | <a name="l00299"></a>00299 <span class="keywordflow">for</span>( MappedElements::const_iterator iter = <a class="code" href="classUserInfo.html#20783b9cdbef32b584be96851a8f9862" title="MappiLength of the output vector.">elements</a>.begin(); iter != <a class="code" href="classUserInfo.html#20783b9cdbef32b584be96851a8f9862" title="MappiLength of the output vector.">elements</a>.end(); iter++) |
| 254 | | <a name="l00300"></a>00300 iter->second->FillElement( *pHead ); |
| 255 | | <a name="l00301"></a>00301 |
| 256 | | <a name="l00302"></a>00302 <span class="keywordflow">for</span>( Attribute::MappedAttributes::iterator iter = <a class="code" href="classUserInfo.html#aa6753c220a54aba613bfa3cc115d1c8" title="Length of the output vector.">attributes</a>.begin(); iter != <a class="code" href="classUserInfo.html#aa6753c220a54aba613bfa3cc115d1c8" title="Length of the output vector.">attributes</a>.end(); iter++) |
| 257 | | <a name="l00303"></a>00303 iter->second->FillAttribute( *pHead ); |
| 258 | | <a name="l00304"></a>00304 } |
| 259 | | <a name="l00305"></a>00305 }; |
| 260 | | <a name="l00306"></a>00306 |
| 261 | | <a name="l00307"></a>00307 <span class="preprocessor">#endif // #ifndef UI_H</span> |
| | 213 | <a name="l00268"></a>00268 <span class="keywordflow">if</span>( pTypelessInstance == NULL ) |
| | 214 | <a name="l00269"></a>00269 { |
| | 215 | <a name="l00270"></a>00270 cerr << <span class="stringliteral">"Warning: there was some error when parsing a XML document, instance assembling terminated!"</span>; |
| | 216 | <a name="l00271"></a>00271 <span class="keywordflow">return</span> NULL; |
| | 217 | <a name="l00272"></a>00272 } |
| | 218 | <a name="l00273"></a>00273 |
| | 219 | <a name="l00274"></a>00274 T* pInstance = NULL; |
| | 220 | <a name="l00275"></a>00275 <span class="keywordflow">try</span> |
| | 221 | <a name="l00276"></a>00276 { |
| | 222 | <a name="l00277"></a>00277 <span class="comment">// a "do it yourself" type check:)</span> |
| | 223 | <a name="l00278"></a>00278 pInstance = (T*) pTypelessInstance; |
| | 224 | <a name="l00279"></a>00279 <span class="keywordtype">string</span> resultingTypeNameByRTTI = <span class="keyword">typeid</span>( *pInstance ).name(); |
| | 225 | <a name="l00280"></a>00280 <span class="keywordflow">if</span>( resultingTypeNameByRTTI != pRelatedUI->typeNameByRTTI ) |
| | 226 | <a name="l00281"></a>00281 pInstance = NULL; |
| | 227 | <a name="l00282"></a>00282 } |
| | 228 | <a name="l00283"></a>00283 <span class="keywordflow">catch</span>(...) |
| | 229 | <a name="l00284"></a>00284 { |
| | 230 | <a name="l00285"></a>00285 pInstance = NULL; |
| | 231 | <a name="l00286"></a>00286 } |
| | 232 | <a name="l00287"></a>00287 <span class="keywordflow">if</span>( pInstance == NULL ) |
| | 233 | <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>; |
| | 234 | <a name="l00289"></a>00289 |
| | 235 | <a name="l00290"></a>00290 <span class="keywordflow">return</span> pInstance; |
| | 236 | <a name="l00291"></a>00291 } |
| | 237 | <a name="l00292"></a>00292 |
| | 238 | <a name="l00296"></a>00296 <span class="keyword">template</span><<span class="keyword">class</span> T> |
| | 239 | <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) |
| | 240 | <a name="l00298"></a>00298 { |
| | 241 | <a name="l00299"></a>00299 pUserInfo pRelatedUI = StringToUIMap::Retrieve( <span class="keyword">typeid</span>(instance).name() ); |
| | 242 | <a name="l00300"></a>00300 <span class="keywordflow">if</span>( !pRelatedUI ) |
| | 243 | <a name="l00301"></a>00301 <span class="keywordflow">return</span> <span class="keyword">false</span>; |
| | 244 | <a name="l00302"></a>00302 |
| | 245 | <a name="l00303"></a>00303 <span class="comment">// add a new element named according the passed tagName</span> |
| | 246 | <a name="l00304"></a>00304 XMLCh* transcodedTagName = XMLString::transcode( tagName.c_str() ); |
| | 247 | <a name="l00305"></a>00305 XMLString::upperCase( transcodedTagName ); |
| | 248 | <a name="l00306"></a>00306 DOMDocument* pDoc = element.getOwnerDocument(); |
| | 249 | <a name="l00307"></a>00307 DOMElement* pCreatedElement = pDoc->createElement( transcodedTagName ); |
| | 250 | <a name="l00308"></a>00308 element.appendChild( pCreatedElement ); |
| | 251 | <a name="l00309"></a>00309 XMLString::release( (XMLCh**)&transcodedTagName ); |
| | 252 | <a name="l00310"></a>00310 |
| | 253 | <a name="l00311"></a>00311 <span class="comment">// add attributes "type" and "help"</span> |
| | 254 | <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 ); |
| | 255 | <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 ); |
| | 256 | <a name="l00314"></a>00314 |
| | 257 | <a name="l00315"></a>00315 <span class="comment">// disassembly instance itself into its components</span> |
| | 258 | <a name="l00316"></a>00316 <span class="keywordtype">bool</span> result = pRelatedUI->DisassemblyTypelessInstance( (<span class="keywordtype">void</span>*) &instance ); |
| | 259 | <a name="l00317"></a>00317 <span class="keywordflow">if</span>( result ) |
| | 260 | <a name="l00318"></a>00318 <span class="comment">// disassembly all components of an instance </span> |
| | 261 | <a name="l00319"></a>00319 result = pRelatedUI->DisassemblyComponentsToXML( *pCreatedElement ); |
| | 262 | <a name="l00320"></a>00320 <span class="keywordflow">return</span> result; |
| | 263 | <a name="l00321"></a>00321 } |
| | 264 | <a name="l00322"></a>00322 |
| | 265 | <a name="l00326"></a>00326 <span class="keyword">template</span><<span class="keyword">class</span> T> |
| | 266 | <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 ) |
| | 267 | <a name="l00328"></a>00328 { |
| | 268 | <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> ); |
| | 269 | <a name="l00330"></a>00330 } |
| | 270 | <a name="l00331"></a>00331 }; |
| | 271 | <a name="l00332"></a>00332 |
| | 272 | <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> |
| | 273 | <a name="l00345"></a>00345 { |
| | 274 | <a name="l00346"></a>00346 <span class="keyword">private</span>: |
| | 275 | <a name="l00347"></a>00347 |
| | 276 | <a name="l00348"></a>00348 <span class="keywordtype">bool</span> DisassemblyTypelessInstance(<span class="keywordtype">void</span>* pInstance) |
| | 277 | <a name="l00349"></a>00349 { |
| | 278 | <a name="l00350"></a>00350 <span class="keywordflow">try</span> |
| | 279 | <a name="l00351"></a>00351 { |
| | 280 | <a name="l00352"></a>00352 <span class="keywordflow">return</span> DisassemblyInstance( *(T*) pInstance ); |
| | 281 | <a name="l00353"></a>00353 } |
| | 282 | <a name="l00354"></a>00354 <span class="keywordflow">catch</span> (...) |
| | 283 | <a name="l00355"></a>00355 { |
| | 284 | <a name="l00356"></a>00356 <span class="keywordflow">return</span> <span class="keyword">false</span>; |
| | 285 | <a name="l00357"></a>00357 } |
| | 286 | <a name="l00358"></a>00358 } |
| | 287 | <a name="l00359"></a>00359 |
| | 288 | <a name="l00360"></a>00360 <span class="keywordtype">void</span>* AssemblyTypelessInstance() |
| | 289 | <a name="l00361"></a>00361 { |
| | 290 | <a name="l00362"></a>00362 <span class="keywordflow">return</span> (<span class="keywordtype">void</span>*) AssemblyInstance( ); |
| | 291 | <a name="l00363"></a>00363 } |
| | 292 | <a name="l00364"></a>00364 |
| | 293 | <a name="l00366"></a>00366 <span class="keyword">virtual</span> T* AssemblyInstance() = 0; |
| | 294 | <a name="l00367"></a>00367 |
| | 295 | <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; |
| | 296 | <a name="l00370"></a>00370 |
| | 297 | <a name="l00371"></a>00371 <span class="keyword">protected</span>: |
| | 298 | <a name="l00372"></a>00372 |
| | 299 | <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) |
| | 300 | <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() ) |
| | 301 | <a name="l00376"></a>00376 { |
| | 302 | <a name="l00377"></a>00377 |
| | 303 | <a name="l00378"></a><a class="code" href="classTypedUserInfo.html#b1bb67b76a677f0cf33e923fd9147e9a">00378</a> }; |
| | 304 | <a name="l00379"></a>00379 |
| | 305 | <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>() |
| | 306 | <a name="l00382"></a>00382 { |
| | 307 | <a name="l00383"></a>00383 } |
| | 308 | <a name="l00384"></a>00384 |
| | 309 | <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; |
| | 310 | <a name="l00388"></a>00388 }; |
| | 311 | <a name="l00389"></a>00389 |
| | 312 | <a name="l00390"></a>00390 |
| | 313 | <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> |
| | 314 | <a name="l00421"></a>00421 { |
| | 315 | <a name="l00422"></a>00422 <span class="keyword">private</span>: |
| | 316 | <a name="l00424"></a>00424 vector<BindingFrame*> bindedElements; |
| | 317 | <a name="l00425"></a>00425 |
| | 318 | <a name="l00426"></a>00426 <span class="keyword">protected</span>: |
| | 319 | <a name="l00427"></a>00427 |
| | 320 | <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> |
| | 321 | <a name="l00433"></a>00433 { |
| | 322 | <a name="l00434"></a>00434 <span class="keyword">private</span>: |
| | 323 | <a name="l00435"></a>00435 <span class="keywordtype">string</span> name; |
| | 324 | <a name="l00436"></a>00436 <span class="keywordtype">string</span> help; |
| | 325 | <a name="l00437"></a>00437 <span class="keywordtype">bool</span> release; |
| | 326 | <a name="l00438"></a>00438 |
| | 327 | <a name="l00439"></a>00439 U* pValue; |
| | 328 | <a name="l00440"></a>00440 |
| | 329 | <a name="l00441"></a>00441 <span class="keyword">const</span> U defaultValue; |
| | 330 | <a name="l00442"></a>00442 |
| | 331 | <a name="l00443"></a>00443 |
| | 332 | <a name="l00444"></a>00444 <span class="keyword">public</span>: |
| | 333 | <a name="l00445"></a>00445 U value; |
| | 334 | <a name="l00446"></a>00446 |
| | 335 | <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 ) |
| | 336 | <a name="l00448"></a>00448 : name( removeSpaces( name )), help(help), defaultValue( defaultValue ) |
| | 337 | <a name="l00449"></a>00449 { |
| | 338 | <a name="l00450"></a>00450 parent->bindedElements.push_back( <span class="keyword">this</span> ); |
| | 339 | <a name="l00451"></a>00451 pValue = NULL; |
| | 340 | <a name="l00452"></a>00452 value = defaultValue; |
| | 341 | <a name="l00453"></a>00453 } |
| | 342 | <a name="l00454"></a>00454 |
| | 343 | <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 ) |
| | 344 | <a name="l00456"></a>00456 : name( removeSpaces( name )), help(<span class="stringliteral">""</span>), defaultValue( defaultValue ), value( defaultValue) |
| | 345 | <a name="l00457"></a>00457 { |
| | 346 | <a name="l00458"></a>00458 parent->bindedElements.push_back( <span class="keyword">this</span> ); |
| | 347 | <a name="l00459"></a>00459 pValue = NULL; |
| | 348 | <a name="l00460"></a>00460 value = defaultValue; |
| | 349 | <a name="l00461"></a>00461 } |
| | 350 | <a name="l00462"></a>00462 |
| | 351 | <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>() |
| | 352 | <a name="l00464"></a>00464 { |
| | 353 | <a name="l00465"></a>00465 } |
| | 354 | <a name="l00466"></a>00466 |
| | 355 | <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 ) |
| | 356 | <a name="l00468"></a>00468 { |
| | 357 | <a name="l00469"></a>00469 pValue = UserInfo::Assembly<U>( element, name ); |
| | 358 | <a name="l00470"></a>00470 <span class="keywordflow">if</span>( pValue ) value = *pValue; |
| | 359 | <a name="l00471"></a>00471 } |
| | 360 | <a name="l00472"></a>00472 |
| | 361 | <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>() |
| | 362 | <a name="l00474"></a>00474 { |
| | 363 | <a name="l00475"></a>00475 <span class="keywordflow">if</span>( pValue != NULL ) |
| | 364 | <a name="l00476"></a>00476 <span class="keyword">delete</span> pValue; |
| | 365 | <a name="l00477"></a>00477 } |
| | 366 | <a name="l00478"></a>00478 |
| | 367 | <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 ) |
| | 368 | <a name="l00480"></a>00480 { |
| | 369 | <a name="l00481"></a>00481 <span class="keywordflow">return</span> <a class="code" href="classUserInfo.html#1d402661b82feccb5265a70f65c242e1">UserInfo::Disassembly</a>( value, element, name, help ); |
| | 370 | <a name="l00482"></a>00482 } |
| | 371 | <a name="l00483"></a>00483 }; |
| | 372 | <a name="l00484"></a>00484 |
| | 373 | <a name="l00485"></a>00485 <span class="keyword">private</span>: |
| | 374 | <a name="l00486"></a>00486 |
| | 375 | <a name="l00487"></a>00487 <span class="keywordtype">void</span> AssemblyComponentsFromXML( DOMElement &element ) |
| | 376 | <a name="l00488"></a>00488 { |
| | 377 | <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++ ) |
| | 378 | <a name="l00490"></a>00490 bindedElements[ind]->AssemblyComponentsFromXML( element ); |
| | 379 | <a name="l00491"></a>00491 } |
| | 380 | <a name="l00492"></a>00492 |
| | 381 | <a name="l00493"></a>00493 <span class="keywordtype">void</span> ReleaseMemory() |
| | 382 | <a name="l00494"></a>00494 { |
| | 383 | <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++ ) |
| | 384 | <a name="l00496"></a>00496 bindedElements[ind]->ReleaseMemory(); |
| | 385 | <a name="l00497"></a>00497 } |
| | 386 | <a name="l00498"></a>00498 |
| | 387 | <a name="l00499"></a>00499 <span class="keywordtype">bool</span> DisassemblyComponentsToXML( DOMElement &element ) |
| | 388 | <a name="l00500"></a>00500 { |
| | 389 | <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++ ) |
| | 390 | <a name="l00502"></a>00502 <span class="keywordflow">if</span>( !bindedElements[ind]->DisassemblyComponentsToXML( element ) ) |
| | 391 | <a name="l00503"></a>00503 <span class="keywordflow">return</span> <span class="keyword">false</span>; |
| | 392 | <a name="l00504"></a>00504 <span class="keywordflow">return</span> <span class="keyword">true</span>; |
| | 393 | <a name="l00505"></a>00505 } |
| | 394 | <a name="l00506"></a>00506 |
| | 395 | <a name="l00507"></a>00507 <span class="keyword">protected</span>: |
| | 396 | <a name="l00508"></a>00508 |
| | 397 | <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 ) |
| | 398 | <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 ) |
| | 399 | <a name="l00511"></a>00511 { |
| | 400 | <a name="l00512"></a>00512 } |
| | 401 | <a name="l00513"></a>00513 |
| | 402 | <a name="l00514"></a>00514 }; |
| | 403 | <a name="l00515"></a>00515 |
| | 404 | <a name="l00516"></a>00516 |
| | 405 | <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> |
| | 406 | <a name="l00528"></a>00528 { |
| | 407 | <a name="l00529"></a>00529 <span class="keyword">private</span>: |
| | 408 | <a name="l00530"></a>00530 <span class="keywordtype">void</span> AssemblyComponentsFromXML( DOMElement &element ) |
| | 409 | <a name="l00531"></a>00531 { |
| | 410 | <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 ); |
| | 411 | <a name="l00533"></a>00533 } |
| | 412 | <a name="l00534"></a>00534 |
| | 413 | <a name="l00535"></a>00535 <span class="keywordtype">bool</span> DisassemblyComponentsToXML( DOMElement &element ) |
| | 414 | <a name="l00536"></a>00536 { |
| | 415 | <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> ); |
| | 416 | <a name="l00538"></a>00538 <span class="keywordflow">return</span> <span class="keyword">true</span>; |
| | 417 | <a name="l00539"></a>00539 } |
| | 418 | <a name="l00540"></a>00540 |
| | 419 | <a name="l00541"></a>00541 <span class="keyword">protected</span>: |
| | 420 | <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 ) |
| | 421 | <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 ) |
| | 422 | <a name="l00544"></a>00544 { |
| | 423 | <a name="l00545"></a>00545 } |
| | 424 | <a name="l00546"></a>00546 |
| | 425 | <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>() |
| | 426 | <a name="l00548"></a>00548 { |
| | 427 | <a name="l00549"></a>00549 } |
| | 428 | <a name="l00550"></a>00550 |
| | 429 | <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>; |
| | 430 | <a name="l00553"></a>00553 }; |
| | 431 | <a name="l00554"></a>00554 |
| | 432 | <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> |
| | 433 | <a name="l00577"></a>00577 { |
| | 434 | <a name="l00578"></a>00578 <span class="keyword">private</span>: |
| | 435 | <a name="l00582"></a>00582 <span class="keyword">const</span> <a class="code" href="classAssertXercesIsAlive.html" title="Class initializing Xerces library.">AssertXercesIsAlive</a> dummy; |
| | 436 | <a name="l00583"></a>00583 |
| | 437 | <a name="l00585"></a>00585 DOMDocument* pDoc; |
| | 438 | <a name="l00586"></a>00586 |
| | 439 | <a name="l00587"></a>00587 <span class="keyword">const</span> XMLCh* <span class="keyword">const</span> transcodedFileName; |
| | 440 | <a name="l00588"></a>00588 |
| | 441 | <a name="l00590"></a>00590 DOMImplementation *pImplementation; |
| | 442 | <a name="l00591"></a>00591 |
| | 443 | <a name="l00593"></a>00593 DOMWriter *pSerializer; |
| | 444 | <a name="l00594"></a>00594 |
| | 445 | <a name="l00595"></a>00595 <span class="keywordtype">void</span> Clean(); |
| | 446 | <a name="l00596"></a>00596 |
| | 447 | <a name="l00597"></a>00597 <span class="keyword">public</span>: |
| | 448 | <a name="l00599"></a>00599 <a class="code" href="classRootElement.html#25cd0a3019e91c5bbe8bc09cdf6e61aa" title="attach new RootElement instance to a file (typically with an XML extension)">RootElement</a>( <span class="keywordtype">char</span>* fileName ); |
| | 449 | <a name="l00600"></a>00600 |
| | 450 | <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>(); |
| | 451 | <a name="l00602"></a>00602 |
| | 452 | <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> ) ; |
| | 453 | <a name="l00605"></a>00605 |
| | 454 | <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> ); |
| | 455 | <a name="l00608"></a>00608 |
| | 456 | <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>(); |
| | 457 | <a name="l00611"></a>00611 }; |
| | 458 | <a name="l00612"></a>00612 |
| | 459 | <a name="l00613"></a>00613 |
| | 460 | <a name="l00617"></a>00617 |
| | 461 | <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> |
| | 462 | <a name="l00619"></a>00619 { |
| | 463 | <a name="l00620"></a>00620 <span class="keyword">private</span>: |
| | 464 | <a name="l00621"></a>00621 |
| | 465 | <a name="l00622"></a>00622 <span class="keywordtype">bool</span>* AssemblyInstance() |
| | 466 | <a name="l00623"></a>00623 { |
| | 467 | <a name="l00624"></a>00624 <span class="keywordflow">if</span>( value == <span class="stringliteral">"true"</span> ) |
| | 468 | <a name="l00625"></a>00625 <span class="keywordflow">return</span> <span class="keyword">new</span> bool( <span class="keyword">true</span> ); |
| | 469 | <a name="l00626"></a>00626 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( value == <span class="stringliteral">"false"</span> ) |
| | 470 | <a name="l00627"></a>00627 <span class="keywordflow">return</span> <span class="keyword">new</span> bool( <span class="keyword">false</span> ); |
| | 471 | <a name="l00628"></a>00628 <span class="keywordflow">else</span> <span class="keywordflow">return</span> NULL; |
| | 472 | <a name="l00629"></a>00629 } |
| | 473 | <a name="l00630"></a>00630 |
| | 474 | <a name="l00631"></a>00631 <span class="keywordtype">bool</span> DisassemblyInstance(<span class="keywordtype">bool</span> &instance) |
| | 475 | <a name="l00632"></a>00632 { |
| | 476 | <a name="l00633"></a>00633 <span class="keywordflow">if</span>( instance ) |
| | 477 | <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>; |
| | 478 | <a name="l00635"></a>00635 <span class="keywordflow">else</span> |
| | 479 | <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>; |
| | 480 | <a name="l00637"></a>00637 <span class="keywordflow">return</span> <span class="keyword">true</span>; |
| | 481 | <a name="l00638"></a>00638 } |
| | 482 | <a name="l00639"></a>00639 |
| | 483 | <a name="l00640"></a>00640 <span class="keyword">public</span>: |
| | 484 | <a name="l00641"></a>00641 |
| | 485 | <a name="l00642"></a>00642 BoolUI() |
| | 486 | <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>) |
| | 487 | <a name="l00644"></a>00644 { |
| | 488 | <a name="l00645"></a>00645 } |
| | 489 | <a name="l00646"></a>00646 }; |
| | 490 | <a name="l00647"></a>00647 |
| | 491 | <a name="l00648"></a>00648 |
| | 492 | <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> |
| | 493 | <a name="l00650"></a>00650 { |
| | 494 | <a name="l00651"></a>00651 <span class="keyword">private</span>: |
| | 495 | <a name="l00652"></a>00652 |
| | 496 | <a name="l00653"></a>00653 <span class="keywordtype">int</span>* AssemblyInstance() |
| | 497 | <a name="l00654"></a>00654 { |
| | 498 | <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()) ); |
| | 499 | <a name="l00656"></a>00656 } |
| | 500 | <a name="l00657"></a>00657 |
| | 501 | <a name="l00658"></a>00658 <span class="keywordtype">bool</span> DisassemblyInstance(<span class="keywordtype">int</span> &instance) |
| | 502 | <a name="l00659"></a>00659 { |
| | 503 | <a name="l00660"></a>00660 <span class="keywordtype">char</span> buff[30]; |
| | 504 | <a name="l00661"></a>00661 sprintf(buff, <span class="stringliteral">"%d"</span>, instance ); |
| | 505 | <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; |
| | 506 | <a name="l00663"></a>00663 <span class="keywordflow">return</span> <span class="keyword">true</span>; |
| | 507 | <a name="l00664"></a>00664 } |
| | 508 | <a name="l00665"></a>00665 |
| | 509 | <a name="l00666"></a>00666 <span class="keyword">public</span>: |
| | 510 | <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>) |
| | 511 | <a name="l00668"></a>00668 { |
| | 512 | <a name="l00669"></a>00669 } |
| | 513 | <a name="l00670"></a>00670 }; |
| | 514 | <a name="l00671"></a>00671 |
| | 515 | <a name="l00672"></a>00672 |
| | 516 | <a name="l00673"></a>00673 |
| | 517 | <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> |
| | 518 | <a name="l00675"></a>00675 { |
| | 519 | <a name="l00676"></a>00676 <span class="keyword">private</span>: |
| | 520 | <a name="l00677"></a>00677 |
| | 521 | <a name="l00678"></a>00678 <span class="keywordtype">double</span>* AssemblyInstance() |
| | 522 | <a name="l00679"></a>00679 { |
| | 523 | <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()) ); |
| | 524 | <a name="l00681"></a>00681 } |
| | 525 | <a name="l00682"></a>00682 |
| | 526 | <a name="l00683"></a>00683 <span class="keywordtype">bool</span> DisassemblyInstance(<span class="keywordtype">double</span> &instance) |
| | 527 | <a name="l00684"></a>00684 { |
| | 528 | <a name="l00685"></a>00685 <span class="keywordtype">char</span> buff[30]; |
| | 529 | <a name="l00686"></a>00686 sprintf(buff, <span class="stringliteral">"%f"</span>, instance ); |
| | 530 | <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; |
| | 531 | <a name="l00688"></a>00688 <span class="keywordflow">return</span> <span class="keyword">true</span>; |
| | 532 | <a name="l00689"></a>00689 } |
| | 533 | <a name="l00690"></a>00690 |
| | 534 | <a name="l00691"></a>00691 <span class="keyword">public</span>: |
| | 535 | <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>) |
| | 536 | <a name="l00693"></a>00693 { |
| | 537 | <a name="l00694"></a>00694 } |
| | 538 | <a name="l00695"></a>00695 }; |
| | 539 | <a name="l00696"></a>00696 |
| | 540 | <a name="l00697"></a>00697 |
| | 541 | <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> |
| | 542 | <a name="l00699"></a>00699 { |
| | 543 | <a name="l00700"></a>00700 <span class="keyword">private</span>: |
| | 544 | <a name="l00701"></a>00701 <span class="keywordtype">string</span>* AssemblyInstance() |
| | 545 | <a name="l00702"></a>00702 { |
| | 546 | <a name="l00703"></a>00703 <span class="keywordflow">return</span> <span class="keyword">new</span> string( value ); |
| | 547 | <a name="l00704"></a>00704 } |
| | 548 | <a name="l00705"></a>00705 |
| | 549 | <a name="l00706"></a>00706 <span class="keywordtype">bool</span> DisassemblyInstance(<span class="keywordtype">string</span> &instance) |
| | 550 | <a name="l00707"></a>00707 { |
| | 551 | <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; |
| | 552 | <a name="l00709"></a>00709 <span class="keywordflow">return</span> <span class="keyword">true</span>; |
| | 553 | <a name="l00710"></a>00710 } |
| | 554 | <a name="l00711"></a>00711 |
| | 555 | <a name="l00712"></a>00712 <span class="keyword">public</span>: |
| | 556 | <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>) |
| | 557 | <a name="l00714"></a>00714 { |
| | 558 | <a name="l00715"></a>00715 } |
| | 559 | <a name="l00716"></a>00716 }; |
| | 560 | <a name="l00717"></a>00717 |
| | 561 | <a name="l00718"></a>00718 |
| | 562 | <a name="l00719"></a>00719 <span class="preprocessor">#endif // #ifndef UI_H</span> |