root/doc/html/userinfo_8h-source.html @ 143

Revision 139, 31.4 kB (checked in by smidl, 16 years ago)

Documentation update

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3<title>mixpp: work/mixpp/bdm/userinfo.h Source File</title>
4<link href="doxygen.css" rel="stylesheet" type="text/css">
5<link href="tabs.css" rel="stylesheet" type="text/css">
6</head><body>
7<!-- Generated by Doxygen 1.5.6 -->
8<div class="navigation" id="top">
9  <div class="tabs">
10    <ul>
11      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
12      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
13      <li><a href="annotated.html"><span>Classes</span></a></li>
14      <li class="current"><a href="files.html"><span>Files</span></a></li>
15    </ul>
16  </div>
17<h1>work/mixpp/bdm/userinfo.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef UI_H</span>
18<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define UI_H</span>
19<a name="l00003"></a>00003 <span class="preprocessor"></span>
20<a name="l00004"></a>00004 <span class="preprocessor">#include &lt;sstream&gt;</span>
21<a name="l00005"></a>00005 <span class="preprocessor">#include &lt;iostream&gt;</span>
22<a name="l00006"></a>00006 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
23<a name="l00007"></a>00007 <span class="preprocessor">#include &lt;string&gt;</span>
24<a name="l00008"></a>00008 <span class="preprocessor">#include &lt;map&gt;</span>
25<a name="l00009"></a>00009 <span class="preprocessor">#include &lt;utility&gt;</span>
26<a name="l00010"></a>00010 <span class="preprocessor">#include &lt;xercesc/dom/DOM.hpp&gt;</span>
27<a name="l00011"></a>00011 <span class="preprocessor">#include &lt;xercesc/util/PlatformUtils.hpp&gt;</span>
28<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;xercesc/util/XMLString.hpp&gt;</span>
29<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;iostream&gt;</span>
30<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;xercesc/framework/LocalFileFormatTarget.hpp&gt;</span>
31<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;xercesc/framework/LocalFileInputSource.hpp&gt;</span>
32<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;xercesc/dom/DOMWriter.hpp&gt;</span>
33<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;xercesc/parsers/XercesDOMParser.hpp&gt;</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&amp;#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&lt;const XMLCh* const, Attribute* const, GlobalXercesConnector::Comparator&gt; <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> &amp;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 &amp;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 };
111<a name="l00132"></a>00132
112<a name="l00139"></a><a class="code" href="classUserInfoCore.html">00139</a> <span class="keyword">class </span><a class="code" href="classUserInfoCore.html" title="UserInfoCore class is for internal purposes only. Use UserInfo&amp;lt;T&amp;gt; instead.">UserInfoCore</a>
113<a name="l00140"></a>00140 {
114<a name="l00141"></a>00141 <span class="keyword">public</span>:
115<a name="l00143"></a>00143         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classUserInfoCore.html#a09a9b965ca04a186143787c0d049a7f" title="Fills internal attributes and descendant elements according DOMElement.">ParseElement</a>(DOMElement *element) = 0;
116<a name="l00144"></a>00144
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 &amp;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>&lt;<span class="keyword">typename</span> T&gt; <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&amp;lt;T&amp;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&lt;const XMLCh* const, UserInfoCore* const, GlobalXercesConnector::Comparator&gt; 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&lt;T&gt;</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&lt;T&gt;</a>()
145<a name="l00187"></a>00187         {
146<a name="l00188"></a>00188                 XMLString::release( (XMLCh**)&amp;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( &amp;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>-&gt;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-&gt;getDocumentElement();
161<a name="l00205"></a>00205
162<a name="l00206"></a>00206                 <a class="code" href="classUserInfo.html#22ca1ef5a10740e4107cd5a7e9a72856" title="Fills DOMElement according internal attributes and descendant elements.">FillElement</a>( *pRoot );
163<a name="l00207"></a>00207
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>-&gt;writeNode( &amp;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( &amp;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>-&gt;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>-&gt;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>-&gt;getDocument();               
188<a name="l00233"></a>00233                         DOMElement *pRoot = pDoc-&gt;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-&gt;getFirstChild(); node != NULL; node = node-&gt;getNextSibling() )
191<a name="l00236"></a>00236                                 <span class="keywordflow">if</span>( node-&gt;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 &amp;externalElements)
205<a name="l00251"></a>00251         {
206<a name="l00252"></a>00252                 pair&lt;const XMLCh* const, UserInfoCore* const&gt; 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-&gt;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 &lt; nodeList-&gt;getLength(); i++ )
215<a name="l00261"></a>00261                         {
216<a name="l00262"></a>00262                                 DOMNode* node = nodeList-&gt;item(i);
217<a name="l00263"></a>00263                                 <span class="keywordflow">if</span>( node-&gt;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-&gt;getTagName() );
221<a name="l00267"></a>00267
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-&gt;second-&gt;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-&gt;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 &lt; nodeMap-&gt;getLength(); i++ )
230<a name="l00276"></a>00276                         {
231<a name="l00277"></a>00277                                 DOMNode* node = nodeMap-&gt;item(i);
232<a name="l00278"></a>00278                                 <span class="keywordflow">if</span>( node-&gt;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-&gt;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&amp;#39; XMLCh-based strings into C++ strings">GlobalXercesConnector::XMLCh2str</a>( attribute-&gt;getValue() );
240<a name="l00286"></a>00286                                                 iter-&gt;second-&gt;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 &amp;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-&gt;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-&gt;second-&gt;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-&gt;second-&gt;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>
262</pre></div></div>
263<hr size="1"><address style="text-align: right;"><small>Generated on Sat Aug 16 11:58:41 2008 for mixpp by&nbsp;
264<a href="http://www.doxygen.org/index.html">
265<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
266</body>
267</html>
Note: See TracBrowser for help on using the browser.