#include <libsswf.h>
Public Member Functions | |
ActionWith (TagBase *tag) | |
Initialize the ActionWith object. | |
void | AddAction (Action *action) |
Add an action to the 'with' block. | |
virtual Vectors * | SubList (void) |
The sub-list of actions of this ActionWith. | |
Private Member Functions | |
virtual Action * | Duplicate (void) const |
Create a clone of this ActionWith object. | |
virtual ErrorManager::error_code_t | ParseData (const Data &data) |
Parse the nested actions from the Data buffer. | |
virtual ErrorManager::error_code_t | SaveData (Data &data, Data &nested_data) |
Save the byte size of the nested data. | |
Private Attributes | |
Vectors | f_actions |
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; }
ActionWith::ActionWith | ( | TagBase * | tag | ) |
This function initialize the 'with' object by making the 'with' block empty.
[in] | tag | The tag where the With is inserted |
Referenced by Duplicate().
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.
[in] | action | The pointer to the action to add to this ActionWith |
References f_actions, and sswf::Vectors::Set().
Referenced by Duplicate().
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.
Reimplemented from sswf::Action.
References ActionWith(), AddAction(), sswf::Vectors::Count(), sswf::Action::Duplicate(), f_actions, sswf::Vectors::Get(), and sswf::Action::Tag().
ErrorManager::error_code_t ActionWith::ParseData | ( | const Data & | data | ) | [private, virtual] |
This function parses the nested actions of the ActionWith object.
[in] | data | The source Data buffer |
Reimplemented from sswf::Action.
References sswf::ErrorManager::ERROR_CODE_NONE, f_actions, sswf::Data::GetShort(), sswf::Action::ParseList(), and sswf::Action::Tag().
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.
[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.
References sswf::Data::ByteSize(), sswf::ErrorManager::ERROR_CODE_NONE, and sswf::Data::PutShort().
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.
Reimplemented from sswf::Action.
References f_actions.
Vectors sswf::ActionWith::f_actions [private] |
Referenced by AddAction(), Duplicate(), ParseData(), and SubList().