Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
desaxe::IdRef_body< Obj_Type > Class Template Reference

This applies "id" and "idref" attributes to the object on top of the stack. More...

#include <simple_actions.h>

Inheritance diagram for desaxe::IdRef_body< Obj_Type >:
Inheritance graph
[legend]
Collaboration diagram for desaxe::IdRef_body< Obj_Type >:
Collaboration graph
[legend]

List of all members.

Classes

struct  Mode

Public Member Functions

 IdRef_body ()
void begin (const Xml_string &, Xml_attr attr)
void end (const Xml_string &)

Protected Member Functions

virtual void chars (const Xml_string &)

Protected Attributes

Digesterdig

Private Attributes

std::vector< Modestack

Detailed Description

template<class Obj_Type>
class desaxe::IdRef_body< Obj_Type >

This applies "id" and "idref" attributes to the object on top of the stack.

In case of an "id" attribute, if there is no entry with this ID in the digester's storage, the topmost object is stored there. Otherwise the topmost object is replaced with the stored object. In case of an "idref" attribute, if there is no entry with this ID in the digester's storage, the topmost object is also stored there. Then the trigger "WithinIdRef" is set during begin() and the processing continues normally. When end() is called, the topmost object is replaced by the stored one (this will be a no-op if there wasnt an entry in storage before)

Definition at line 614 of file simple_actions.h.


Class Documentation

struct desaxe::IdRef_body::Mode

template<class Obj_Type>
struct desaxe::IdRef_body< Obj_Type >::Mode

Definition at line 675 of file simple_actions.h.

Class Members
Xml_string ID
bool isIdRef

Constructor & Destructor Documentation

template<class Obj_Type >
desaxe::IdRef_body< Obj_Type >::IdRef_body ( ) [inline]

Definition at line 617 of file simple_actions.h.

: stack() {}

Member Function Documentation

template<class Obj_Type >
void desaxe::IdRef_body< Obj_Type >::begin ( const Xml_string ,
Xml_attr  attr 
) [inline, virtual]

Reimplemented from desaxe::Action_body.

Definition at line 619 of file simple_actions.h.

       {
              Obj_Type* obj = this->dig->template top<Obj_Type>();
              Mode mode;
              Xml_attr::iterator it = attr.find("id");
              if (it != attr.end())
              {
                     mode.ID = attr["id"];
                     mode.isIdRef = false;
              }
              else {
                     Xml_attr::iterator it = attr.find("idref");
                     if (it != attr.end())
                     {
                            mode.ID = attr["idref"];
                            mode.isIdRef = true;
                     }
                     else {
                            mode.ID = "";
                            mode.isIdRef = false;
                     }
              }
              if (mode.ID != "")
              {
                     Obj_Type* storedObj = this->dig->template lookup<Obj_Type>(mode.ID);
                     if ( !storedObj )
                     {
                            this->dig->store(mode.ID, obj);
                     }
                     else if ( !mode.isIdRef )
                     {
                            delete (this->dig->template top<Obj_Type>());
                            this->dig->pop();
                            this->dig->push(this->dig->template lookup<Obj_Type>(mode.ID));
                     }
                     else
                     {
                            // NYI: set trigger
                     }
              }
              stack.push_back(mode);
              
       }

Here is the call graph for this function:

virtual void desaxe::Action_body::chars ( const Xml_string ) [inline, protected, virtual, inherited]

Reimplemented in AppendText_body, desaxe::SetText_body< Obj_Type >, and desaxe::AddText_body< Obj_Type >.

Definition at line 36 of file actions.h.

{}

Here is the caller graph for this function:

template<class Obj_Type >
void desaxe::IdRef_body< Obj_Type >::end ( const Xml_string ) [inline, virtual]

Reimplemented from desaxe::Action_body.

Definition at line 662 of file simple_actions.h.

       {
              Mode mode = stack.back();
              stack.pop_back();
              if (mode.isIdRef)
              {
                     delete (this->dig->template top<Obj_Type>());
                     this->dig->pop();
                     this->dig->push(this->dig->template lookup<Obj_Type>(mode.ID));
                     // NYI reset trigger
              }
       }

Here is the call graph for this function:


Member Data Documentation

Digester* desaxe::Action_body::dig [protected, inherited]

Definition at line 38 of file actions.h.

template<class Obj_Type >
std::vector<Mode> desaxe::IdRef_body< Obj_Type >::stack [private]

Definition at line 676 of file simple_actions.h.


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