#include <libsswf.h>
Public Member Functions | |
ActionPushData (TagBase *tag) | |
The PushData constructor initialize an ActionPushData object. | |
void | AddBoolean (bool value) |
Add a boolean value to the ActionPushData. | |
void | AddDouble (double value) |
Add a floating point to the ActionPushData. | |
void | AddEmptyString (void) |
Add an empty string on the stack. | |
void | AddFalse (void) |
Add the boolean value False. | |
void | AddFloat (float value) |
Add a floating point value to the ActionPushData. | |
void | AddInteger (long value) |
Add an integer to the ActionPushData. | |
void | AddLookup (unsigned short index) |
Add a string from the dictionary. | |
void | AddNull (void) |
Add the special value NULL to the ActionPushData. | |
void | AddRegister (unsigned char reg_index) |
Add the content of a register. | |
void | AddString (const char *string) |
Add a string to the ActionPushData. | |
void | AddTrue (void) |
Add the boolean value True. | |
void | AddUndefined (void) |
Add the undefined value to the ActionPushData. | |
Private Types | |
enum | action_immediate_type_t { ACTION_IMMEDIATE_TYPE_UNKNOWN = -1, ACTION_IMMEDIATE_TYPE_STRING = 0x00, ACTION_IMMEDIATE_TYPE_FLOAT = 0x01, ACTION_IMMEDIATE_TYPE_NULL = 0x02, ACTION_IMMEDIATE_TYPE_UNDEFINED = 0x03, ACTION_IMMEDIATE_TYPE_REGISTER = 0x04, ACTION_IMMEDIATE_TYPE_BOOLEAN = 0x05, ACTION_IMMEDIATE_TYPE_DOUBLE = 0x06, ACTION_IMMEDIATE_TYPE_INTEGER = 0x07, ACTION_IMMEDIATE_TYPE_LOOKUP = 0x08, ACTION_IMMEDIATE_TYPE_LOOKUP_LARGE = 0x09 } |
Private Member Functions | |
virtual Action * | Duplicate (void) const |
Duplicate an ActionPushData. | |
virtual int | GetMaxRegister (void) const |
Search the action for registers and return the largest number. | |
virtual ErrorManager::error_code_t | ParseData (const Data &data) |
Save the ActionPushData data. | |
virtual ErrorManager::error_code_t | SaveData (Data &data, Data &nested_data) |
Save the ActionPushData data. | |
Private Attributes | |
Vectors | f_data |
Classes | |
struct | action_immediate_t |
One data entry of a PushData action. More... |
enum sswf::ActionPushData::action_immediate_type_t [private] |
ActionPushData::ActionPushData | ( | TagBase * | tag | ) |
The ActionPushData constructor expects a valid parent tag (a TagHeader or a TagSprite.) Call the Add functions to add the different values necessary on the stack.
[in] | tag | The tag in which this action is inserted |
Referenced by Duplicate().
void ActionPushData::AddBoolean | ( | bool | value | ) |
This function adds a boolean value (true or false) to the ActionPushData. Note that it is a good idea to use a boolean value for an ACTION_BRANCH_IF_TRUE byte code. However, this is very similar to an integer or even a float.
[in] | value | The boolean value (true or false) |
References ACTION_IMMEDIATE_TYPE_BOOLEAN, sswf::ActionPushData::action_immediate_t::f_boolean, f_data, sswf::ActionPushData::action_immediate_t::f_data, sswf::MemoryManager::MemAttach(), and sswf::Vectors::Set().
Referenced by AddFalse(), AddTrue(), Duplicate(), and ParseData().
void ActionPushData::AddDouble | ( | double | value | ) |
This function adds a 64 bits floating point value to the ActionPushData object
[in] | value | The 64 bits floating point value |
References ACTION_IMMEDIATE_TYPE_DOUBLE, f_data, sswf::ActionPushData::action_immediate_t::f_data, sswf::ActionPushData::action_immediate_t::f_float64, sswf::MemoryManager::MemAttach(), and sswf::Vectors::Set().
Referenced by Duplicate(), and ParseData().
sswf::ActionPushData::AddEmptyString | ( | void | ) | [inline] |
This function is the same as AddString(NULL).
References AddString().
sswf::ActionPushData::AddFalse | ( | void | ) | [inline] |
This function is the same as AddBoolean(false).
References AddBoolean().
void ActionPushData::AddFloat | ( | float | value | ) |
This function adds a 32 bits floating point to the ActionPushData object.
[in] | value | A 32 bits floating point value |
References ACTION_IMMEDIATE_TYPE_FLOAT, f_data, sswf::ActionPushData::action_immediate_t::f_data, sswf::ActionPushData::action_immediate_t::f_float32, sswf::MemoryManager::MemAttach(), and sswf::Vectors::Set().
Referenced by Duplicate(), and ParseData().
void ActionPushData::AddInteger | ( | long | value | ) |
This function adds a 32 bits integer to the ActionPushData
[in] | value | A 32 bits integer |
References ACTION_IMMEDIATE_TYPE_INTEGER, f_data, sswf::ActionPushData::action_immediate_t::f_data, sswf::ActionPushData::action_immediate_t::f_integer32, sswf::MemoryManager::MemAttach(), and sswf::Vectors::Set().
Referenced by Duplicate(), and ParseData().
void ActionPushData::AddLookup | ( | unsigned short | index | ) |
This function adds a string to the ActionPushData object. The index is the string index in this ActionScript dictionary.
Don't forget that you can have only one dictionary within one tag.
[in] | index | The index of the string to be added on the stack |
References ACTION_IMMEDIATE_TYPE_LOOKUP, ACTION_IMMEDIATE_TYPE_LOOKUP_LARGE, f_data, sswf::ActionPushData::action_immediate_t::f_data, sswf::ActionPushData::action_immediate_t::f_lookup, sswf::MemoryManager::MemAttach(), and sswf::Vectors::Set().
Referenced by Duplicate(), and ParseData().
void ActionPushData::AddNull | ( | void | ) |
This function is used to add the special value NULL to an ActionPushData. This value is also called Nil in some ActionScripts. It represents a "no object reference".
References ACTION_IMMEDIATE_TYPE_NULL, f_data, sswf::MemoryManager::MemAttach(), and sswf::Vectors::Set().
Referenced by Duplicate(), and ParseData().
void ActionPushData::AddRegister | ( | unsigned char | reg_index | ) |
This function adds the content of the specified register. This is particularly useful for version 7+ functions which can save all their parameters in registers. Then you avoid an ActionGetVariable.
The register index is limited to 0, 1, 2 and 3 for the main script and any scripts before version 7. Since version 7, registers can be set from 0 to 254 within a function 2 declaration.
[in] | reg_index | The index of the register to read |
References ACTION_IMMEDIATE_TYPE_REGISTER, f_data, sswf::ActionPushData::action_immediate_t::f_data, sswf::ActionPushData::action_immediate_t::f_register, sswf::MemoryManager::MemAttach(), and sswf::Vectors::Set().
Referenced by Duplicate(), and ParseData().
void ActionPushData::AddString | ( | const char * | string | ) |
This function adds a string to the action.
[in] | string | The string to add to the action |
References ACTION_IMMEDIATE_TYPE_STRING, f_data, sswf::ActionPushData::action_immediate_t::f_data, sswf::ActionPushData::action_immediate_t::f_string, sswf::MemoryManager::MemAttach(), sswf::Vectors::Set(), and sswf::MemoryManager::StrDup().
Referenced by AddEmptyString(), and Duplicate().
sswf::ActionPushData::AddTrue | ( | void | ) | [inline] |
This function is the same as AddBoolean(true).
References AddBoolean().
void ActionPushData::AddUndefined | ( | void | ) |
This function is used to add the special value Undefined to an ActionPushData. This is value is used to test whether some object, function, variable is defined or not.
It can also be used to pass as a parameter to a function which requires a parameter you cannot define.
References ACTION_IMMEDIATE_TYPE_UNDEFINED, f_data, sswf::MemoryManager::MemAttach(), and sswf::Vectors::Set().
Referenced by Duplicate(), and ParseData().
Action * ActionPushData::Duplicate | ( | void | ) | const [private, virtual] |
This function creates a new ActionPushData object and copies 'this' ActionPushData in it.
The function copies all the data which was added to the ActionPushData.
Reimplemented from sswf::Action.
References ACTION_IMMEDIATE_TYPE_BOOLEAN, ACTION_IMMEDIATE_TYPE_DOUBLE, ACTION_IMMEDIATE_TYPE_FLOAT, ACTION_IMMEDIATE_TYPE_INTEGER, ACTION_IMMEDIATE_TYPE_LOOKUP, ACTION_IMMEDIATE_TYPE_LOOKUP_LARGE, ACTION_IMMEDIATE_TYPE_NULL, ACTION_IMMEDIATE_TYPE_REGISTER, ACTION_IMMEDIATE_TYPE_STRING, ACTION_IMMEDIATE_TYPE_UNDEFINED, ActionPushData(), AddBoolean(), AddDouble(), AddFloat(), AddInteger(), AddLookup(), AddNull(), AddRegister(), AddString(), AddUndefined(), sswf::assert(), sswf::Vectors::Count(), sswf::ActionPushData::action_immediate_t::f_boolean, sswf::ActionPushData::action_immediate_t::f_data, f_data, sswf::ActionPushData::action_immediate_t::f_float32, sswf::ActionPushData::action_immediate_t::f_float64, sswf::ActionPushData::action_immediate_t::f_integer32, sswf::ActionPushData::action_immediate_t::f_lookup, sswf::ActionPushData::action_immediate_t::f_register, sswf::ActionPushData::action_immediate_t::f_string, sswf::ActionPushData::action_immediate_t::f_type, sswf::Vectors::Get(), and sswf::Action::Tag().
int ActionPushData::GetMaxRegister | ( | void | ) | const [private, virtual] |
This function defines what the largest register is in this ActionPushData.
Reimplemented from sswf::Action.
References ACTION_IMMEDIATE_TYPE_BOOLEAN, ACTION_IMMEDIATE_TYPE_DOUBLE, ACTION_IMMEDIATE_TYPE_FLOAT, ACTION_IMMEDIATE_TYPE_INTEGER, ACTION_IMMEDIATE_TYPE_LOOKUP, ACTION_IMMEDIATE_TYPE_LOOKUP_LARGE, ACTION_IMMEDIATE_TYPE_NULL, ACTION_IMMEDIATE_TYPE_REGISTER, ACTION_IMMEDIATE_TYPE_STRING, ACTION_IMMEDIATE_TYPE_UNDEFINED, sswf::assert(), sswf::Vectors::Count(), sswf::ActionPushData::action_immediate_t::f_data, f_data, sswf::ActionPushData::action_immediate_t::f_register, sswf::ActionPushData::action_immediate_t::f_type, and sswf::Vectors::Get().
ErrorManager::error_code_t ActionPushData::ParseData | ( | const Data & | data | ) | [private, virtual] |
This function is used to save the actual data of the ActionPushData in the Data buffer.
[in] | data | The Data buffer from which the ActionPushData is read |
Reimplemented from sswf::Action.
References ACTION_IMMEDIATE_TYPE_BOOLEAN, ACTION_IMMEDIATE_TYPE_DOUBLE, ACTION_IMMEDIATE_TYPE_FLOAT, ACTION_IMMEDIATE_TYPE_INTEGER, ACTION_IMMEDIATE_TYPE_LOOKUP, ACTION_IMMEDIATE_TYPE_LOOKUP_LARGE, ACTION_IMMEDIATE_TYPE_NULL, ACTION_IMMEDIATE_TYPE_REGISTER, ACTION_IMMEDIATE_TYPE_STRING, ACTION_IMMEDIATE_TYPE_UNDEFINED, AddBoolean(), AddDouble(), AddFloat(), AddInteger(), AddLookup(), AddNull(), AddRegister(), AddUndefined(), sswf::ErrorManager::ERROR_CODE_NONE, sswf::ErrorManager::ERROR_CODE_UNKNOWN_IMMEDIATE_DATA_TYPE, f_data, sswf::ActionPushData::action_immediate_t::f_data, sswf::ActionPushData::action_immediate_t::f_string, sswf::Data::GetByte(), sswf::Data::GetLong(), sswf::Data::GetLongFloat(), sswf::Data::GetShort(), sswf::Data::GetString(), sswf::Data::IsEndOfData(), sswf::MemoryManager::MemAttach(), sswf::Action::OnError(), and sswf::Vectors::Set().
ErrorManager::error_code_t ActionPushData::SaveData | ( | Data & | data, | |
Data & | nested_data | |||
) | [private, virtual] |
This function is used to save the actual data of the ActionPushData in the Data buffer.
[in] | data | The Data buffer where the ActionPushData is saved |
[in] | nested_data | There is no nested data in an ActionPushData |
Reimplemented from sswf::Action.
References ACTION_IMMEDIATE_TYPE_BOOLEAN, ACTION_IMMEDIATE_TYPE_DOUBLE, ACTION_IMMEDIATE_TYPE_FLOAT, ACTION_IMMEDIATE_TYPE_INTEGER, ACTION_IMMEDIATE_TYPE_LOOKUP, ACTION_IMMEDIATE_TYPE_LOOKUP_LARGE, ACTION_IMMEDIATE_TYPE_NULL, ACTION_IMMEDIATE_TYPE_REGISTER, ACTION_IMMEDIATE_TYPE_STRING, ACTION_IMMEDIATE_TYPE_UNDEFINED, sswf::assert(), sswf::Vectors::Count(), sswf::ErrorManager::ERROR_CODE_INTERNAL_ERROR, sswf::ErrorManager::ERROR_CODE_NONE, sswf::ActionPushData::action_immediate_t::f_boolean, sswf::ActionPushData::action_immediate_t::f_data, f_data, sswf::ActionPushData::action_immediate_t::f_integer32, sswf::ActionPushData::action_immediate_t::f_lookup, sswf::ActionPushData::action_immediate_t::f_register, sswf::ActionPushData::action_immediate_t::f_string, sswf::ActionPushData::action_immediate_t::f_type, sswf::Vectors::Get(), sswf::ErrorManager::KeepFirst(), sswf::Action::OnError(), sswf::Data::PutByte(), sswf::Data::PutLong(), sswf::Data::PutShort(), and sswf::Action::SaveString().
Vectors sswf::ActionPushData::f_data [private] |
Referenced by AddBoolean(), AddDouble(), AddFloat(), AddInteger(), AddLookup(), AddNull(), AddRegister(), AddString(), AddUndefined(), Duplicate(), GetMaxRegister(), ParseData(), and SaveData().