Public Member Functions | Private Attributes

ODi_ElementStack Class Reference

This class stores info about the parent elements of the current element being parsed. More...

#include <ODi_ElementStack.h>

List of all members.

Public Member Functions

 ODi_ElementStack ()
 Constructor.
 ~ODi_ElementStack ()
 Destructor.
const ODi_StartTaggetStartTag (UT_sint32 level)
bool hasElement (const gchar *pName) const
UT_sint32 getElementLevel (const gchar *pName) const
 Returns the level of the closest element with the given name.
const ODi_StartTaggetClosestElement (const gchar *pName, UT_sint32 fromLevel=0) const
 Returns the closest parent with the given name.
void startElement (const gchar *pName, const gchar **ppAtts)
 Must be the last command called by the starElement method of the listener class.
void endElement (const gchar *pName)
 Must be the last command called by the endElement method of the listener class.
bool isEmpty () const
void clear ()
UT_sint32 getStackSize () const

Private Attributes

UT_GenericVector< ODi_StartTag * > * m_pStartTags
UT_sint32 m_stackSize

Detailed Description

This class stores info about the parent elements of the current element being parsed.

Example:

If you are parsing the <style:footnote-sep/> element, this class will hold info about its parents. On this case: <style:page-layout-properties>, <style:page-layout> and <office:automatic-styles>.

<office:automatic-styles> <style:page-layout> <style:page-layout-properties> <style:footnote-sep/> </style:page-layout-properties> </style:page-layout> </office:automatic-styles>

When parsing a start element tag, level 0 is the parent element.

When parsing a start element tag, level 0 is its own element, with level 1 being the parent and so on.


Constructor & Destructor Documentation

ODi_ElementStack::ODi_ElementStack (  ) 

Constructor.

ODi_ElementStack::~ODi_ElementStack (  ) 

Destructor.

References DELETEP, m_pStartTags, and UT_VECTOR_PURGEALL.


Member Function Documentation

void ODi_ElementStack::clear ( void   )  [inline]

References m_stackSize.

void ODi_ElementStack::endElement ( const gchar *  pName  ) 

Must be the last command called by the endElement method of the listener class.

References m_pStartTags, m_stackSize, UT_ASSERT, and UT_return_if_fail.

Referenced by ODi_StreamListener::_endElement().

const ODi_StartTag * ODi_ElementStack::getClosestElement ( const gchar *  pName,
UT_sint32  fromLevel = 0 
) const

Returns the closest parent with the given name.

It returns NULL if there is no parent with the given name.

Parameters:
pName Element name.
fromLevel The level from which the search begins.

References ODi_StartTag::getName(), m_pStartTags, and m_stackSize.

Referenced by ODi_TextContent_ListenerState::_insureInSection(), and ODi_TextContent_ListenerState::_startParagraphElement().

UT_sint32 ODi_ElementStack::getElementLevel ( const gchar *  pName  )  const

Returns the level of the closest element with the given name.

References ODi_StartTag::getName(), m_pStartTags, m_stackSize, UT_ASSERT_HARMLESS, and UT_SHOULD_NOT_HAPPEN.

UT_sint32 ODi_ElementStack::getStackSize (  )  const [inline]
const ODi_StartTag * ODi_ElementStack::getStartTag ( UT_sint32  level  ) 
bool ODi_ElementStack::hasElement ( const gchar *  pName  )  const
bool ODi_ElementStack::isEmpty (  )  const [inline]

References m_stackSize.

void ODi_ElementStack::startElement ( const gchar *  pName,
const gchar **  ppAtts 
)

Must be the last command called by the starElement method of the listener class.

References UT_GenericVector< T >::getItemCount(), m_pStartTags, m_stackSize, UT_GenericVector< T >::push_back(), ODi_StartTag::set(), UT_ASSERT_HARMLESS, and UT_SHOULD_NOT_HAPPEN.

Referenced by ODi_StreamListener::_startElement().


Member Data Documentation


The documentation for this class was generated from the following files: