Made to Order Software Corporation Logo

libsswf: sswf::ActionPushData Class Reference

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

#include <libsswf.h>

Inheritance diagram for sswf::ActionPushData:

:Action :MemoryManager :ItemBase :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

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

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

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

Referenced by Duplicate().


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)

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

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

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

References AddString().

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

This function is the same as AddBoolean(false).

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

References 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

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  ) 

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

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.

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

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

This function is the same as AddBoolean(true).

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

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().


Member Data Documentation


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


Generated on Wed Mar 18 15:13:57 2009 for libsswf by  doxygen 1.5.5