GDAL
cpl_minixml.h
Go to the documentation of this file.
00001 /**********************************************************************
00002  * $Id: cpl_minixml.h 35921 2016-10-25 02:28:29Z goatbar $
00003  *
00004  * Project:  CPL - Common Portability Library
00005  * Purpose:  Declarations for MiniXML Handler.
00006  * Author:   Frank Warmerdam, warmerdam@pobox.com
00007  *
00008  **********************************************************************
00009  * Copyright (c) 2001, Frank Warmerdam
00010  *
00011  * Permission is hereby granted, free of charge, to any person obtaining a
00012  * copy of this software and associated documentation files (the "Software"),
00013  * to deal in the Software without restriction, including without limitation
00014  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00015  * and/or sell copies of the Software, and to permit persons to whom the
00016  * Software is furnished to do so, subject to the following conditions:
00017  *
00018  * The above copyright notice and this permission notice shall be included
00019  * in all copies or substantial portions of the Software.
00020  *
00021  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00022  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00023  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00024  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00025  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00026  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00027  * DEALINGS IN THE SOFTWARE.
00028  ****************************************************************************/
00029 
00030 #ifndef CPL_MINIXML_H_INCLUDED
00031 #define CPL_MINIXML_H_INCLUDED
00032 
00033 #include "cpl_port.h"
00034 
00041 CPL_C_START
00042 
00044 typedef enum
00045 {           CXT_Element = 0,     CXT_Text = 1,            CXT_Attribute = 2,      CXT_Comment = 3,    CXT_Literal = 4
00051 } CPLXMLNodeType;
00052 
00066 typedef struct CPLXMLNode
00067 {
00074     CPLXMLNodeType      eType;
00075 
00097     char                *pszValue;
00098 
00106     struct CPLXMLNode  *psNext;
00107 
00118     struct CPLXMLNode  *psChild;
00119 } CPLXMLNode;
00120 
00121 CPLXMLNode CPL_DLL *CPLParseXMLString( const char * );
00122 void       CPL_DLL  CPLDestroyXMLNode( CPLXMLNode * );
00123 CPLXMLNode CPL_DLL *CPLGetXMLNode( CPLXMLNode *poRoot,
00124                                    const char *pszPath );
00125 CPLXMLNode CPL_DLL *CPLSearchXMLNode( CPLXMLNode *poRoot,
00126                                       const char *pszTarget );
00127 const char CPL_DLL *CPLGetXMLValue( CPLXMLNode *poRoot,
00128                                     const char *pszPath,
00129                                     const char *pszDefault );
00130 CPLXMLNode CPL_DLL *CPLCreateXMLNode( CPLXMLNode *poParent,
00131                                       CPLXMLNodeType eType,
00132                                       const char *pszText );
00133 char       CPL_DLL *CPLSerializeXMLTree( const CPLXMLNode *psNode );
00134 void       CPL_DLL  CPLAddXMLChild( CPLXMLNode *psParent,
00135                                     CPLXMLNode *psChild );
00136 int        CPL_DLL  CPLRemoveXMLChild( CPLXMLNode *psParent,
00137                                        CPLXMLNode *psChild );
00138 void       CPL_DLL  CPLAddXMLSibling( CPLXMLNode *psOlderSibling,
00139                                       CPLXMLNode *psNewSibling );
00140 CPLXMLNode CPL_DLL *CPLCreateXMLElementAndValue( CPLXMLNode *psParent,
00141                                                  const char *pszName,
00142                                                  const char *pszValue );
00143 void       CPL_DLL CPLAddXMLAttributeAndValue( CPLXMLNode *psParent,
00144                                                  const char *pszName,
00145                                                  const char *pszValue );
00146 CPLXMLNode CPL_DLL *CPLCloneXMLTree( CPLXMLNode *psTree );
00147 int        CPL_DLL CPLSetXMLValue( CPLXMLNode *psRoot,  const char *pszPath,
00148                                    const char *pszValue );
00149 void       CPL_DLL CPLStripXMLNamespace( CPLXMLNode *psRoot,
00150                                          const char *pszNameSpace,
00151                                          int bRecurse );
00152 void       CPL_DLL CPLCleanXMLElementName( char * );
00153 
00154 CPLXMLNode CPL_DLL *CPLParseXMLFile( const char *pszFilename );
00155 int        CPL_DLL CPLSerializeXMLTreeToFile( const CPLXMLNode *psTree,
00156                                               const char *pszFilename );
00157 
00158 CPL_C_END
00159 
00160 #ifdef __cplusplus
00161 
00164 class CPLXMLTreeCloser {
00165  public:
00167   explicit CPLXMLTreeCloser(CPLXMLNode* data) { the_data_ = data; }
00168 
00170   ~CPLXMLTreeCloser() {
00171     if (the_data_) CPLDestroyXMLNode(the_data_);
00172   }
00173 
00177   CPLXMLNode* get() const { return the_data_; }
00178 
00182   CPLXMLNode* operator->() const { return get(); }
00183 
00184  private:
00185   CPLXMLNode* the_data_;
00186 };
00187 #endif /* __cplusplus */
00188 
00189 #endif /* CPL_MINIXML_H_INCLUDED */

Generated for GDAL by doxygen 1.7.6.1.