sswf::ActionWith Class Reference

Block including variable member names refering to the With object. More...

#include <libsswf.h>

Inheritance diagram for sswf::ActionWith:

sswf::Action sswf::MemoryManager sswf::ItemBase sswf::MemBuffer List of all members.

Public Member Functions

 ActionWith (TagBase *tag)
 Initialize the ActionWith object.
void AddAction (Action *action)
 Add an action to the 'with' block.
virtual VectorsSubList (void)
 The sub-list of actions of this ActionWith.

Private Member Functions

virtual ActionDuplicate (void) const
 Create a clone of this ActionWith object.
virtual ErrorManager::error_code_t SaveData (Data &data, Data &nested_data)
 Save the byte size of the nested data.

Private Attributes

Vectors f_actions

Detailed Description

This action is supposed to be useful to optimize JavaScript code by not having to fully qualify variables by their respective object name.

For instance, the following code:

        obj.a = 1;
        obj.b = 2;
        obj.c = 3;
        obj.d = 4;
        obj.e = 5;

can be simplified using a 'with' instruction as follow:

        with obj {
                a = 1;
                b = 2;
                c = 3;
                d = 4;
                e = 5;
        }

See also:
SWF Alexis' Reference—With


Constructor & Destructor Documentation

ActionWith::ActionWith ( TagBase tag  ) 

This function initialize the 'with' object by making the 'with' block empty.

Parameters:
[in] tag The tag where the With is inserted


Member Function Documentation

void ActionWith::AddAction ( Action action  ) 

The 'with' block is a list of actions which can be grown using this function. Note that you can have several levels of 'with' (i.e. within a 'with' block you can have another 'with' block to a depth of 7 up to version 5 of SWF, and 15 in version 6 of SWF.)

Of course, it can be quite tedious to know what variable reference which object when all the objects have variable and function members of the same name (it should be the inner most object which has a match.)

Note that the action being added is not duplicated.

Parameters:
[in] action The pointer to the action to add to this ActionWith

Action * ActionWith::Duplicate ( void   )  const [private, virtual]

This function creates a new ActionWith object and copies all the actions of 'this' ActionWith in it. Finally, it returns a pointer to the newly allocated object.

Returns:
The newly allocated action pointer

Reimplemented from sswf::Action.

ErrorManager::error_code_t ActionWith::SaveData ( Data data,
Data nested_data 
) [private, virtual]

This function saves the extraneous data for an ActionWith object which is the size of the nested data buffer in bytes.

Parameters:
[in] data The Data buffer where the size is to be saved
[in] nested_data The Data buffer which holds the sub-actions

Reimplemented from sswf::Action.

Vectors * ActionWith::SubList ( void   )  [virtual]

This function returns a direct pointer to the Vectors of this ActioWith object. This Vectors array holds all the actions to execute once the specified frame was loaded.

Do not forget that the actions are limited to a byte size of 65535 in the outer most ActionWith object.

Returns:
A Vectors pointer to fill with actions

Reimplemented from sswf::Action.


Member Data Documentation

Vectors sswf::ActionWith::f_actions [private]


The documentation for this class was generated from the following files:
Generated on Sun May 13 23:29:39 2007 for libsswf by  doxygen 1.4.7