00001 /* AbiSource 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_STARTTAG_H_ 00023 #define _ODi_STARTTAG_H_ 00024 00025 // AbiWord includes 00026 #include <ut_stringbuf.h> 00027 #include <ut_vector.h> 00028 00038 class ODi_StartTag { 00039 public: 00040 00041 ODi_StartTag(UT_uint32 attributeGrowStep=10); 00042 ~ODi_StartTag(); 00043 00044 void set(const gchar* pName, const gchar** ppAtts); 00045 00049 inline const char* getName() const {return m_name.data();} 00050 00051 inline UT_uint32 getAttributeCount() const {return m_attributeSize/2;} 00052 00057 const char* getAttributeValue(const char* rName ) const; 00058 00059 00060 00061 private: 00062 00063 UT_UTF8Stringbuf m_name; 00064 00065 // Even values are the attributes names and the odds are the values 00066 UT_UTF8Stringbuf* m_pAttributes; 00067 00068 // Used array slots for m_pAttributes 00069 UT_uint32 m_attributeSize; 00070 00071 // Allocated array slots for m_pAttributes 00072 UT_uint32 m_attributeMemSize; 00073 00074 UT_uint32 m_attributeGrowStep; 00075 00076 00077 void _growAttributes(); 00078 }; 00079 00080 #endif //_ODi_STARTTAG_H_