1 /* AbiSource
2  *
3  * Copyright (C) 2005 Daniel d'Andrada T. de Carvalho
4  * <daniel.carvalho@indt.org.br>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301 USA.
20  */
21 
22 #ifndef _ODI_LISTENERSTATE_H_
23 #define _ODI_LISTENERSTATE_H_
24 
25 // AbiWord includes
26 #include <ut_types.h>
27 #include <ut_string_class.h>
28 
29 // Internal classes
30 class ODi_ListenerStateAction;
31 class ODi_ElementStack;
32 
33 
34 /**
35  * Base class for all ODi_*_ListenerState classes.
36  */
37 class ODi_ListenerState {
38 
39 public:
40 
ODi_ListenerState(const char * pStateName,ODi_ElementStack & rElementStack)41     ODi_ListenerState(const char* pStateName, ODi_ElementStack& rElementStack)
42     	: m_stateName(pStateName), m_rElementStack(rElementStack) {}
43 
~ODi_ListenerState()44     virtual ~ODi_ListenerState() {}
45 
46     virtual void startElement (const gchar* pName, const gchar** ppAtts,
47                                ODi_ListenerStateAction& rAction) = 0;
48 
49     virtual void endElement (const gchar* pName,
50                              ODi_ListenerStateAction& rAction) = 0;
51 
52     virtual void charData (const gchar* pBuffer, int length) = 0;
53 
getStateName()54     const UT_String& getStateName() const {return m_stateName;}
55 
56 protected:
57 
58     UT_String m_stateName;
59     ODi_ElementStack& m_rElementStack;
60 };
61 
62 #endif //_ODI_LISTENERSTATE_H_
63