libsswf: sswf::TagExport Class Reference

# sswf::TagExport Class Reference

The object used to export objects to another movie. More...

`#include <libsswf.h>`

Inheritance diagram for sswf::TagExport:

List of all members.

## Public Member Functions
virtual ErrorManager::error_code_t | Save (Data &data)
| Save the export tag in the specified Data buffer.
void | SetObject (sswf_id_t id, const char *name, const char *used_glyphs)
| Adds one object reference to the TagExport.
| TagExport (TagBase *parent)
| Initialize the tag export.
virtual swf_type_t | TypeFlags (void) const
| Get the flags representing this tag.
## Private Member Functions
virtual ErrorManager::error_code_t | ParseTag (swf_tag_t tag, const Data &data)
| Parse data from a file into a Export tag.
virtual ErrorManager::error_code_t | PreSave (void)
| Test the availability of all the objects.
## Private Attributes
Vectors | f_objects
## Classes
struct | export_t
| One export entry with the identifier of the object to export and the export name. More...

## Detailed Description

The export tag is used to share objects defined in this movie to the outside world. Other SWF movies can reference this movie and the exported objects with the use of an sswf::TagImport tag.

See also:
  sswf::TagImport

  SWF Alexis' Reference—Export

  SWF Alexis' Reference—swf_tag

## Constructor & Destructor Documentation

TagExport::TagExport | ( | TagBase * | parent | ) |

The constructor initialize the tag export with an empty list of objects. The objects can later be added with a call to the sswf::TagExport::SetOption(sswf_id_t id, const char *name) function.

See also:
  sswf::TagExport::SetOption(sswf_id_t id, const char *name)

## Member Function Documentation

ErrorManager::error_code_t TagExport::ParseTag | ( | swf_tag_t | tag,
|  | const Data & | data |
| ) |  |  | `[private, virtual]`

This function parses the data for an export tag and saves the data in this object.

Parameters:

  `[in]` | tag | The tag that generated this call
  `[in]` | data | The Data buffer from the Flash file being loaded

Returns:
  An error if one occurs, or ErrorManager::ERROR_CODE_NONE

Implements sswf::TagBase.

References sswf::ErrorManager::ERROR_CODE_NONE, sswf::TagExport::export_t::f_id, sswf::TagExport::export_t::f_name, f_objects, sswf::TagExport::export_t::f_used_glyphs, sswf::Data::GetShort(), sswf::Data::GetString(), sswf::MemoryManager::MemAttach(), and sswf::Vectors::Set().

ErrorManager::error_code_t TagExport::PreSave | ( | void |  | ) | `[private, virtual]`

This function checks that all the objects referenced with calls to sswf::TagExport::SetObject(sswf_id_t id, const char *name) are indeed available in the SWF animation.

Also, it ensures that tags are definitions. This is not a 100% sure test that the given tag can indeed be saved in an export tag, but it will already filter most possible errors.

If a font is being exported, then the font is marked as if used by a sswf::TagEditText. The function also ensures that all the glyphs are saved in the font (or at least those you requested when adding the font to the TagExport object.) The fact is that this font could be used by an sswf::TagEditText once imported and there is no way to infer such a thing at this point.

Note that the use of an sswf::TagExport object forces a minimum version of 5.

See also:
  sswf::TagExport::SetObject(sswf_id_t id, const char *name)

  sswf::TagEditText

Reimplemented from sswf::TagBase.

References sswf::Vectors::Count(), sswf::ErrorManager::ERROR_CODE_NONE, sswf::ErrorManager::ERROR_CODE_UNKNOWN_OBJECT_EXPORTED, sswf::TagExport::export_t::f_id, sswf::TagExport::export_t::f_name, f_objects, sswf::TagExport::export_t::f_used_glyphs, sswf::TagBase::FindTagWithID(), sswf::Vectors::Get(), sswf::TagBase::MinimumVersion(), sswf::TagBase::Name(), sswf::TagBase::OnError(), SWF_TYPE_DEFINE, and sswf::TagBase::TypeFlags().

ErrorManager::error_code_t TagExport::Save | ( | Data & | data | ) | `[virtual]`

This function saves the sswf::TagExport object in the specified sswf::Data object.

This tag is composed of a counter followed by an array of identifiers and names.

Implements sswf::TagBase.

References sswf::Data::Append(), sswf::Data::ByteSize(), sswf::Vectors::Count(), sswf::ErrorManager::ERROR_CODE_NONE, sswf::TagExport::export_t::f_id, sswf::TagExport::export_t::f_name, f_objects, sswf::Vectors::Get(), sswf::ErrorManager::KeepFirst(), sswf::Data::PutShort(), sswf::TagBase::SaveString(), sswf::TagBase::SaveTag(), and sswf::TagBase::SWF_TAG_EXPORT.

void TagExport::SetObject | ( | sswf_id_t | id,
|  | const char * | name,
|  | const char * | used_glyphs |
| ) |  |  |

This function is used to add one object reference and a name to the export tag.

The name is what the object will be found as from the external world. The reference id is the id of the object being exported. Note that exporting objects themselves referencing other objects such as a sprite is legal and implies that all the objects within that sprite are also exported. However, if these objects are not mentioned in the sswf::TagExport list of exported objects, they cannot be directly accessed.

The order in which objects are added does not matter. The TagExport itself, however, needs to appear after the objects being exported.

Note:
  The object being referenced must be a definition tag (i.e. its sswf::TagBase::TypeFlags() must return the sswf::TagBase::SWF_TYPE_DEFINE bit set).

Parameters:

  | id | The identifier of the object being exported.
  | name | This is the name used to find the object from an sswf::TagImport tag (i.e. the names must match.)
  | used_glyphs | A list of glyphs to include in a font; if not specified, all the glyphs are added.

References sswf::TagExport::export_t::f_id, sswf::TagExport::export_t::f_name, f_objects, sswf::TagExport::export_t::f_used_glyphs, sswf::MemoryManager::MemAttach(), sswf::Vectors::Set(), and sswf::MemoryManager::StrDup().

TagBase::swf_type_t TagExport::TypeFlags | ( | void |  | ) | const`[virtual]`

A TagExport is similar to a definition (DEFINE) event thought it does not really define much for this very movie.

Only one sswf::TagExport can be created in an entire movie (UNIQUE). I did not test, but it is likely that only the first or last sswf::TagExport has an effect. It is also possible that all sswf::TagExport tags are cumulative.

This tag includes one or more references.

Implements sswf::TagBase.

References SWF_TYPE_DEFINE, SWF_TYPE_REFERENCE, and SWF_TYPE_UNIQUE.

## Member Data Documentation

Vectors sswf::TagExport::f_objects`[private]`

Referenced by ParseTag(), PreSave(), Save(), and SetObject().

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

- libsswf.h
- libsswf_tag_export.c++