• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

OXMLi_StreamListener.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 
00003 /* AbiSource
00004  *
00005  * Copyright (C) 2007 Philippe Milot <PhilMilot@gmail.com>
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00020  * 02110-1301 USA.
00021  */
00022 
00023 #ifndef _OXMLI_STREAMLISTENER_H_
00024 #define _OXMLI_STREAMLISTENER_H_
00025 
00026 // AbiWord includes
00027 #include <ut_types.h>
00028 #include <ut_xml.h>
00029 
00030 // Internal includes
00031 #include <OXMLi_Types.h>
00032 #include <OXMLi_ListenerState.h>
00033 #include <OXMLi_Namespace_Common.h>
00034 
00035 // External includes
00036 #include <list>
00037 
00038 // Forward declarations
00039 class OXMLi_ListenerState;
00040 
00041 /* \class OXMLi_StreamListener
00042  * \brief This is a listener for a UT_XML object.
00043  * OXMLi_StreamListener can parse any XML part of an OpenXML document thanks to its
00044  * ListenerStates.  In order to be able to parse a previously-unsupported part, all
00045  * that is needed is to write a new ListenerState class and include it in this class'
00046  * setupStates() method.
00047 */
00048 class OXMLi_StreamListener : public virtual UT_XML::Listener
00049 {
00050 public:
00051     OXMLi_StreamListener();
00052     virtual ~OXMLi_StreamListener();
00053 
00054     inline void setStatus(UT_Error sts) { m_parseStatus = sts; }
00055     inline UT_Error getStatus() { return m_parseStatus; }
00056 
00057     void setupStates(OXML_PartType type, const char * partId = "");
00058 
00059     virtual void startElement (const gchar* pName, const gchar** ppAtts);
00060     virtual void endElement (const gchar* pName);
00061     virtual void charData (const gchar* pBuffer, int length);
00062 
00063 private:
00064     OXMLi_ElementStack* m_pElemStack;
00065     OXMLi_SectionStack* m_pSectStack;
00066     OXMLi_ContextVector* m_context;
00067     std::list<OXMLi_ListenerState*> m_states;
00068     UT_Error m_parseStatus;
00069     OXMLi_Namespace_Common* m_namespaces;
00070 
00071     void pushState(OXMLi_ListenerState * s);
00072     void popState();
00073     void clearStates();
00074 
00075     void verifyStatus();
00076 };
00077 
00078 #endif //_OXMLI_STREAMLISTENER_H_
00079 

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1