libsswf: sswf::ActionDictionary Class Reference

# sswf::ActionDictionary Class Reference

Create a dictionary action. More...

`#include <libsswf.h>`

Inheritance diagram for sswf::ActionDictionary:

List of all members.

## Public Member Functions
| ActionDictionary (TagBase *tag)
| Initializes the dictionary.
void | AddString (const char *string)
| Add a string to a dictionary.
## Private Member Functions
virtual Action * | Duplicate (void) const
| Duplicate a dictionary.
virtual ErrorManager::error_code_t | ParseData (const Data &data)
| Save the dictionary strings.
virtual ErrorManager::error_code_t | SaveData (Data &data, Data &nested_data)
| Save the dictionary strings.
## Private Attributes
Vectors | f_strings
| Array of dictionary strings.
## Classes
struct | string_t
| Holds one dictionary string. More...

## Detailed Description

This action holds pre-defined string constants. These can later be retrieved using a query in a ActionPushData action.

Note that too small a string will not benefit from being saved in a dictionary. Similarly, if the dictionary is used for only one string, it usually won't help.

Note that there should be only one single dictionary per Action list. The dictionary is visible through all the different blocks/level that an Action list represents. The consequences of saving more than one ActionDictionary in the same list are undefined.

See also:
  SWF Alexis' Reference—Declare Dictionary

## Constructor & Destructor Documentation

ActionDictionary::ActionDictionary | ( | TagBase * | tag | ) |

Create an empty tag of type ACTION_DECLARE_DICTIONARY.

Referenced by Duplicate().

## Member Function Documentation

void ActionDictionary::AddString | ( | const char * | string | ) |

This function adds the specified string to the dictionary.

There is no limit to the string or the number of string one can add to a dictionary, except for the total size of an action block.

Parameters:

  `[in]` | string | The string to append

References sswf::ActionDictionary::string_t::f_string, f_strings, sswf::MemoryManager::MemAttach(), sswf::Vectors::Set(), and sswf::MemoryManager::StrDup().

Referenced by Duplicate().

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

This function creates a new ActionDictionary and then copy all the strings from 'this' dictionary to the new dictionary.

Returns:
  A pointer to the new dictionary.

Reimplemented from sswf::Action.

References ActionDictionary(), AddString(), sswf::Vectors::Count(), sswf::ActionDictionary::string_t::f_string, f_strings, sswf::Vectors::Get(), and sswf::Action::Tag().

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

This function is used to parse the dictionary strings from the specified Data buffer.

Parameters:

  `[in]` | data | The Data buffer where the strings are loaded from.

Reimplemented from sswf::Action.

References sswf::ErrorManager::ERROR_CODE_NONE, sswf::ActionDictionary::string_t::f_string, f_strings, sswf::Data::GetShort(), sswf::Data::GetString(), sswf::MemoryManager::MemAttach(), and sswf::Vectors::Set().

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

This function is used to save the dictionary strings in the specified Data buffer.

Parameters:

  `[in]` | data | The Data buffer where the strings are to be saved
  `[in]` | nested_data | The sub-actions of the dictionary (i.e. none)

Reimplemented from sswf::Action.

References sswf::Vectors::Count(), sswf::ErrorManager::ERROR_CODE_NONE, sswf::ActionDictionary::string_t::f_string, f_strings, sswf::Vectors::Get(), sswf::Data::PutShort(), and sswf::Action::SaveString().

## Member Data Documentation

Vectors sswf::ActionDictionary::f_strings`[private]`

Referenced by AddString(), Duplicate(), ParseData(), and SaveData().

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

- libsswf.h
- libsswf_actions.c++