2 Copyright (C) 2006, Stefan Greven.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #if !defined( INCLUDED_XMLTEXTAGS_H )
23 #define INCLUDED_XMLTEXTAGS_H
26 #include <string/string.h>
29 #include "iscriplib.h"
31 #include <libxml/xpath.h>
32 #include <libxml/xmlwriter.h>
55 CopiedString m_savefilename;
57 xmlXPathContextPtr context;
59 xmlXPathObjectPtr XpathEval( const char* queryString ){
60 xmlChar* expression = (xmlChar*)queryString;
61 xmlXPathObjectPtr result = xmlXPathEvalExpression( expression, context );
65 char* GetTagsXpathExpression( char* buffer, const char* shader, NodeTagType nodeTagType ){
66 strcpy( buffer, "/root/*/*[@path='" );
67 strcat( buffer, shader );
69 switch ( nodeTagType )
72 strcat( buffer, "']/tag" );
75 strcat( buffer, "']" );
85 bool CreateXmlDocument();
86 bool OpenXmlDoc( const char* file, const char* savefile = 0 );
87 bool SaveXmlDoc( const char* file );
88 bool SaveXmlDoc( void );
89 bool AddShaderNode( const char* shader, TextureType textureType, NodeShaderType nodeShaderType );
90 bool DeleteShaderNode( const char* shader );
91 bool CheckShaderTag( const char* shader );
92 bool CheckShaderTag( const char* shader, const char* content );
93 bool AddShaderTag( const char* shader, const char* content, NodeTagType nodeTagType );
94 bool DeleteTag( const char* tag );
95 int RenameShaderTag( const char* oldtag, CopiedString newtag );
96 bool DeleteShaderTag( const char* shader, const char* tag );
97 void GetShaderTags( const char* shader, std::vector<CopiedString>& tags );
98 void GetUntagged( std::set<CopiedString>& shaders );
99 void GetAllTags( std::set<CopiedString>& tags );
100 void TagSearch( const char* expression, std::set<CopiedString>& paths );