<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_d71d549033b3d00bbeb107001643b90a.html">xml</a> </div> </div> <div class="contents"> <h1>FontXML.cxx</h1><a href="FontXML_8cxx.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <a name="l00012"></a>00012 <span class="preprocessor">#include "<a class="code" href="FontXML_8h.html" title="FontXML class interface.">FontXML.h</a>"</span> <a name="l00013"></a>00013 <a name="l00014"></a>00014 <span class="preprocessor">#include "<a class="code" href="XmlElement_8h.html" title="XmlElement class interface.">XmlElement.h</a>"</span> <a name="l00015"></a>00015 <a name="l00016"></a>00016 <span class="preprocessor">#include "<a class="code" href="FontBase_8h.html" title="FontBase class interface.">graphics/FontBase.h</a>"</span> <a name="l00017"></a>00017 <a name="l00018"></a>00018 <span class="preprocessor">#include <cassert></span> <a name="l00019"></a>00019 <a name="l00020"></a>00020 <span class="keyword">using</span> std::string; <a name="l00021"></a>00021 <a name="l00022"></a>00022 <span class="keyword">namespace </span>hippodraw { <a name="l00023"></a>00023 <a name="l00024"></a><a class="code" href="classhippodraw_1_1FontXML.html#a3231a82dc84e92777c9a513c02f5aa5f">00024</a> <a class="code" href="classhippodraw_1_1FontXML.html#a91b0820d3803715b25944c4c77f5fd3a" title="A private copy constructor in order to avoid copying.">FontXML::FontXML</a> ( <a class="code" href="classhippodraw_1_1XmlController.html" title="A base class that is the interface between GUI and the XML serialization and deserialization...">XmlController</a> * controller ) <a name="l00025"></a>00025 : <a class="code" href="classhippodraw_1_1BaseXML.html" title="A base class of XML element controllers.">BaseXML</a> ( <span class="stringliteral">"Font"</span>, controller ), <a name="l00026"></a>00026 m_family ( <span class="stringliteral">"family"</span> ), <a name="l00027"></a>00027 m_italic ( <span class="stringliteral">"italic"</span> ), <a name="l00028"></a>00028 m_size ( <span class="stringliteral">"size"</span> ), <a name="l00029"></a>00029 m_weight ( <span class="stringliteral">"weight"</span> ) <a name="l00030"></a>00030 { <a name="l00031"></a>00031 } <a name="l00032"></a>00032 <a name="l00033"></a>00033 <span class="keywordtype">void</span> <a name="l00034"></a>00034 <a class="code" href="classhippodraw_1_1FontXML.html#a6ad02cc8e249d688335928e912509ac9" title="Sets the attributes of the element from FontBase object.">FontXML::</a> <a name="l00035"></a><a class="code" href="classhippodraw_1_1FontXML.html#a6ad02cc8e249d688335928e912509ac9">00035</a> <a class="code" href="classhippodraw_1_1FontXML.html#a6ad02cc8e249d688335928e912509ac9" title="Sets the attributes of the element from FontBase object.">setAttributes</a> ( <a class="code" href="classhippodraw_1_1XmlElement.html" title="A pure virtual base class of XML element wrapper.">XmlElement</a> & tag, <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1FontBase.html" title="A abstract base class for font handling.">FontBase</a> & font ) <a name="l00036"></a>00036 { <a name="l00037"></a>00037 <span class="keywordtype">string</span> family = font.<a class="code" href="classhippodraw_1_1FontBase.html#ac3fb7910048777d689b7cce9a9caf653" title="Get the family associated with the font.">family</a> (); <a name="l00038"></a>00038 tag.<a class="code" href="classhippodraw_1_1XmlElement.html#abf6f7e218f61b094107a9e93ab267fd8" title="Sets attribute named name to the int value value.">setAttribute</a> ( <a class="code" href="classhippodraw_1_1FontXML.html#af85a81e31d491e4e62e137d2130932b0" title="The family attribute name.">m_family</a>, family ); <a name="l00039"></a>00039 <a name="l00040"></a>00040 <span class="keywordtype">bool</span> italic = font.<a class="code" href="classhippodraw_1_1FontBase.html#a51ac44f372c8b43fae07479ce548bbb8" title="Returns true if the font is italic, othwise returns false.">italic</a> (); <a name="l00041"></a>00041 tag.<a class="code" href="classhippodraw_1_1XmlElement.html#abf6f7e218f61b094107a9e93ab267fd8" title="Sets attribute named name to the int value value.">setAttribute</a> ( <a class="code" href="classhippodraw_1_1FontXML.html#a73ce8ccf631725f72f3c37b8c3a64bbe" title="The italic attribute name.">m_italic</a>, italic ); <a name="l00042"></a>00042 <a name="l00043"></a>00043 <span class="keywordtype">int</span> <a class="code" href="namespacenum__util.html#a137f48a49d12a7dae8ba7c86db2a0c01">size</a> = font.<a class="code" href="classhippodraw_1_1FontBase.html#aad3bfdef486bcb87bc672b48314f019d" title="Get the pointsize of the font.">pointSize</a> (); <a name="l00044"></a>00044 tag.<a class="code" href="classhippodraw_1_1XmlElement.html#abf6f7e218f61b094107a9e93ab267fd8" title="Sets attribute named name to the int value value.">setAttribute</a> ( <a class="code" href="classhippodraw_1_1FontXML.html#a17b2ca2062cf6a07236943061bf64eb1" title="The point size attribute name.">m_size</a>, size ); <a name="l00045"></a>00045 <a name="l00046"></a>00046 <span class="keywordtype">int</span> <a class="code" href="namespacehippodraw_1_1FontWeight.html#a103012df4b715f58a539b009a0b8b340">weight</a> = font.<a class="code" href="classhippodraw_1_1FontBase.html#a17f57abe08a169bd2fb68dd0c8c16806" title="Get the weight of the font.">weight</a> (); <a name="l00047"></a>00047 tag.<a class="code" href="classhippodraw_1_1XmlElement.html#abf6f7e218f61b094107a9e93ab267fd8" title="Sets attribute named name to the int value value.">setAttribute</a> ( <a class="code" href="classhippodraw_1_1FontXML.html#ad7630136f9ed9b266ef3057d11e5ccae" title="The font weight attribute name.">m_weight</a>, weight ); <a name="l00048"></a>00048 } <a name="l00049"></a>00049 <a name="l00050"></a>00050 <span class="keywordtype">void</span> <a name="l00051"></a>00051 <a class="code" href="classhippodraw_1_1FontXML.html#a6ad02cc8e249d688335928e912509ac9" title="Sets the attributes of the element from FontBase object.">FontXML::</a> <a name="l00052"></a><a class="code" href="classhippodraw_1_1FontXML.html#ae475d3f70e78144c8f434e3ccf0759fb">00052</a> <a class="code" href="classhippodraw_1_1FontXML.html#a6ad02cc8e249d688335928e912509ac9" title="Sets the attributes of the element from FontBase object.">setAttributes</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1XmlElement.html" title="A pure virtual base class of XML element wrapper.">XmlElement</a> * element, <a class="code" href="classhippodraw_1_1FontBase.html" title="A abstract base class for font handling.">FontBase</a> * font ) <a name="l00053"></a>00053 { <a name="l00054"></a>00054 <span class="keywordtype">string</span> family; <a name="l00055"></a>00055 <span class="keywordtype">bool</span> ok = element -> attribute ( <a class="code" href="classhippodraw_1_1FontXML.html#af85a81e31d491e4e62e137d2130932b0" title="The family attribute name.">m_family</a>, family ); <a name="l00056"></a>00056 font -> setFamily ( family ); <a name="l00057"></a>00057 <a name="l00058"></a>00058 <span class="keywordtype">bool</span> italic; <a name="l00059"></a>00059 ok = element -> attribute ( <a class="code" href="classhippodraw_1_1FontXML.html#a73ce8ccf631725f72f3c37b8c3a64bbe" title="The italic attribute name.">m_italic</a>, italic ); <a name="l00060"></a>00060 assert ( ok ); <a name="l00061"></a>00061 font -> setItalic ( italic ); <a name="l00062"></a>00062 <a name="l00063"></a>00063 <span class="keywordtype">int</span> <a class="code" href="namespacenum__util.html#a137f48a49d12a7dae8ba7c86db2a0c01">size</a>; <a name="l00064"></a>00064 ok = element -> attribute ( <a class="code" href="classhippodraw_1_1FontXML.html#a17b2ca2062cf6a07236943061bf64eb1" title="The point size attribute name.">m_size</a>, size ); <a name="l00065"></a>00065 font -> setPointSize ( size ); <a name="l00066"></a>00066 <a name="l00067"></a>00067 <span class="keywordtype">int</span> <a class="code" href="namespacehippodraw_1_1FontWeight.html#a103012df4b715f58a539b009a0b8b340">weight</a>; <a name="l00068"></a>00068 ok = element -> attribute ( <a class="code" href="classhippodraw_1_1FontXML.html#ad7630136f9ed9b266ef3057d11e5ccae" title="The font weight attribute name.">m_weight</a>, weight ); <a name="l00069"></a>00069 font -> setWeight ( weight ); <a name="l00070"></a>00070 <a name="l00071"></a>00071 } <a name="l00072"></a>00072 <a name="l00073"></a>00073 <a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7" title="Axes constants.">Axes::Type</a> <a name="l00074"></a>00074 <a class="code" href="classhippodraw_1_1FontXML.html#a544f2b3f7aea7602290c79a3cef3474e" title="Returns the axis on which the FontBase object was used.">FontXML::</a> <a name="l00075"></a><a class="code" href="classhippodraw_1_1FontXML.html#a544f2b3f7aea7602290c79a3cef3474e">00075</a> <a class="code" href="classhippodraw_1_1FontXML.html#a544f2b3f7aea7602290c79a3cef3474e" title="Returns the axis on which the FontBase object was used.">getAxis</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1XmlElement.html" title="A pure virtual base class of XML element wrapper.">XmlElement</a> * element, <span class="keyword">const</span> std::string & tagname ) <a name="l00076"></a>00076 { <a name="l00077"></a>00077 <span class="keywordtype">string</span> value; <a name="l00078"></a>00078 <span class="keywordtype">bool</span> ok = element -> attribute ( tagname, value ); <a name="l00079"></a>00079 assert ( ok ); <a name="l00080"></a>00080 <a name="l00081"></a>00081 <span class="keywordflow">return</span> <a class="code" href="namespacehippodraw_1_1Axes.html#ae2337bddf33bc8b17dd5c08e665422cd" title="Converts from string representation ot Axes::Type representation.">Axes::convert</a> ( value ); <a name="l00082"></a>00082 } <a name="l00083"></a>00083 <a name="l00084"></a>00084 } <span class="comment">// namespace hippodraw</span> <a name="l00085"></a>00085 </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>