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

📄 tinyxml_8h-source.html

📁 XML解析器
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>tinyxml.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body bgcolor="#ffffff"><!-- Generated by Doxygen 1.2.11.1 --><center><a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; </center><hr><h1>tinyxml.h</h1><div class="fragment"><pre>00001 <font class="comment">/*</font>00002 <font class="comment">www.sourceforge.net/projects/tinyxml</font>00003 <font class="comment">Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)</font>00004 <font class="comment"></font>00005 <font class="comment">This software is provided 'as-is', without any express or implied</font>00006 <font class="comment">warranty. In no event will the authors be held liable for any</font>00007 <font class="comment">damages arising from the use of this software.</font>00008 <font class="comment"></font>00009 <font class="comment">Permission is granted to anyone to use this software for any</font>00010 <font class="comment">purpose, including commercial applications, and to alter it and</font>00011 <font class="comment">redistribute it freely, subject to the following restrictions:</font>00012 <font class="comment"></font>00013 <font class="comment">1. The origin of this software must not be misrepresented; you must</font>00014 <font class="comment">not claim that you wrote the original software. If you use this</font>00015 <font class="comment">software in a product, an acknowledgment in the product documentation</font>00016 <font class="comment">would be appreciated but is not required.</font>00017 <font class="comment"></font>00018 <font class="comment">2. Altered source versions must be plainly marked as such, and</font>00019 <font class="comment">must not be misrepresented as being the original software.</font>00020 <font class="comment"></font>00021 <font class="comment">3. This notice may not be removed or altered from any source</font>00022 <font class="comment">distribution.</font>00023 <font class="comment">*/</font>00024 00025 00026 <font class="preprocessor">#ifndef TINYXML_INCLUDED</font>00027 <font class="preprocessor"></font><font class="preprocessor">#define TINYXML_INCLUDED</font>00028 <font class="preprocessor"></font>00029 <font class="preprocessor">#ifdef _MSC_VER</font>00030 <font class="preprocessor"></font><font class="preprocessor">#pragma warning( disable : 4530 )</font>00031 <font class="preprocessor"></font><font class="preprocessor">#pragma warning( disable : 4786 )</font>00032 <font class="preprocessor"></font><font class="preprocessor">#endif</font>00033 <font class="preprocessor"></font>00034 <font class="preprocessor">#include &lt;ctype.h&gt;</font>00035 <font class="preprocessor">#include &lt;stdio.h&gt;</font>00036 <font class="preprocessor">#include &lt;stdlib.h&gt;</font>00037 <font class="preprocessor">#include &lt;string.h&gt;</font>00038 <font class="preprocessor">#include &lt;assert.h&gt;</font>00039 00040 <font class="comment">// Help out windows:</font>00041 <font class="preprocessor">#if defined( _DEBUG ) &amp;&amp; !defined( DEBUG )</font>00042 <font class="preprocessor"></font><font class="preprocessor">#define DEBUG</font>00043 <font class="preprocessor"></font><font class="preprocessor">#endif</font>00044 <font class="preprocessor"></font>00045 <font class="preprocessor">#if defined( DEBUG ) &amp;&amp; defined( _MSC_VER )</font>00046 <font class="preprocessor"></font><font class="preprocessor">#include &lt;windows.h&gt;</font>00047 <font class="preprocessor">#define TIXML_LOG OutputDebugString</font>00048 <font class="preprocessor"></font><font class="preprocessor">#else</font>00049 <font class="preprocessor"></font><font class="preprocessor">#define TIXML_LOG printf</font>00050 <font class="preprocessor"></font><font class="preprocessor">#endif</font>00051 <font class="preprocessor"></font>00052 <font class="comment">// Uncomment the following definition for Apple's Project Builder </font>00053 <font class="comment">// #define TIXML_NEED_STREAM</font>00054 00055 <font class="preprocessor">#ifdef TIXML_USE_STL</font>00056 <font class="preprocessor"></font><font class="preprocessor">    #include &lt;string&gt;</font>00057 <font class="preprocessor">    #ifdef TIXML_NEED_STREAM</font>00058 <font class="preprocessor"></font><font class="preprocessor">        #include &lt;istream&gt;</font>00059 <font class="preprocessor">        #include &lt;ostream&gt;</font>00060 <font class="preprocessor">    #endif</font>00061 <font class="preprocessor"></font><font class="preprocessor">    #define TIXML_STRING    std::string</font>00062 <font class="preprocessor"></font><font class="preprocessor">    #define TIXML_ISTREAM   std::istream</font>00063 <font class="preprocessor"></font><font class="preprocessor">    #define TIXML_OSTREAM   std::ostream</font>00064 <font class="preprocessor"></font><font class="preprocessor">#else</font>00065 <font class="preprocessor"></font><font class="preprocessor">    #include "tinystr.h"</font>00066 <font class="preprocessor">    #define TIXML_STRING    TiXmlString</font>00067 <font class="preprocessor"></font><font class="preprocessor">    #define TIXML_OSTREAM   TiXmlOutStream</font>00068 <font class="preprocessor"></font><font class="preprocessor">#endif</font>00069 <font class="preprocessor"></font>00070 <font class="keyword">class </font><a class="code" href="classTiXmlDocument.html">TiXmlDocument</a>;00071 <font class="keyword">class </font><a class="code" href="classTiXmlElement.html">TiXmlElement</a>;00072 <font class="keyword">class </font><a class="code" href="classTiXmlComment.html">TiXmlComment</a>;00073 <font class="keyword">class </font><a class="code" href="classTiXmlUnknown.html">TiXmlUnknown</a>;00074 <font class="keyword">class </font><a class="code" href="classTiXmlAttribute.html">TiXmlAttribute</a>;00075 <font class="keyword">class </font><a class="code" href="classTiXmlText.html">TiXmlText</a>;00076 <font class="keyword">class </font><a class="code" href="classTiXmlDeclaration.html">TiXmlDeclaration</a>;00077 00078 <a name="l00101"></a><a class="code" href="classTiXmlBase.html">00101</a> <font class="keyword">class </font><a class="code" href="classTiXmlBase.html">TiXmlBase</a>00102 {00103     <font class="keyword">friend</font> <font class="keyword">class </font><a class="code" href="classTiXmlNode.html">TiXmlNode</a>;00104     <font class="keyword">friend</font> <font class="keyword">class </font><a class="code" href="classTiXmlElement.html">TiXmlElement</a>;00105     <font class="keyword">friend</font> <font class="keyword">class </font><a class="code" href="classTiXmlDocument.html">TiXmlDocument</a>;00106 00107 <font class="keyword">public</font>:00108     TiXmlBase()<font class="keyword">                             </font>{}00109     <font class="keyword">virtual</font> ~TiXmlBase()<font class="keyword">                    </font>{}00110 00116     <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classTiXmlBase.html#a2">Print</a>( FILE* cfile, <font class="keywordtype">int</font> depth ) <font class="keyword">const</font> = 0;00117 <a name="l00124"></a><a class="code" href="classTiXmlBase.html#d0">00124</a>     <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="classTiXmlBase.html#d0">SetCondenseWhiteSpace</a>( <font class="keywordtype">bool</font> condense )<font class="keyword">      </font>{ condenseWhiteSpace = condense; }00125 <a name="l00127"></a><a class="code" href="classTiXmlBase.html#d1">00127</a>     <font class="keyword">static</font> <font class="keywordtype">bool</font> <a class="code" href="classTiXmlBase.html#d1">IsWhiteSpaceCondensed</a>()<font class="keyword">                     </font>{ <font class="keywordflow">return</font> condenseWhiteSpace; }00128 00129 <font class="keyword">protected</font>:00130     <font class="comment">// See STL_STRING_BUG</font>00131     <font class="comment">// Utility class to overcome a bug.</font>00132     <font class="keyword">class </font>StringToBuffer00133     {00134       <font class="keyword">public</font>:00135         StringToBuffer( <font class="keyword">const</font> TIXML_STRING&amp; str );00136         ~StringToBuffer();00137         <font class="keywordtype">char</font>* buffer;00138     };00139 00140     <font class="keyword">static</font> <font class="keyword">const</font> <font class="keywordtype">char</font>*  SkipWhiteSpace( <font class="keyword">const</font> <font class="keywordtype">char</font>* );00141     <font class="keyword">inline</font> <font class="keyword">static</font> <font class="keywordtype">bool</font>  IsWhiteSpace( <font class="keywordtype">int</font> c )<font class="keyword">       </font>{ <font class="keywordflow">return</font> ( isspace( c ) || c == <font class="charliteral">'\n'</font> || c == <font class="charliteral">'\r'</font> ); }00142 00143     <font class="keyword">virtual</font> <font class="keywordtype">void</font> StreamOut (TIXML_OSTREAM *) <font class="keyword">const</font> = 0;00144 00145     #ifdef TIXML_USE_STL00146         <font class="keyword">static</font> <font class="keywordtype">bool</font> StreamWhiteSpace( TIXML_ISTREAM * in, TIXML_STRING * tag );00147         <font class="keyword">static</font> <font class="keywordtype">bool</font> StreamTo( TIXML_ISTREAM * in, <font class="keywordtype">int</font> character, TIXML_STRING * tag );00148 <font class="preprocessor">    #endif</font>00149 <font class="preprocessor"></font>00150     <font class="comment">/*  Reads an XML name into the string provided. Returns</font>00151 <font class="comment">        a pointer just past the last character of the name,</font>00152 <font class="comment">        or 0 if the function has an error.</font>00153 <font class="comment">    */</font>00154     <font class="keyword">static</font> <font class="keyword">const</font> <font class="keywordtype">char</font>* ReadName( <font class="keyword">const</font> <font class="keywordtype">char</font>* p, TIXML_STRING* name );00155 00156     <font class="comment">/*  Reads text. Returns a pointer past the given end tag.</font>00157 <font class="comment">        Wickedly complex options, but it keeps the (sensitive) code in one place.</font>00158 <font class="comment">    */</font>00159     <font class="keyword">static</font> <font class="keyword">const</font> <font class="keywordtype">char</font>* ReadText(    <font class="keyword">const</font> <font class="keywordtype">char</font>* in,             <font class="comment">// where to start</font>00160                                     TIXML_STRING* text,         <font class="comment">// the string read</font>00161                                     <font class="keywordtype">bool</font> ignoreWhiteSpace,      <font class="comment">// whether to keep the white space</font>00162                                     <font class="keyword">const</font> <font class="keywordtype">char</font>* endTag,         <font class="comment">// what ends this text</font>00163                                     <font class="keywordtype">bool</font> ignoreCase );          <font class="comment">// whether to ignore case in the end tag</font>00164     <font class="keyword">virtual</font> <font class="keyword">const</font> <font class="keywordtype">char</font>* Parse( <font class="keyword">const</font> <font class="keywordtype">char</font>* p ) = 0;00165 00166     <font class="comment">// If an entity has been found, transform it into a character.</font>

⌨️ 快捷键说明

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