Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Public Member Functions | Private Attributes
UniqueID Class Reference

This filter suppresses the output of. More...

#include <uniqueid.h>

Inheritance diagram for UniqueID:
Inheritance graph
[legend]
Collaboration diagram for UniqueID:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 UniqueID (SaxHandler *delegate)
virtual void begin (const Xml_string &tag, Xml_attr attr)
virtual void end (const Xml_string &tag)
virtual void chars (const Xml_string &text)
void setDelegate (SaxHandler *delegate)
SaxHandlerdelegate ()
virtual void beginDoc ()
virtual void endDoc ()
void beginEnd (const Xml_string &tag, Xml_attr attr)

Private Attributes

std::set< Xml_stringseenIDs
int level

Detailed Description

This filter suppresses the output of.

Definition at line 21 of file uniqueid.h.


Constructor & Destructor Documentation

UniqueID::UniqueID ( SaxHandler delegate) [inline]

Definition at line 23 of file uniqueid.h.

: SaxFilter(delegate), seenIDs(), level(0)  {}

Member Function Documentation

void UniqueID::begin ( const Xml_string tag,
Xml_attr  attr 
) [virtual]

Reimplemented from SaxFilter.

Definition at line 6 of file uniqueid.cpp.

{
       if (level > 0)  // skip mode
              ++level;
       else 
       {
              Xml_attr::iterator it = attr.find("id");
              if (it != attr.end() && seenIDs.find(Xml_data(it)) != seenIDs.end())
              {
                     // enter skip mode
                     level = 1;
                     // replace with  <tag idref="seenid" />
                     Xml_attr idattr;
                     idattr["idref"] = Xml_data(it);
                     SaxFilter::begin(tag, idattr);
                     SaxFilter::end(tag);
              }
              else 
              {
                     if (it != attr.end())
                            seenIDs.insert(Xml_data(it));
                     SaxFilter::begin(tag, attr);
              }
       }
}

Here is the call graph for this function:

void SaxFilter::beginDoc ( ) [virtual, inherited]

Implements SaxHandler.

Definition at line 5 of file saxfilter.cpp.

Here is the call graph for this function:

void SaxHandler::beginEnd ( const Xml_string tag,
Xml_attr  attr 
) [inline, inherited]

Definition at line 32 of file saxhandler.h.

{
       begin(tag, attr);
       end(tag);
}

Here is the call graph for this function:

void UniqueID::chars ( const Xml_string text) [virtual]

Reimplemented from SaxFilter.

Definition at line 41 of file uniqueid.cpp.

{
       if (level == 0)
              SaxFilter::chars(text);
}
SaxHandler* SaxFilter::delegate ( ) [inline, inherited]

Definition at line 24 of file saxfilter.h.

{ return m_delegate; }

Here is the caller graph for this function:

void UniqueID::end ( const Xml_string tag) [virtual]

Reimplemented from SaxFilter.

Definition at line 33 of file uniqueid.cpp.

{
       if (level > 0)  // skip mode
              --level;
       else
              SaxFilter::end(tag);
}

Here is the caller graph for this function:

void SaxFilter::endDoc ( ) [virtual, inherited]

Implements SaxHandler.

Definition at line 10 of file saxfilter.cpp.

Here is the call graph for this function:

void SaxFilter::setDelegate ( SaxHandler delegate) [inline, inherited]

Definition at line 23 of file saxfilter.h.

Here is the call graph for this function:


Member Data Documentation

int UniqueID::level [private]

Definition at line 29 of file uniqueid.h.

std::set<Xml_string> UniqueID::seenIDs [private]

Definition at line 28 of file uniqueid.h.


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