libsswf: sswf::ActionStoreRegister Class Reference

# sswf::ActionStoreRegister Class Reference

Store the top stack value in a register. More...

`#include <libsswf.h>`

Inheritance diagram for sswf::ActionStoreRegister:

List of all members.

## Public Member Functions
| ActionStoreRegister (TagBase *tag)
| Initialize the ActionStoreRegister.
void | SetRegister (unsigned char reg)
| Defines which register will hold the stack content.
## Private Member Functions
virtual Action * | Duplicate (void) const
| Create a clone of this action.
virtual int | GetMaxRegister (void) const
| Get the maximum register number in use.
virtual ErrorManager::error_code_t | ParseData (const Data &data)
| Parse the data of the ActionStoreRegister.
virtual ErrorManager::error_code_t | SaveData (Data &data, Data &nested_data)
| Save the extraneous data for this action.
## Private Attributes
unsigned char | f_reg

## Detailed Description

This action is used to save the current content of the stack in a register. Later, you can read the register with an sswf::ActionPushData action.

See also:
  SWF Alexis' Reference—Store Register

## Constructor & Destructor Documentation

ActionStoreRegister::ActionStoreRegister | ( | TagBase * | tag | ) |

Initialize the ActionStoreRegister by setting the register number to zero. Use the SetRegister() function to change the default.

Parameters:

  `[in]` | tag | The tag in which this action is being added

References f_reg.

Referenced by Duplicate().

## Member Function Documentation

Action * ActionStoreRegister::Duplicate | ( | void |  | ) | const`[private, virtual]`

This function allocates a new ActionStoreRegister object, it copies the register number and returns the pointer of the new action.

Returns:
  The action clone pointer

Reimplemented from sswf::Action.

References ActionStoreRegister(), f_reg, SetRegister(), and sswf::Action::Tag().

int ActionStoreRegister::GetMaxRegister | ( | void |  | ) | const`[private, virtual]`

This function gets the larger register number in use by this action. This is actually equal to the register you defined with SetRegister() or zero.

Returns:
  The largest register number in use by this action

Reimplemented from sswf::Action.

References f_reg.

ErrorManager::error_code_t ActionStoreRegister::ParseData | ( | const Data & | data | ) | `[private, virtual]`

This function retrieves the register number of the action.

Parameters:

  `[in]` | data | The Data buffer where the register number is read from

Returns:
  An error code or ERROR_CODE_NONE

Reimplemented from sswf::Action.

References f_reg, and sswf::Data::GetByte().

ErrorManager::error_code_t ActionStoreRegister::SaveData | ( | Data & | data,
|  | Data & | nested_data |
| ) |  |  | `[private, virtual]`

This means saving one byte with the register number.

Parameters:

  `[in]` | data | The Data buffer where the register number is to be saved
  `[in]` | nested_data | The ActionStoreRegister does not support nested data

Returns:
  An error code or ERROR_CODE_NONE

Reimplemented from sswf::Action.

References sswf::ErrorManager::ERROR_CODE_NONE, f_reg, and sswf::Data::PutByte().

void ActionStoreRegister::SetRegister | ( | unsigned char | reg | ) |

This function can be used to define the register number to hold the current stack content.

Outside a function, only registers 0 to 3 are acceptable.

Inside a function (DeclareFunction2--Version 7 of SWF), all registers from 0 to 254 are acceptable. (from my testing it seems that register 255 does not work.)

Parameters:

  `[in]` | reg | The new register to assign to this action

References f_reg.

Referenced by Duplicate().

## Member Data Documentation

unsigned char sswf::ActionStoreRegister::f_reg`[private]`

Referenced by ActionStoreRegister(), Duplicate(), GetMaxRegister(), ParseData(), SaveData(), and SetRegister().

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

- libsswf.h
- libsswf_actions.c++