#include <libsswf.h>
Inheritance diagram for sswf::ActionTry:
Public Member Functions | |
ActionTry (TagBase *tag) | |
Initialize the ActionTry action. | |
void | AddCatchAction (Action *action) |
Add an action to the catch block. | |
void | AddFinallyAction (Action *action) |
Add an action to the finally block. | |
void | AddTryAction (Action *action) |
Add an action to the try block. | |
void | SetIdentifier (const char *variable_name) |
Request the error to be saved in a named variable. | |
void | SetIdentifier (int register_number) |
Request the error to be saved in a register. | |
Vectors * | SubListCatch (void) |
Retrieve the Vectors to the catch action block. | |
Vectors * | SubListFinally (void) |
Retrieve the Vectors to the finally action block. | |
Vectors * | SubListTry (void) |
Retrieve the Vectors to the try action block. | |
Private Member Functions | |
virtual Action * | Duplicate (void) const |
Create a clone of this action. | |
virtual int | GetMaxRegister (void) const |
Defines the maximum register number in use. | |
virtual ErrorManager::error_code_t | SaveData (Data &data, Data &nested_data) |
Save the ActionTry extraneous data. | |
virtual unsigned char | Version (void) const |
The version required to save this action. | |
Private Attributes | |
Vectors | f_actions_catch |
Vectors | f_actions_finally |
Vectors | f_actions_try |
bool | f_has_catch |
bool | f_has_finally |
int | f_register |
char * | f_variable_name |
It is necessary to at least have one of the 'catch' or 'finally' blocks. The 'try' block is mandatory.
ActionTry::ActionTry | ( | TagBase * | tag | ) |
This constructor marks the Try action as not having any catch or finally blocks, no name and no register.
Use the AddTryAction() or SubListTry() to add actions to the try block.
Use the AddCatchAction() or SubListCatch() to add actions to the catch block.
Use the AddFinallyAction() or SubListFinally() to add actions to the finally block.
Use the SetIdentifier(int register_number) function with an integer to define a register number for the catch variable.
Use the SetIdentifier(const char *name) function with a string to define the name of a variable to use as the catch variable.
[in] | tag | The tag in which this action is inserted |
void ActionTry::AddCatchAction | ( | Action * | action | ) |
This function adds the specified action to the catch block. The catch block can be empty, in which case you must have a non-empty finally block.
The action passed is not duplicated.
This function has the side effect of marking the action as having a catch block, unless the pointer is null.
[in] | action | The pointer to the action to add to the catch block or NULL |
void ActionTry::AddFinallyAction | ( | Action * | action | ) |
This function adds the specified action to the finally block. The finally block can be empty, in which case you must have a non-empty catch block.
The action passed is not duplicated.
This function has the side effect of marking the action as having a finally block, unless the pointer is null.
[in] | action | The pointer to the action to add to the finally block or NULL |
void ActionTry::AddTryAction | ( | Action * | action | ) |
This function adds the specified action to the try block. There should be at least one action in the try block.
The action is not duplicated.
[in] | action | The pointer to the action to add to the try block or NULL |
Action * ActionTry::Duplicate | ( | void | ) | const [private, virtual] |
This function creates a new ActionTry object, it copies the register number, variable name, has catch & finally flags and then copy the lists of actions (try, catch and finally blocks.)
Reimplemented from sswf::Action.
int ActionTry::GetMaxRegister | ( | void | ) | const [private, virtual] |
This function overwrites the default sswf::Action::GetMaxRegister() function in order to retrieve the largest register in use in any of the sub-action blocks (try, catch, finally).
Reimplemented from sswf::Action.
ErrorManager::error_code_t ActionTry::SaveData | ( | Data & | data, | |
Data & | nested_data | |||
) | [private, virtual] |
The SaveData() function saves the try, catch and finally blocks in the nested_data and the try header in the Data buffers.
Note that the maximum size for any one sub-block is 65535 bytes. A larger sub-block will generate an error and the save will fail.
This function should not be called until at least one of the catch or finally block has been created.
[in] | data | The Data buffer where the ActionTry header is saved |
[in] | nested_data | This buffer is used to save the try, catch and finally blocks |
Reimplemented from sswf::Action.
void ActionTry::SetIdentifier | ( | const char * | name | ) |
This function defines the name to use as the catch variable. When a register number from 0 to 254 was defined with SetIdentifier(), this variable name is ignored.
[in] | name | The name of the variable to use within the catch block to access the error |
void ActionTry::SetIdentifier | ( | int | register_number | ) |
The catch block, when called, receives an error variable. This variable can be saved in a register. To archive this, set the register number that you want to use for this catch block.
This function has priority over the SetIdentifier(const char *name) function. This means the register number will be used instead of the register name if defined.
The register number can be any number between 0 and 254.
If the register number is set to -1, then it is ignored.
[in] | register_number | The register to use in the catch block to access the error |
Vectors * ActionTry::SubListCatch | ( | void | ) |
This function can be used to retrieve a direct pointer to the Vectors holding the action block for the 'catch' block.
Vectors * ActionTry::SubListFinally | ( | void | ) |
This function can be used to retrieve a direct pointer to the Vectors holding the action block for the 'finally' block.
Vectors * ActionTry::SubListTry | ( | void | ) |
This function can be used to retrieve a direct pointer to the Vectors holding the action block for the 'try' block.
unsigned char ActionTry::Version | ( | void | ) | const [private, virtual] |
This function goes through all the sub-action lists to determine the minimum version necessary to save it.
The ActionTry itself requires version 7, but actions in the sub-lists may require a higher version.
Reimplemented from sswf::Action.
Vectors sswf::ActionTry::f_actions_catch [private] |
Vectors sswf::ActionTry::f_actions_finally [private] |
Vectors sswf::ActionTry::f_actions_try [private] |
bool sswf::ActionTry::f_has_catch [private] |
bool sswf::ActionTry::f_has_finally [private] |
int sswf::ActionTry::f_register [private] |
char* sswf::ActionTry::f_variable_name [private] |