2 Copyright (c) 2001, Loki software, inc.
5 Redistribution and use in source and binary forms, with or without modification,
6 are permitted provided that the following conditions are met:
8 Redistributions of source code must retain the above copyright notice, this list
9 of conditions and the following disclaimer.
11 Redistributions in binary form must reproduce the above copyright notice, this
12 list of conditions and the following disclaimer in the documentation and/or
13 other materials provided with the distribution.
15 Neither the name of Loki software nor the names of its contributors may be used
16 to endorse or promote products derived from this software without specific prior
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
20 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
23 DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 //-----------------------------------------------------------------------------
34 // header for xml stuff used in radiant
40 #include "libxml/parser.h"
42 struct message_info_s;
47 virtual ~ISAXHandler() { }
48 virtual void saxStartElement( struct message_info_s *ctx, const xmlChar *name, const xmlChar **attrs ) = 0;
49 virtual void saxEndElement( struct message_info_s *ctx, const xmlChar *name ) = 0;
50 virtual void saxCharacters( struct message_info_s *ctx, const xmlChar *ch, int len ) = 0;
51 virtual char *getName() { return NULL; }
52 virtual void Highlight() { }
53 virtual void DropHighlight() { }
54 virtual bool ShouldDelete() { return true; } // should the handler be deleted when the feedback dialog is cleared?
57 // a 'user data' structure we pass along in the SAX callbacks to represent the current state
58 // the recurse value tracks the current depth in the tree
59 // message_info also stores information to exit the stream listening cleanly with an error:
60 // if msg_level == SYS_ERR, then we will reset the listening at the end of the current node
61 // the level for stopping the feed is stored in stop_depth
62 // unkown nodes are ignored, we use ignore_depth to track the level we start ignoring from
63 typedef struct message_info_s {
64 int msg_level; // current message level (SYS_MSG, SYS_WRN, SYS_ERR)
65 int recurse; // current recursion depth (used to track various things)
66 int ignore_depth; // the ignore depth limit when we are jumping over unknown nodes (0 means we are not ignoring)
67 int stop_depth; // the depth we need to stop at the end
68 bool bGeometry; // are we parsing some geometry information (i.e. do we forward the SAX calls?)
69 ISAXHandler *pGeometry; // the handler