<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>HippoDraw Class Library</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> <link rel="shortcut icon" href="hippoApp.ico"> </head><body> <!-- Generated by Doxygen 1.6.2 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</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> <div class="navpath"><a class="el" href="dir_64d98773e28ad3a986be8bc9397e242e.html">qtxml</a> </div> </div> <div class="contents"> <h1>QtXMLController.cxx</h1><a href="QtXMLController_8cxx.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <a name="l00011"></a>00011 <span class="preprocessor">#include "<a class="code" href="QtXMLController_8h.html">QtXMLController.h</a>"</span> <a name="l00012"></a>00012 <a name="l00013"></a>00013 <span class="preprocessor">#include "<a class="code" href="QtXmlDocument_8h.html" title="QtXmlDocument class interface.">QtXmlDocument.h</a>"</span> <a name="l00014"></a>00014 <a name="l00015"></a>00015 <span class="preprocessor">#include <qfile.h></span> <a name="l00016"></a>00016 <a name="l00017"></a>00017 <span class="keyword">using</span> std::string; <a name="l00018"></a>00018 <a name="l00019"></a>00019 <span class="keyword">namespace </span>hippodraw { <a name="l00020"></a>00020 <a name="l00021"></a>00021 QtXMLController * <a class="code" href="classhippodraw_1_1QtXMLController.html#aac2ba258fb046a1146b876205e97dd2b" title="The pointer to the singleton object.">QtXMLController::s_instance</a> = 0; <a name="l00022"></a>00022 <a name="l00023"></a><a class="code" href="classhippodraw_1_1QtXMLController.html#a631592d12fda09e490885c8c764e8d37">00023</a> <a class="code" href="classhippodraw_1_1QtXMLController.html#a631592d12fda09e490885c8c764e8d37" title="A default constructor for avoiding creation except by itself or with derived classes...">QtXMLController::QtXMLController</a> ( ) <a name="l00024"></a>00024 { <a name="l00025"></a>00025 } <a name="l00026"></a>00026 <a name="l00027"></a><a class="code" href="classhippodraw_1_1QtXMLController.html#a05ff87abb61f8c8cce20116d6a9bc5df">00027</a> <a class="code" href="classhippodraw_1_1QtXMLController.html" title="A singleton class that is does XML serialization and deserialization with Qt XML...">QtXMLController</a> * <a class="code" href="classhippodraw_1_1QtXMLController.html#a05ff87abb61f8c8cce20116d6a9bc5df" title="Returns the pointer to the singleton instance.">QtXMLController::instance</a> ( ) <a name="l00028"></a>00028 { <a name="l00029"></a>00029 <span class="keywordflow">if</span> ( <a class="code" href="classhippodraw_1_1QtXMLController.html#aac2ba258fb046a1146b876205e97dd2b" title="The pointer to the singleton object.">s_instance</a> == 0 ) { <a name="l00030"></a>00030 <a class="code" href="classhippodraw_1_1QtXMLController.html#aac2ba258fb046a1146b876205e97dd2b" title="The pointer to the singleton object.">s_instance</a> = <span class="keyword">new</span> <a class="code" href="classhippodraw_1_1QtXMLController.html#a631592d12fda09e490885c8c764e8d37" title="A default constructor for avoiding creation except by itself or with derived classes...">QtXMLController</a> (); <a name="l00031"></a>00031 } <a name="l00032"></a>00032 <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1QtXMLController.html#aac2ba258fb046a1146b876205e97dd2b" title="The pointer to the singleton object.">s_instance</a>; <a name="l00033"></a>00033 } <a name="l00034"></a>00034 <a name="l00035"></a>00035 <span class="keywordtype">bool</span> <a name="l00036"></a>00036 <a class="code" href="classhippodraw_1_1QtXMLController.html#a74d7ee849fc5efd467a6f773e85726e8" title="Returns true if the specified file exists.">QtXMLController::</a> <a name="l00037"></a><a class="code" href="classhippodraw_1_1QtXMLController.html#a74d7ee849fc5efd467a6f773e85726e8">00037</a> <a class="code" href="classhippodraw_1_1QtXMLController.html#a74d7ee849fc5efd467a6f773e85726e8" title="Returns true if the specified file exists.">fileExists</a> ( <span class="keyword">const</span> std::string & filename )<span class="keyword"> const</span> <a name="l00038"></a>00038 <span class="keyword"></span>{ <a name="l00039"></a>00039 <a class="codeRef" doxygen="qt.tag:http://doc.trolltech.com/3.3/" href="http://doc.trolltech.com/3.3/qfile.html">QFile</a> file ( filename.c_str() ); <a name="l00040"></a>00040 <a name="l00041"></a>00041 <span class="keywordflow">return</span> file.exists (); <a name="l00042"></a>00042 } <a name="l00043"></a>00043 <a name="l00044"></a>00044 <span class="keywordtype">void</span> <a name="l00045"></a>00045 <a class="code" href="classhippodraw_1_1QtXMLController.html#a612a963b5ec4c3948068311e38927b50" title="Creates a new document.">QtXMLController::</a> <a name="l00046"></a><a class="code" href="classhippodraw_1_1QtXMLController.html#a612a963b5ec4c3948068311e38927b50">00046</a> <a class="code" href="classhippodraw_1_1QtXMLController.html#a612a963b5ec4c3948068311e38927b50" title="Creates a new document.">newDocument</a> ( <span class="keyword">const</span> std::string & name ) <a name="l00047"></a>00047 { <a name="l00048"></a>00048 <span class="comment">// if ( m_xml_doc != 0 ) delete m_xml_doc;</span> <a name="l00049"></a>00049 <a class="code" href="classhippodraw_1_1XmlController.html#a88c79c54a5590febd08ff65135a4a17d" title="The current document being generated or read.">m_xml_doc</a> = <span class="keyword">new</span> <a class="code" href="classhippodraw_1_1QtXmlDocument.html" title="An XML DOM Document handler using the Qt XML module.">QtXmlDocument</a> ( name ); <a name="l00050"></a>00050 } <a name="l00051"></a>00051 <a name="l00052"></a>00052 } <span class="comment">// namespace hippodraw</span> <a name="l00053"></a>00053 </pre></div></div> <hr size="1"><address style="align: right;"><small> Generated for HippoDraw Class Library by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0> </a> </small></address> </body> </html>