00001 /* AbiSource Program Utilities 00002 * 00003 * Copyright (C) 2005 Daniel d'Andrada T. de Carvalho 00004 * <daniel.carvalho@indt.org.br> 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00019 * 02110-1301 USA. 00020 */ 00021 00022 #ifndef _ODI_ELEMENTSTACK_H_ 00023 #define _ODI_ELEMENTSTACK_H_ 00024 00025 // AbiWord includes 00026 #include <ut_types.h> 00027 #include <ut_vector.h> 00028 00029 // Internal classes 00030 class ODi_StartTag; 00031 00032 00058 class ODi_ElementStack { 00059 00060 public: 00061 00062 ODi_ElementStack(); 00063 ~ODi_ElementStack(); 00064 00072 const ODi_StartTag* getStartTag(UT_sint32 level); 00073 00074 bool hasElement(const gchar* pName) const; 00075 00079 UT_sint32 getElementLevel(const gchar* pName) const; 00080 00088 const ODi_StartTag* getClosestElement(const gchar* pName, 00089 UT_sint32 fromLevel = 0) const; 00090 00091 00092 void startElement (const gchar* pName, const gchar** ppAtts); 00093 void endElement (const gchar* pName); 00094 bool isEmpty() const {return m_stackSize==0;} 00095 void clear() {m_stackSize = 0;} 00096 00097 UT_sint32 getStackSize() const {return m_stackSize;} 00098 00099 00100 private: 00101 00102 UT_GenericVector <ODi_StartTag*>* m_pStartTags; 00103 UT_sint32 m_stackSize; 00104 }; 00105 00106 #endif //_ODI_ELEMENTSTACK_H_