libsswf: sswf::TagBaseID Class Reference

# sswf::TagBaseID Class Reference

The base of all the tags with an ID. More...

`#include <libsswf.h>`

Inheritance diagram for sswf::TagBaseID:

List of all members.

## Public Member Functions
bool | HasIdentification (void) const
| Test whether a tag which should have an ID really has one.
virtual sswf_id_t | Identification (void) const
| Return this tag identifier.
void | NoIdentification (void)
| Release the identification for this tag.
ErrorManager::error_code_t | ParseID (const Data &data)
| Read the ID of this object from data.
int | SaveID (Data &data) const
| Save the object identifier in a Data buffer.
| TagBaseID (const char *name, TagBase *parent)
| Initialize the base information of a tag with an identifier.
virtual | ~TagBaseID ()
| Destroys the base information of a tag with an identifier.
## Private Attributes
sswf_id_t | f_id
bool | f_identified

## Detailed Description

A set of tags have an identifier. They all derive from the TagBaseID class.

The TagBaseID class is used to manage the identifiers.

It knows how to allocate a new identifier, how to forfeit an identifier, how to save an identifier.

For instance, a TagSprite derives from the TagBaseID()

See also:
  SWF Alexis' Reference—swf_tag

## Constructor & Destructor Documentation

TagBaseID::~TagBaseID | ( |  | ) | `[virtual]`

The destructor releases the identification of the object and returns.

Note:
  In general, the release of the identification is not required.

Warning:
  I added the destructor because it is needed under MinGW when compiling with .dll libraries. Otherwise it does not know what function to call. (an auto-destructor cannot be auto-imported) Otherwise, the functionality of the destructor will usually not be of much necessity.

References NoIdentification().

TagBaseID::TagBaseID | ( | const char * | name,
|  | TagBase * | parent |
| ) |  |  |

Tag which include an identifier will be derived from this TagBaseID class.

Whenever created, they are automatically assigned a unique identifier (see the sswf::TagHeader::NextID(void) function).

The TagBaseID is itself derived from the TagBase object. The name and parent parameters are directly passed down to the TagBase constructor.

Warning:
  If the tag is created without a parent, or an invalid parent pointer, then the sswf::TagHeader::NextID(void) function cannot be found. The result is that no identifier is assigned this the tag.

Parameters:

  | name | The type of the tag in the form of a string
  | parent | The parent tag (a header or a sprite)

References sswf::assert(), f_id, f_identified, sswf::TagBase::Header(), sswf::TagHeader::NextID(), and SSWF_ID_NONE.

## Member Function Documentation

bool TagBaseID::HasIdentification | ( | void |  | ) | const

This function checks whether a tag supposed to have an identifier really has one.

Returns:
  true when the object is still identified, and false otherwise

References f_identified.

Referenced by sswf::TagBase::FindID().

sswf_id_t TagBaseID::Identification | ( | void |  | ) | const`[virtual]`

This function returns the identifier which was given to this tag or SSWF_ID_NONE when it was cancelled by a call to TagBaseID::NoIdentification().

Returns:
  the tag identifier or SSWF_ID_NONE

References f_id.

Referenced by sswf::TagSprite::Save(), and sswf::TagButton::Save().

void TagBaseID::NoIdentification | ( | void |  | ) |

It is possible that a tag which usually has an identifier does not actually need it (at this time this is the case only for Glyphs which are shapes without identification.)

This function will release the identification which can then not be used.

Whenever possible, the identifier of this object will be returned to the pool of available identifiers.

References f_id, f_identified, sswf::TagBase::Header(), sswf::TagHeader::RemoveID(), and SSWF_ID_NONE.

Referenced by sswf::TagShape::Glyph(), and ~TagBaseID().

ErrorManager::error_code_t TagBaseID::ParseID | ( | const Data & | data | ) |

This function reads the identifier of this object and saves it in the object.

Note:
  The pointer will be moved by 16 bits after `ReadAlign()` was called on the `data` object.

Parameters:

  `[in]` | data | Retrieve the object identifier from this data buffer

Returns:
  An error if one occurs, ERROR_CODE_NONE otherwise

See also:
  TagBaseID::SaveID(Data& data) const

References f_id, f_identified, and sswf::Data::GetShort().

Referenced by sswf::TagSprite::ParseTag(), sswf::TagEditText::ParseTag(), sswf::TagCSMTextSettings::ParseTag(), sswf::TagButton::ParseTag(), and sswf::TagBinaryData::ParseTag().

int TagBaseID::SaveID | ( | Data & | data | ) | const

This function will save the identifier of 'this' tag in the specified Data buffer.

Parameters:

  | data | The data buffer used to save the tag

Returns:
  The function returns 0 when it succeeds and non-zero when it fails

See also:
  TagBaseID::ParseID(const Data& data)

References sswf::assert(), f_id, f_identified, and sswf::Data::PutShort().

Referenced by sswf::TagText::Save(), sswf::TagSprite::Save(), sswf::TagSound::Save(), sswf::TagShape::Save(), sswf::TagImage::Save(), sswf::TagFont::Save(), sswf::TagEditText::Save(), sswf::TagButton::Save(), sswf::TagBinaryData::Save(), and sswf::TagCSMTextSettings::SaveCSMTextSettings().

## Member Data Documentation

sswf_id_t sswf::TagBaseID::f_id`[private]`

Referenced by Identification(), NoIdentification(), ParseID(), SaveID(), and TagBaseID().

bool sswf::TagBaseID::f_identified`[private]`

Referenced by HasIdentification(), NoIdentification(), ParseID(), SaveID(), and TagBaseID().

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

- libsswf.h
- libsswf_tag_base.c++