sswf::ActionPushData Class Reference

The PushData action adds data on the ActionScript stack. More...

#include <libsswf.h>

Inheritance diagram for sswf::ActionPushData:

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

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

 ACTION_IMMEDIATE_TYPE_BOOLEAN = 0x05
 ACTION_IMMEDIATE_TYPE_DOUBLE = 0x06
 ACTION_IMMEDIATE_TYPE_FLOAT = 0x01
 ACTION_IMMEDIATE_TYPE_INTEGER = 0x07
 ACTION_IMMEDIATE_TYPE_LOOKUP = 0x08
 ACTION_IMMEDIATE_TYPE_LOOKUP_LARGE = 0x09
 ACTION_IMMEDIATE_TYPE_NULL = 0x02
 ACTION_IMMEDIATE_TYPE_REGISTER = 0x04
 ACTION_IMMEDIATE_TYPE_STRING = 0x00
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
}
 ACTION_IMMEDIATE_TYPE_UNDEFINED = 0x03
 ACTION_IMMEDIATE_TYPE_UNKNOWN = -1

Private Member Functions

virtual ActionDuplicate (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 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...

Detailed Description

Create a PushData action each time you need some constant data or the content of a register on the ActionScript stack.

See also:
SWF Alexis' Reference—Push Data


Member Enumeration Documentation

enum sswf::ActionPushData::action_immediate_type_t [private]

Enumerator:
ACTION_IMMEDIATE_TYPE_UNKNOWN 
ACTION_IMMEDIATE_TYPE_STRING 
ACTION_IMMEDIATE_TYPE_FLOAT 
ACTION_IMMEDIATE_TYPE_NULL 
ACTION_IMMEDIATE_TYPE_UNDEFINED 
ACTION_IMMEDIATE_TYPE_REGISTER 
ACTION_IMMEDIATE_TYPE_BOOLEAN 
ACTION_IMMEDIATE_TYPE_DOUBLE 
ACTION_IMMEDIATE_TYPE_INTEGER 
ACTION_IMMEDIATE_TYPE_LOOKUP 
ACTION_IMMEDIATE_TYPE_LOOKUP_LARGE 


Constructor & Destructor Documentation

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.

Parameters:
[in] tag The tag in which this action is inserted


Member Function Documentation

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.

Parameters:
[in] value The boolean value (true or false)

void ActionPushData::AddDouble ( double  value  ) 

This function adds a 64 bits floating point value to the ActionPushData object

Parameters:
[in] value The 64 bits floating point value

sswf::ActionPushData::AddEmptyString ( void   )  [inline]

This function is the same as AddString(NULL).

See also:
sswf::ActionPushData::AddString()

sswf::ActionPushData::AddFalse ( void   )  [inline]

This function is the same as AddBoolean(false).

See also:
sswf::ActionPushData::AddBoolean()

void ActionPushData::AddFloat ( float  value  ) 

This function adds a 32 bits floating point to the ActionPushData object.

Parameters:
[in] value A 32 bits floating point value

void ActionPushData::AddInteger ( long  value  ) 

This function adds a 32 bits integer to the ActionPushData

Parameters:
[in] value A 32 bits integer

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.

Parameters:
[in] index The index of the string to be added on the stack

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".

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.

Parameters:
[in] reg_index The index of the register to read

void ActionPushData::AddString ( const char *  string  ) 

This function adds a string to the action.

See also:
sswf::ActionPushData::AddEmptyString()
Parameters:
[in] string The string to add to the action

sswf::ActionPushData::AddTrue ( void   )  [inline]

This function is the same as AddBoolean(true).

See also:
sswf::ActionPushData::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.

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.

Returns:
The new ActionPushData pointer

Reimplemented from sswf::Action.

int ActionPushData::GetMaxRegister ( void   )  const [private, virtual]

This function defines what the largest register is in this ActionPushData.

Returns:
The largest register used in this ActionPushData

Reimplemented from sswf::Action.

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.

Parameters:
[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.


Member Data Documentation

Vectors sswf::ActionPushData::f_data [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