PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: XmlDeclaration.h * 00003 * 00004 * Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/) 00005 * 00006 * This file is part of PixelLight. 00007 * 00008 * PixelLight is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * PixelLight is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with PixelLight. If not, see <http://www.gnu.org/licenses/>. 00020 \*********************************************************/ 00021 00022 00023 #ifndef __PLCORE_XML_DECLARATION_H__ 00024 #define __PLCORE_XML_DECLARATION_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include "PLCore/Xml/XmlNode.h" 00032 00033 00034 //[-------------------------------------------------------] 00035 //[ Namespace ] 00036 //[-------------------------------------------------------] 00037 namespace PLCore { 00038 00039 00040 //[-------------------------------------------------------] 00041 //[ Classes ] 00042 //[-------------------------------------------------------] 00043 /** 00044 * @brief 00045 * XML declaration node 00046 * 00047 * @remarks 00048 * In correct XML the declaration is the first entry in the file. 00049 * @verbatim 00050 * <?xml version="1.0" standalone="yes"?> 00051 * @endverbatim 00052 * 00053 * The parser will happily read or write files without a declaration, 00054 * however. There are 3 possible attributes to the declaration: 00055 * version, encoding, and standalone. 00056 * 00057 * @note 00058 * - In this version of the code, the attributes are handled as special cases, not 00059 * generic attributes, simply because there can only be at most 3 and they are 00060 * always the same. 00061 */ 00062 class XmlDeclaration : public XmlNode { 00063 00064 00065 //[-------------------------------------------------------] 00066 //[ Friends ] 00067 //[-------------------------------------------------------] 00068 friend class XmlNode; 00069 00070 00071 //[-------------------------------------------------------] 00072 //[ Public functions ] 00073 //[-------------------------------------------------------] 00074 public: 00075 /** 00076 * @brief 00077 * Default constructor 00078 */ 00079 PLCORE_API XmlDeclaration(); 00080 00081 /** 00082 * @brief 00083 * Copy constructor 00084 * 00085 * @param[in] cSource 00086 * Source to copy from 00087 */ 00088 PLCORE_API XmlDeclaration(const XmlDeclaration &cSource); 00089 00090 /** 00091 * @brief 00092 * Constructor 00093 * 00094 * @param[in] sVersion 00095 * Version 00096 * @param[in] sEncoding 00097 * Encoding 00098 * @param[in] sStandalone 00099 * Standalone 00100 */ 00101 PLCORE_API XmlDeclaration(const String &sVersion, const String &sEncoding, const String &sStandalone); 00102 00103 /** 00104 * @brief 00105 * Destructor 00106 */ 00107 PLCORE_API virtual ~XmlDeclaration(); 00108 00109 /** 00110 * @brief 00111 * Copy operator 00112 * 00113 * @param[in] cSource 00114 * Source to copy from 00115 * 00116 * @return 00117 * Reference to this instance 00118 */ 00119 PLCORE_API XmlDeclaration &operator =(const XmlDeclaration &cSource); 00120 00121 /** 00122 * @brief 00123 * Version - will return an empty string if none was found 00124 * 00125 * @return 00126 * Version - will return an empty string if none was found 00127 */ 00128 inline String GetVersion() const; 00129 00130 /** 00131 * @brief 00132 * Encoding - will return an empty string if none was found 00133 * 00134 * @return 00135 * Encoding - will return an empty string if none was found 00136 */ 00137 inline String GetEncoding() const; 00138 00139 /** 00140 * @brief 00141 * Standalone - will return an empty string if none was found 00142 * 00143 * @return 00144 * Standalone - will return an empty string if none was found 00145 */ 00146 inline String GetStandalone() const; 00147 00148 00149 //[-------------------------------------------------------] 00150 //[ Public virtual XmlBase functions ] 00151 //[-------------------------------------------------------] 00152 public: 00153 PLCORE_API virtual bool Save(File &cFile, uint32 nDepth = 0) override; 00154 PLCORE_API virtual String ToString(uint32 nDepth = 0) const override; 00155 PLCORE_API virtual const char *Parse(const char *pszData, XmlParsingData *pData = nullptr, EEncoding nEncoding = EncodingUnknown) override; 00156 00157 00158 //[-------------------------------------------------------] 00159 //[ Public virtual XmlNode functions ] 00160 //[-------------------------------------------------------] 00161 public: 00162 PLCORE_API virtual XmlNode *Clone() const override; 00163 00164 00165 //[-------------------------------------------------------] 00166 //[ Private data ] 00167 //[-------------------------------------------------------] 00168 private: 00169 String m_sVersion; /**< Version */ 00170 String m_sEncoding; /**< Encoding */ 00171 String m_sStandalone; /**< Standalone */ 00172 00173 00174 }; 00175 00176 00177 //[-------------------------------------------------------] 00178 //[ Namespace ] 00179 //[-------------------------------------------------------] 00180 } // PLCore 00181 00182 00183 //[-------------------------------------------------------] 00184 //[ Implementation ] 00185 //[-------------------------------------------------------] 00186 #include "PLCore/Xml/XmlDeclaration.inl" 00187 00188 00189 #endif // __PLCORE_XML_DECLARATION_H__
|