GED 2006 (C++)
Detail souboru
Zdrojový kód
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>GED 2006: gedconf.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.2 -->
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="classes.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>File Members</span></a></li>
</ul>
</div>
<h1>gedconf.h</h1><a href="gedconf_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * File: gedconf.h</span>
<a name="l00003"></a>00003 <span class="comment"> * Project: GED - bitmap editor (ICP)</span>
<a name="l00004"></a>00004 <span class="comment"> * Author: Jakub Filak, xfilak01</span>
<a name="l00005"></a>00005 <span class="comment"> * Team: xdudka00, xfilak01, xhefka00, xhradi08</span>
<a name="l00006"></a>00006 <span class="comment"> * Created: 2006-04-14</span>
<a name="l00007"></a>00007 <span class="comment"> */</span>
<a name="l00008"></a>00008
<a name="l00009"></a>00009 <span class="preprocessor">#ifndef GEDCONF_H</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span><span class="preprocessor">#define GEDCONF_H</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span>
<a name="l00012"></a>00012 <span class="preprocessor">#include <map></span>
<a name="l00013"></a>00013 <span class="preprocessor">#include <vector></span>
<a name="l00014"></a>00014 <span class="preprocessor">#include <xercesc/dom/DOM.hpp></span>
<a name="l00015"></a>00015
<a name="l00021"></a><a class="code" href="gedconf_8h.html#6e460c7e29e2723443bf404463544804">00021</a> <span class="keyword">typedef</span> std::map<std::string, std::string> <a class="code" href="gedconf_8h.html#6e460c7e29e2723443bf404463544804">PluginDirsList</a>;
<a name="l00022"></a><a class="code" href="gedconf_8h.html#bad9096a740522586d5978a8172655c8">00022</a> <span class="keyword">typedef</span> PluginDirsList::iterator <a class="code" href="gedconf_8h.html#bad9096a740522586d5978a8172655c8" title="iterator for PluginDirsList">PluginDirsListIterator</a>;
<a name="l00023"></a>00023
<a name="l00029"></a><a class="code" href="gedconf_8h.html#6e8e7e2c6bc24610c07a629511b31e71">00029</a> <span class="keyword">typedef</span> std::map<std::string, std::string> <a class="code" href="gedconf_8h.html#6e8e7e2c6bc24610c07a629511b31e71">MacroList</a>;
<a name="l00030"></a>00030
<a name="l00034"></a><a class="code" href="classGedMacroCommand.html">00034</a> <span class="keyword">class </span><a class="code" href="classGedMacroCommand.html">GedMacroCommand</a> {
<a name="l00035"></a>00035 <span class="keyword">public</span>:
<a name="l00041"></a><a class="code" href="classGedMacroCommand.html#4e3322dbce5f3fd14be3c8991d414ac5">00041</a> <a class="code" href="classGedMacroCommand.html#4e3322dbce5f3fd14be3c8991d414ac5">GedMacroCommand</a> (std::string name, std::string param) {
<a name="l00042"></a>00042 _commandName = name;
<a name="l00043"></a>00043 _params = param;
<a name="l00044"></a>00044 };
<a name="l00045"></a>00045
<a name="l00050"></a><a class="code" href="classGedMacroCommand.html#f09b594a4d7bc5aba15cce54dfcc46e3">00050</a> std::string <a class="code" href="classGedMacroCommand.html#f09b594a4d7bc5aba15cce54dfcc46e3">getName</a> () { <span class="keywordflow">return</span> _commandName; }
<a name="l00051"></a>00051
<a name="l00056"></a><a class="code" href="classGedMacroCommand.html#c846012bffd1dd2887b1e7d1272c9f99">00056</a> std::string <a class="code" href="classGedMacroCommand.html#c846012bffd1dd2887b1e7d1272c9f99">getParam</a> () { <span class="keywordflow">return</span> _params; }
<a name="l00057"></a>00057
<a name="l00062"></a><a class="code" href="classGedMacroCommand.html#4ba3ce37b620d79c40d7036601be7be0">00062</a> <span class="keywordtype">void</span> <a class="code" href="classGedMacroCommand.html#4ba3ce37b620d79c40d7036601be7be0">setName</a> ( std::string name ) { _commandName = name; }
<a name="l00063"></a>00063
<a name="l00068"></a><a class="code" href="classGedMacroCommand.html#f7795ce8bbbf123ea67c52d0c081b33d">00068</a> <span class="keywordtype">void</span> <a class="code" href="classGedMacroCommand.html#f7795ce8bbbf123ea67c52d0c081b33d">setParam</a> ( std::string param ) { _params = param; }
<a name="l00069"></a>00069
<a name="l00074"></a><a class="code" href="classGedMacroCommand.html#80a40d6cc9ac0aa4068fb5d1b3e76992">00074</a> <span class="keywordtype">void</span> <a class="code" href="classGedMacroCommand.html#80a40d6cc9ac0aa4068fb5d1b3e76992">addParam</a> ( std::string param ) { _params += ( <span class="stringliteral">" "</span> + param ); }
<a name="l00075"></a>00075
<a name="l00076"></a>00076 <span class="keyword">private</span>:
<a name="l00077"></a>00077 std::string _commandName;
<a name="l00078"></a>00078 std::string _params;
<a name="l00079"></a>00079 };
<a name="l00080"></a>00080
<a name="l00084"></a><a class="code" href="gedconf_8h.html#25f0021c29607fd2364999be3a07dcae">00084</a> <span class="keyword">typedef</span> std::vector<GedMacroCommand> <a class="code" href="gedconf_8h.html#25f0021c29607fd2364999be3a07dcae">CommandVector</a>;
<a name="l00085"></a>00085
<a name="l00091"></a><a class="code" href="gedconf_8h.html#fdf062ef46463a1659ca7b90310b78ab">00091</a> <span class="keyword">typedef</span> std::map<std::string, CommandVector> <a class="code" href="gedconf_8h.html#fdf062ef46463a1659ca7b90310b78ab">MacroCommands</a>;
<a name="l00092"></a>00092
<a name="l00093"></a>00093 <span class="comment">/*</span>
<a name="l00094"></a>00094 <span class="comment"> * Support for reading/writing configuration. Design pattern singleton.</span>
<a name="l00095"></a>00095 <span class="comment"> */</span>
<a name="l00096"></a><a class="code" href="classGedConf.html">00096</a> <span class="keyword">class </span><a class="code" href="classGedConf.html">GedConf</a> {
<a name="l00097"></a>00097 <span class="keyword">public</span>:
<a name="l00098"></a>00098 <a class="code" href="classGedConf.html#a977f222aba54fb48e52765d2d276e98">~GedConf</a> ();
<a name="l00103"></a>00103 <span class="keyword">static</span> <a class="code" href="classGedConf.html">GedConf</a> *<a class="code" href="classGedConf.html#64a8e0a4b170662b293a15d53a77a54c">ptr</a>();
<a name="l00104"></a>00104
<a name="l00108"></a>00108 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classGedConf.html#8ab92f4b04ac5f2f50e41be90f6374e3">destroy</a>();
<a name="l00109"></a>00109
<a name="l00115"></a>00115 <span class="keywordtype">void</span> <a class="code" href="classGedConf.html#036a02956f96597b5465df24f6f67aad">readConfig</a> ( <span class="keyword">const</span> <span class="keywordtype">char</span>* pathToFile );
<a name="l00116"></a>00116
<a name="l00121"></a>00121 <span class="keywordtype">void</span> <a class="code" href="classGedConf.html#1bf13404c943789c10336189c31be235">saveConfig</a> ();
<a name="l00122"></a>00122
<a name="l00127"></a>00127 <a class="code" href="gedconf_8h.html#6e460c7e29e2723443bf404463544804">PluginDirsList</a> <a class="code" href="classGedConf.html#6082f9c00c2ce43a75b3edfc7ea586b5">getPluginDirs</a>();
<a name="l00128"></a>00128
<a name="l00134"></a>00134 <span class="keywordtype">void</span> <a class="code" href="classGedConf.html#bd07f5872d6a237250b5b1bb2a537287">setPluginDir</a>( <span class="keyword">const</span> <span class="keywordtype">char</span>* pathToDir );
<a name="l00135"></a>00135
<a name="l00140"></a>00140 <span class="keywordtype">void</span> <a class="code" href="classGedConf.html#90e681c34a408c78e0c1c8eb7d34e19b">removePluginDir</a>( <span class="keyword">const</span> <span class="keywordtype">char</span>* pathToDir );
<a name="l00141"></a>00141
<a name="l00146"></a>00146 <a class="code" href="gedconf_8h.html#6e8e7e2c6bc24610c07a629511b31e71">MacroList</a> <a class="code" href="classGedConf.html#71c0ec018af399f13fe117f375d097aa">getMacroList</a>();
<a name="l00147"></a>00147
<a name="l00153"></a>00153 <a class="code" href="gedconf_8h.html#25f0021c29607fd2364999be3a07dcae">CommandVector</a> <a class="code" href="classGedConf.html#0db5c1f36055af0c890fb31a40ceae12">getCommands</a>( <span class="keyword">const</span> std::string macroName );
<a name="l00154"></a>00154
<a name="l00159"></a>00159 <span class="keywordtype">void</span> <a class="code" href="classGedConf.html#7a33e55897fb3f292eaf7a0571a0c52b">removeMacro</a>( <span class="keyword">const</span> std::string macroName );
<a name="l00160"></a>00160
<a name="l00167"></a>00167 <span class="keywordtype">void</span> <a class="code" href="classGedConf.html#a9cead25b68dc760b6aed8203d4cc881">addMacro</a>( <span class="keyword">const</span> <span class="keywordtype">char</span>* macroName, <span class="keyword">const</span> <span class="keywordtype">char</span>* commandName, <span class="keyword">const</span> <span class="keywordtype">char</span>* commandParams );
<a name="l00168"></a>00168
<a name="l00173"></a>00173 std::string <a class="code" href="classGedConf.html#08e1d61dfcc51a7d4e5b1846880bb4c5">getHelpDir</a>();
<a name="l00174"></a>00174
<a name="l00179"></a>00179 std::string <a class="code" href="classGedConf.html#0321ecc1f611b2409177b5eb80406566">getImageDir</a>();
<a name="l00180"></a>00180
<a name="l00187"></a>00187 <span class="keywordtype">void</span> <a class="code" href="classGedConf.html#424a719d4edb0378ac4524422f23c8d9">getFont</a>( std::string &fileName, std::string &dpi, std::string &size);
<a name="l00188"></a>00188
<a name="l00189"></a>00189 <span class="keyword">protected</span>:
<a name="l00190"></a>00190
<a name="l00194"></a><a class="code" href="classGedConf.html#445e648cf15e91db368f48c57defc020">00194</a> <a class="code" href="classGedConf.html#445e648cf15e91db368f48c57defc020">GedConf</a>():_change(false){}
<a name="l00195"></a>00195
<a name="l00196"></a>00196 <span class="keyword">private</span>:
<a name="l00197"></a>00197 <span class="keyword">static</span> <a class="code" href="classGedConf.html">GedConf</a> *_instance;
<a name="l00198"></a>00198
<a name="l00199"></a>00199 <a class="code" href="gedconf_8h.html#6e460c7e29e2723443bf404463544804">PluginDirsList</a> _PluginDirs; <span class="comment">// plugin list, plugin dirs mapped with their config file</span>
<a name="l00200"></a>00200 <a class="code" href="gedconf_8h.html#6e8e7e2c6bc24610c07a629511b31e71">MacroList</a> _MacroList; <span class="comment">// list of macro names</span>
<a name="l00201"></a>00201 <a class="code" href="gedconf_8h.html#fdf062ef46463a1659ca7b90310b78ab">MacroCommands</a> _MacroCommands; <span class="comment">// macro names with their commands </span>
<a name="l00202"></a>00202 std::string _helpdir; <span class="comment">// dir with help file </span>
<a name="l00203"></a>00203 std::string _imagesDir;
<a name="l00204"></a>00204 std::string _fontFile;
<a name="l00205"></a>00205 std::string _fontDPI;
<a name="l00206"></a>00206 std::string _fontSize;
<a name="l00207"></a>00207
<a name="l00208"></a>00208 std::string _lastCofingFile; <span class="comment">// last used configure file</span>
<a name="l00209"></a>00209
<a name="l00210"></a>00210 <span class="keywordtype">bool</span> _change; <span class="comment">// true when changes some in config file</span>
<a name="l00211"></a>00211 <span class="keywordtype">bool</span> _PLFR; <span class="comment">// true if is plugin record in last file </span>
<a name="l00212"></a>00212 <span class="keywordtype">bool</span> _MLFR; <span class="comment">// true if is macro record in last file</span>
<a name="l00213"></a>00213 <span class="keywordtype">bool</span> _HLFR; <span class="comment">// true if is help record in last file</span>
<a name="l00214"></a>00214 <span class="keywordtype">bool</span> _ILFR; <span class="comment">// true if is images record in last file</span>
<a name="l00215"></a>00215 <span class="keywordtype">bool</span> _FLFR; <span class="comment">// true if is font record in last file</span>
<a name="l00216"></a>00216
<a name="l00217"></a>00217 <span class="preprocessor">#if XERCES_VERSION_MINOR == 7</span>
<a name="l00218"></a>00218 <span class="preprocessor"></span>
<a name="l00221"></a>00221 <span class="keywordtype">void</span> parsePluginDirs( xercesc_2_7::DOMNodeList* listPluginNodes );
<a name="l00222"></a>00222
<a name="l00226"></a>00226 <span class="keywordtype">void</span> parseMacros( xercesc_2_7::DOMNodeList* listPluginNodes );
<a name="l00227"></a>00227
<a name="l00231"></a>00231 <span class="keywordtype">void</span> parseNodeWithOneAttribute( xercesc_2_7::DOMNode* Node, <span class="keyword">const</span> <span class="keywordtype">char</span>* nName, std::string &Store, <span class="keywordtype">bool</span>* recor);
<a name="l00232"></a>00232
<a name="l00236"></a>00236 <span class="keywordtype">void</span> parseFont( xercesc_2_7::DOMNode* fontNode );
<a name="l00237"></a>00237
<a name="l00241"></a>00241 <a class="code" href="gedconf_8h.html#25f0021c29607fd2364999be3a07dcae">CommandVector</a> parseMacroCommands( xercesc_2_7::DOMNodeList* listPluginNodes );
<a name="l00242"></a>00242
<a name="l00246"></a>00246 <span class="keywordtype">void</span> createCommandTree( xercesc_2_7::DOMNode* macroNode, std::string macroName );
<a name="l00247"></a>00247 <span class="preprocessor">#endif </span>
<a name="l00248"></a>00248 <span class="preprocessor"></span><span class="preprocessor">#if XERCES_VERSION_MINOR == 6 </span>
<a name="l00249"></a>00249 <span class="preprocessor"></span>
<a name="l00252"></a>00252 <span class="keywordtype">void</span> parsePluginDirs( xercesc_2_6::DOMNodeList* listPluginNodes );
<a name="l00253"></a>00253
<a name="l00257"></a>00257 <span class="keywordtype">void</span> parseMacros( xercesc_2_6::DOMNodeList* listPluginNodes );
<a name="l00258"></a>00258
<a name="l00262"></a>00262 <span class="keywordtype">void</span> parseNodeWithOneAttribute( xercesc_2_6::DOMNode* Node, <span class="keyword">const</span> <span class="keywordtype">char</span>* nName, std::string &Store, <span class="keywordtype">bool</span>* recor);
<a name="l00263"></a>00263
<a name="l00267"></a>00267 <span class="keywordtype">void</span> parseFont( xercesc_2_6::DOMNode* fontNode );
<a name="l00268"></a>00268
<a name="l00272"></a>00272 <a class="code" href="gedconf_8h.html#25f0021c29607fd2364999be3a07dcae">CommandVector</a> parseMacroCommands( xercesc_2_6::DOMNodeList* listPluginNodes );
<a name="l00273"></a>00273
<a name="l00277"></a>00277 <span class="keywordtype">void</span> createCommandTree( xercesc_2_6::DOMNode* macroNode, std::string macroName );
<a name="l00278"></a>00278 <span class="preprocessor">#endif </span>
<a name="l00279"></a>00279 <span class="preprocessor"></span>
<a name="l00280"></a>00280 };
<a name="l00281"></a>00281
<a name="l00282"></a>00282 <span class="preprocessor">#endif</span>
</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Wed Aug 29 00:01:04 2007 for GED 2006 by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.2 </small></address>
</body>
</html>