⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class_xml_element.html

📁 c++开发的一个不错的工具
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<html><head><title>CppUnit - The Unit Testing Library</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body bgcolor="#ffffff"> <table width="100%">  <tr>    <td width="40%" align="left" valign="center">      <a href="http://sourceforge.net/projects/cppunit">      CppUnit project page      </a>    </td>    <td>      <a href="FAQ">FAQ</a>    </td>    <td width="40%" align="right" valign="center">      <a href="http://cppunit.sourceforge.net">CppUnit home page</a>    </td>  </tr></table><hr><!-- Generated by Doxygen 1.3.7 --><div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div><h1>XmlElement Class Reference</h1>A XML Element.  <a href="#_details">More...</a><p><code>#include &lt;<a class="el" href="_xml_element_8h-source.html">XmlElement.h</a>&gt;</code><p><a href="class_xml_element-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#a0">XmlElement</a> (std::string elementName, std::string content="")</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructs an element with the specified name and string content.  <a href="#a0"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#a1">XmlElement</a> (std::string elementName, int numericContent)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructs an element with the specified name and numeric content.  <a href="#a1"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#a2">~XmlElement</a> ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructs the element and its child elements.  <a href="#a2"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>std::string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#a3">name</a> () const</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the name of the element.  <a href="#a3"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>std::string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#a4">content</a> () const</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the content of the element.  <a href="#a4"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#a5">setName</a> (const std::string &amp;name)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the name of the element.  <a href="#a5"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#a6">setContent</a> (const std::string &amp;content)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the content of the element.  <a href="#a6"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#a7">setContent</a> (int numericContent)</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#a8">addAttribute</a> (std::string attributeName, std::string value)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Adds an attribute with the specified string value.  <a href="#a8"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#a9">addAttribute</a> (std::string attributeName, int numericValue)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Adds an attribute with the specified numeric value.  <a href="#a9"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#a10">addElement</a> (<a class="el" href="class_xml_element.html">XmlElement</a> *element)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Adds a child element to the element.  <a href="#a10"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#a11">elementCount</a> () const</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the number of child elements.  <a href="#a11"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="class_xml_element.html">XmlElement</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#a12">elementAt</a> (int index) const</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the child element at the specified index.  <a href="#a12"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="class_xml_element.html">XmlElement</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#a13">elementFor</a> (const std::string &amp;name) const</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the first child element with the specified name.  <a href="#a13"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>std::string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#a14">toString</a> (const std::string &amp;indent="") const</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns a XML string that represents the element.  <a href="#a14"></a><br><br></td></tr><tr><td colspan=2><br><h2>Private Types</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::pair&lt; std::string,<br> std::string &gt;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#y0">Attribute</a></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>typedef CppUnitDeque&lt; <a class="el" href="class_xml_element.html#y0">Attribute</a> &gt;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#y1">Attributes</a></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>typedef CppUnitDeque&lt; <a class="el" href="class_xml_element.html">XmlElement</a> * &gt;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#y2">Elements</a></td></tr><tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>std::string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#d0">attributesAsString</a> () const</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>std::string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#d1">escape</a> (std::string value) const</td></tr><tr><td colspan=2><br><h2>Private Attributes</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>std::string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#r0">m_name</a></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>std::string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#r1">m_content</a></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="class_xml_element.html#y1">Attributes</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#r2">m_attributes</a></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="class_xml_element.html#y2">Elements</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="class_xml_element.html#r3">m_elements</a></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>A XML Element. <p>A XML element has:<ul><li>a name, specified on construction,</li><li>a content, specified on construction (may be empty),</li><li>zero or more attributes, added with addAttribute(),</li><li>zero or more child elements, added with addElement(). </li></ul><p><hr><h2>Member Typedef Documentation</h2><a class="anchor" name="y0" doxytag="XmlElement::Attribute" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> typedef std::pair&lt;std::string,std::string&gt; <a class="el" href="class_xml_element.html#y0">XmlElement::Attribute</a><code> [private]</code>          </td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>    </td>  </tr></table><a class="anchor" name="y1" doxytag="XmlElement::Attributes" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> typedef CppUnitDeque&lt;<a class="el" href="class_xml_element.html#y0">Attribute</a>&gt; <a class="el" href="class_xml_element.html#y1">XmlElement::Attributes</a><code> [private]</code>          </td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>    </td>  </tr></table><a class="anchor" name="y2" doxytag="XmlElement::Elements" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> typedef CppUnitDeque&lt;<a class="el" href="class_xml_element.html">XmlElement</a> *&gt; <a class="el" href="class_xml_element.html#y2">XmlElement::Elements</a><code> [private]</code>          </td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>    </td>  </tr></table><hr><h2>Constructor &amp; Destructor Documentation</h2><a class="anchor" name="a0" doxytag="XmlElement::XmlElement" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> CPPUNIT_NS_BEGIN XmlElement::XmlElement           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">std::string&nbsp;</td>          <td class="mdname" nowrap> <em>elementName</em>, </td>        </tr>        <tr>          <td class="md" nowrap align="right"></td>          <td></td>          <td class="md" nowrap>std::string&nbsp;</td>          <td class="mdname" nowrap> <em>content</em> = <code>""</code></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Constructs an element with the specified name and string content. <p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td></td><td valign=top><em>elementName</em>&nbsp;</td><td>Name of the element. Must not be empty. </td></tr>    <tr><td></td><td valign=top><em>content</em>&nbsp;</td><td>Content of the element. </td></tr>  </table></dl>    </td>  </tr></table><a class="anchor" name="a1" doxytag="XmlElement::XmlElement" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> XmlElement::XmlElement           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">std::string&nbsp;</td>          <td class="mdname" nowrap> <em>elementName</em>, </td>        </tr>        <tr>          <td class="md" nowrap align="right"></td>          <td></td>          <td class="md" nowrap>int&nbsp;</td>          <td class="mdname" nowrap> <em>numericContent</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Constructs an element with the specified name and numeric content. <p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td></td><td valign=top><em>elementName</em>&nbsp;</td><td>Name of the element. Must not be empty. </td></tr>    <tr><td></td><td valign=top><em>numericContent</em>&nbsp;</td><td>Content of the element. </td></tr>  </table></dl>    </td>  </tr></table><a class="anchor" name="a2" doxytag="XmlElement::~XmlElement" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> XmlElement::~<a class="el" href="class_xml_element.html">XmlElement</a>           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap><code> [virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Destructs the element and its child elements. <p>    </td>  </tr></table><hr><h2>Member Function Documentation</h2>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -