libsswf: libsswf_tag_header.c++ File Reference

# libsswf_tag_header.c++ File Reference

The implementation of the sswf::TagHeader class. More...

## Typedefs
typedef std::map < TagBase::swf_tag_t, TagHeader::Factory * > | factory_map_t
| Definition of a map to handle factories.
typedef std::pair < TagBase::swf_tag_t, TagHeader::Factory * > | factory_pair_t
| Definition of a pair to handle factories.
## Functions
void | RegisterFactory (TagHeader::Factory *factory)
| Register a tag factory.
void | UnregisterFactory (TagHeader::Factory *factory)
| Remove a factory being destroyed from the list of factories.
## Variables
factory_map_t * | g_list_of_factories
| Map of all the registered factories.

## Detailed Description

This file declares the body of the functions which are not inline. It is part of the SSWF library.

## Typedef Documentation

typedef std::map<TagBase::swf_tag_t, TagHeader::Factory *> factory_map_t`[static]`

This map is used to sort all the factories by tag.

typedef std::pair<TagBase::swf_tag_t, TagHeader::Factory *> factory_pair_t`[static]`

This pair represents the items defined in the factory map.

## Function Documentation

void @20::RegisterFactory | ( | TagHeader::Factory * | factory | ) | `[static]`

This function inserts a tag factory that is later used to load a Flash file.

Todo:
  To be extremely dynamic, we should register all the factories, whatever their priority. That way, a dynamic priority could be created only in special circumstances. That way, these would be used at that time, and it would revert to the normal factory once the special factory was deleted.

Bug:
  The function does not record all the factories. It cannot know when a factory has a priority equal to another factory. If that happens the first factory that was registered is kept. In other words, if two factories have priority 1, no errors are generated.

Parameters:

  `[in]` | factory | The factory to register.

References sswf::TagHeader::Factory::GetPriority(), and sswf::TagHeader::Factory::GetTag().

Referenced by sswf::TagHeader::Factory::Factory().

void @20::UnregisterFactory | ( | TagHeader::Factory * | factory | ) | `[static]`

This function removes the specified factory from the list of factories defined in the TagHeader.

Bug:
  The idea is to avoid bugs whenever a factory object is deleted (in case someone creates dynamic factories.) The problem is that since only that one factory will have been registered, the previous level (lower priority) is not available and thus that tag cannot be loaded anymore until a new factory is created for it.

Parameters:

  `[in]` | factory | The factory to remove from the list of factories

References sswf::TagHeader::Factory::GetTag().

Referenced by sswf::TagHeader::Factory::~Factory().

## Variable Documentation

factory_map_t* g_list_of_factories`[static]`

This variable is dynamically allocated once a factory is being registered. The factories are automatically registered on creation.

Bug:
  The map is never released, but it is only allocated once.

Referenced by sswf::TagHeader::GetFactory().