libsswf: libsswf.h File Reference

# libsswf.h File Reference

The header to include to use the SSWF C++ library. More...

Go to the source code of this file.

## Namespaces
namespace | sswf
## Classes
class | sswf::Action
| Holds an action. More...
class | sswf::ActionBranch
| An action to change the execution pointer. More...
class | sswf::ActionCallFrame
| Change the SWF pointer to the specified frame. More...
class | sswf::ActionDictionary
| Create a dictionary action. More...
struct | sswf::ActionDictionary::string_t
| Holds one dictionary string. More...
class | sswf::ActionFunction
| The action to hold an ActionScript function. More...
struct | sswf::ActionFunction::parameter_t
| Hold the parameters name and register number. More...
class | sswf::ActionGoto
| A goto action to change the current frame. More...
class | sswf::ActionLabel
| Create a label in an action script. More...
class | sswf::ActionPushData
| The PushData action adds data on the ActionScript stack. More...
struct | sswf::ActionPushData::action_immediate_t
| One data entry of a PushData action. More...
class | sswf::ActionSetTarget
| This class is used to define the sprite on which the actions apply. More...
class | sswf::ActionStoreRegister
| Store the top stack value in a register. More...
class | sswf::ActionStrictMode
| This action is used to define the current scripting mode. More...
class | sswf::ActionTry
| This action encompasses the Try, Catch and Finally actions. More...
class | sswf::ActionURL
| Go to a static or dynamic URL. More...
class | sswf::ActionWaitForFrame
| Create an action used to wait for a frame to be loaded. More...
class | sswf::ActionWith
| Block including variable member names refering to the With object. More...
class | sswf::BlendMode
| The mode used to render the object on the screen. More...
class | sswf::Buffer
| Linked list of memory buffers for easy memory management. More...
struct | sswf::Buffer::mem_buffer_t
| Hold the magic and a pointer to the actual buffer. More...
class | sswf::Color
| A small object to hold an SWF color. More...
class | sswf::ColorTransform
| The simple color transform of a TagPlace tag. More...
class | sswf::Data
| Buffer object used to save the SWF movie. More...
class | sswf::Data::DataLimit
class | sswf::Edges
| List of coordinates to draw shapes. More...
struct | sswf::Edges::array_edge_t
| One set of edges; when full, allocate another. More...
class | sswf::Edges::edge_t
| The basic structure used to hold the coordinates of an edge. More...
class | sswf::Envelope
| An array of volumes for a sound effect. More...
class | sswf::ErrorManager
| This class helps the user to know what errors occur in the library. More...
class | sswf::ErrorManager::ErrorHandler
| A sub-class to derive from to receive errors. More...
class | sswf::ErrorManager::InternalErrorException
| Class defined to throw exceptions in the library. More...
class | sswf::ErrorManager::OutOfBoundsErrorException
class | sswf::Event
| The Event class used to declare the events a button or place object support. More...
struct | sswf::Event::event_names_t
| Internal structure used to save event name names and their corresponding bits. More...
struct | sswf::Event::key_names_t
| This is an internal structure used to list keys and their code. More...
class | sswf::ItemBase
| This class is used to derive from. More...
class | sswf::Matrix
| The position matrix. More...
struct | sswf::Matrix::signed_matrix_t
| Matrix of longs; used to compute the matrix to be saved in the movie. More...
class | sswf::MemBuffer
| A type of smart pointer used to manage memory buffers. More...
class | sswf::MemoryManager
| A garbage collector manager. More...
class | sswf::SoundInfo
| Information about out to playback a sound effect. More...
class | sswf::SRectangle
| The SWF rectangle. More...
class | sswf::State
| The state a button will react to. More...
class | sswf::Style
| Defines the style of a shape. More...
class | sswf::TagBase
| The base of all the tags. More...
class | sswf::TagBaseID
| The base of all the tags with an ID. More...
class | sswf::TagBinaryData
| Binary data reusable by the ActionScripts. More...
class | sswf::TagButton
| Create an active area. More...
class | sswf::TagCSMTextSettings
| Defines extraneous settings for text tags. More...
class | sswf::TagDoAction
| This tag hold an ActionScript. More...
class | sswf::TagEditText
| Defines a dynamic edit text box. More...
class | sswf::TagEnd
| Mark the end of a list of tags. More...
class | sswf::TagExport
| The object used to export objects to another movie. More...
struct | sswf::TagExport::export_t
| One export entry with the identifier of the object to export and the export name. More...
class | sswf::TagFont
| Define a system or embedded font. More...
struct | sswf::TagFont::font_glyph_t
| Structure used to represent a glyph. More...
struct | sswf::TagFont::font_info_t
| Structure used to handle one glyph information. More...
struct | sswf::TagFont::font_kern_t
| Structure used to define one kern entry. More...
class | sswf::TagFrameLabel
| Defines a label (name) for a frame. More...
class | sswf::TagHeader
| The header or root of the SWF movie. More...
class | sswf::TagHeader::Factory
class | sswf::TagImage
| The image class in SWF. More...
struct | sswf::TagImage::image_t
| Defines a bitmap. More...
class | sswf::TagImport
| Import a set of object defined in another movie. More...
struct | sswf::TagImport::import_t
| Defines each imported object identifier, name and type. More...
class | sswf::TagInfo
| An attempt in creating a TagInfo. More...
class | sswf::TagMetadata
| The description of the SWF animation in humain language. More...
class | sswf::TagPlace
| Tag used to place (or remove) an object in the display list. More...
class | sswf::TagProductInfo
| Information about the software creating the output animation. More...
class | sswf::TagProtect
| Mark the movie as protected. More...
class | sswf::TagRemove
| Remove an object from the display list. More...
class | sswf::TagScalingGrid
| Defines a grid to scale windows, buttons and other objects with edges. More...
class | sswf::TagSceneFrameData
| Raw data for your scene and frame. More...
class | sswf::TagScriptLimits
| Defines the limits to the script interpreter. More...
class | sswf::TagSetBackgroundColor
| Set the background color of the movie. More...
class | sswf::TagSetTabIndex
| Set the tab key index for objects. More...
class | sswf::TagShape
| Defines an SWF shape. More...
struct | sswf::TagShape::save_info_t
| Holds information used to save a shape. More...
struct | sswf::TagShape::shape_edges_t
| The set of edges: line and curve segments. More...
struct | sswf::TagShape::shape_record_t
| Records to separate different sets of styles. More...
struct | sswf::TagShape::shape_setup_t
| The set of setup: fill, line and move. More...
struct | sswf::TagShape::shape_what_t
| A base class to define edges and setup information. More...
class | sswf::TagShowFrame
| Tag marking the limit between each frame. More...
class | sswf::TagSound
| Declare a sound. More...
struct | sswf::TagSound::sound_wave_t
| defines an MP3 sound wave (format, channels, rate, alignment, etc.) More...
class | sswf::TagSprite
| Group shapes, sprites, texts, buttons, sound, etc. More...
class | sswf::TagStartSound
| Class used to start/stop a sound. More...
class | sswf::TagText
| Enter a label (text string) in an SWF file. More...
struct | sswf::TagText::text_define_t
| Structure used to memories the type of definition. More...
struct | sswf::TagText::text_entry_t
| Structure representing a text entry (an actual string). More...
struct | sswf::TagText::text_setup_t
| Structure representing a text setup. More...
class | sswf::Vectors
| Manages an array of pointers to other objects. More...
## Defines
#define | exposed_class class
| Defines an exposed class.
#define | ICONV_INPUT_CAST (char**)
| The second parameter of iconv() changes from system to system.
#define | invisible public
| Renders the following members invisible.
#define | M_PI 3.14159265358979323846
| A close representation of PI.
#define | SSWF_ALIGN(value, modulo) (((value) + ((modulo) - 1)) & - (long) (modulo))
| Align 'value' according to 'modulo'.
#define | SSWF_EVENT_CONDITIONS 0xC001FC00
| Defines all the condition flags available in DefineButton2.
#define | SSWF_EVENT_COUNT 20
| The total number of events supported by SWF.
#define | SSWF_EVENT_V5 0x0000FF01
| The mask of events supported in version 5.
#define | SSWF_EVENT_V6 0x000300FE
| The mask of events supported in version 6.
#define | SSWF_EVENT_V7 0x00040000
| The mask of events supported in version 7.
#define | SSWF_FONT_SPACE_INDEX static_cast<unsigned long>(-1)
| The index where the space is saved in a font.
#define | SSWF_ID_NONE ((sswf_id_t) -1)
| The special identifier 'none'.
#define | SSWF_KEY_COUNT 15
| The number of special key codes.
#define | SSWF_SAFE 0
| The size of the safe area around allocated memory buffers.
#define | SSWF_SPACE SSWF_ALIGN(sizeof(mem_buffer_t), sizeof(double))
| Space reserved for the memory header blocks.
Tag types
These flags define the type of the different tags available in the SSWF library.
#define | SWF_TYPE_CONTROL 0x00000002
| The bit defining a control tag (i.e. sswf::TagPlace).
#define | SWF_TYPE_DEFINE 0x00000001
| The bit defining a definition tag (i.e. sswf::TagSprite).
#define | SWF_TYPE_HAS_ID 0x00000040
| The bit defining a tag derived from sswf::TagBaseID.
#define | SWF_TYPE_HEADER 0x80000000
| Only the sswf::TagHeader has this bit set.
#define | SWF_TYPE_ONE 0x00000010
| The bit defining a tag which should appear once in an entire frame.
#define | SWF_TYPE_REFERENCE 0x00000020
| The bit defining a tag which includes a reference to another tag.
#define | SWF_TYPE_SCRIPT 0x20000000
| The bit defining a tag which supports scripts (i.e. sswf::TagDoAction).
#define | SWF_TYPE_SPRITE 0x40000000
| Only sswf::TagSprite objects have this bit set.
#define | SWF_TYPE_START 0x00000008
| The bit defining a tag which should appear early in the movie.
#define | SWF_TYPE_UNIQUE 0x00000004
| The bit defining a tag which should be unique in the entire movie.
## Typedefs
typedef unsigned short | sswf::sswf_frame_t
| Used to represent a frame number.
typedef unsigned short | sswf::sswf_id_t
| Type defining the identifier of an SWF object.
typedef int32_t | sswf::sswf_ucs4_t
| A type to support UCS-4 characters.
typedef unsigned int | wint_t
| This type is also used for wide characters.
## Functions
void | sswf::assert (int cond, const char *format,...) __attribute__((format(printf
| Stop the processing with a message about the test.
int | sswf::mbtowc (const char *mb, size_t mb_len, sswf_ucs4_t *&wc, size_t &wc_len)
| Transform a multi-byte string in a wide character string.
const char * | sswf::sswf_version (void)
| Return the version of the SSWF library.
void | sswf::swap (void *s1, void *s2, size_t size)
| Swap the content of two buffers.
unsigned int | sswf::swap_int (unsigned int l)
| Swap the bytes of a 32 bits integer.
unsigned short | sswf::swap_short (unsigned short s)
| Swap the bytes of a 16 bits integer.
char * | sswf::wcname (sswf_ucs4_t wc, char *result)
| Transform a wide character in a display name.
long | sswf::wcslen (sswf_ucs4_t *wcstr)
| Compute the length of a wide character string.
int | sswf::wctomb (const sswf_ucs4_t *wc, size_t wc_len, char *mb, size_t &mb_len)
| Convert a wide character string to a multi-byte string.

## Detailed Description

The libsswf.h file includes all the necessary classes for the SSWF library.

## Define Documentation

#define exposed_class class

The SSWF library can be used in C++ and in C. All the classes which are exposed to the C users are defined as 'exposed_class' instead of just 'class'.

The "only" problem with the use of this exposed_class #define is the fact that Doxygen does not understand the default classes. So I have to replace it with just 'class' and then the libsswf.h file looks like it comes from tmp/libsswf.h instead of the include/sswf/libsswf.h...

#define ICONV_INPUT_CAST (char**)

The iconv() call from FreeBSD & MacOS/X differs from the Linux & Windows versions. One uses a 'const char **' and the other just a 'char **'. This is used to call iconv() without having to have #ifdef around each call.

So, in one case the ICONV_INPUT_CAST is defined to nothing and in the other case it is set the (char **).

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

#define invisible public

This is a brand new C++ extension! In order to expose the C++ library to C people, I needed to create a parser which would see everything which needs to be made available in the C library.

The problem is that a certain number of structures include functions. These cannot easilly be offered to C programmers and thus I hid them (I marked them invisible.)

In C++, this is 100% equivalent to public. For my parser, it is very much equivalent to private.

#define M_PI 3.14159265358979323846

The Microsoft headers somehow do not offer M_PI.

Referenced by sswf::Matrix::SetRotate().

#define SSWF_ALIGN | ( | value,
|  | modulo |  | ) | (((value) + ((modulo) - 1)) & - (long) (modulo))

This function aligns the offset in 'value' to the next multiple of 'module'. Modulo MUST be a power of 2 for this macro to work properly. The macro does not check the validity of modulo.

See also:
  sswf::Buffer

  SSWF_SPACE

Referenced by sswf::Buffer::Buffer(), and sswf::Buffer::Realloc().

#define SSWF_EVENT_CONDITIONS 0xC001FC00

This mask can be used to know whether flags for DefineButton2 are used in a condition.

See also:
  sswf::Event

  SSWF_EVENT_V5

  SSWF_EVENT_V6

  SSWF_EVENT_V7

Referenced by sswf::TagButton::AddEvent(), and sswf::TagButton::PreSave().

#define SSWF_EVENT_COUNT 20

This counter gives you the total number of events supported by SWF.

All the events have a name which is defined in the sswf::Event::f_event_names array. This #define represents the size of that array.

See also:
  sswf::Event

  sswf::Event::f_event_names

Referenced by sswf::Event::StringToEvents(), and sswf::Event::StringToKeyCode().

#define SSWF_EVENT_V5 0x0000FF01

This definition represents all the events supported in version 5 of SWF.

If no other bits are set, then you can save the tag in an SWF version 5.

See also:
  sswf::Event

  SSWF_EVENT_V6

  SSWF_EVENT_V7

Referenced by sswf::TagPlace::AddEvent(), and sswf::TagPlace::PreSave().

#define SSWF_EVENT_V6 0x000300FE

This definition represents all the events supported in version 6 of SWF.

If only bits from SSWF_EVENT_V5 and SSWF_EVENT_V6 are set, then you can save the tag in an SWF version 6.

See also:
  sswf::Event

  SSWF_EVENT_V5

  SSWF_EVENT_V7

Referenced by sswf::TagPlace::AddEvent(), and sswf::TagPlace::PreSave().

#define SSWF_EVENT_V7 0x00040000

This definition represents all the events supported in version 6 of SWF.

If only bits from SSWF_EVENT_V5, SSWF_EVENT_V6 and SSWF_EVENT_V7 are set, then you can save the tag in an SWF version 7.

See also:
  sswf::Event

  SSWF_EVENT_V5

  SSWF_EVENT_V6

Referenced by sswf::TagPlace::AddEvent(), and sswf::TagPlace::PreSave().

#define SSWF_FONT_SPACE_INDEX static_cast<unsigned long>(-1)

The space character is peculiar in a font definition since multiple character can be "rendered" as a space (i.e. really, there is nothing to render for a space.)

Thus this special index is used in order to be capable of accepting multiple definition of the space character.

See also:
  sswf::TagFont

Referenced by sswf::TagFont::AddGlyph(), and sswf::TagFont::FindGlyph().

#define SSWF_ID_NONE ((sswf_id_t) -1)

This value is used as the "undefined identifier" marker. This is used primarily for glyphs (shapes) which are added to a font as characters. These do not need an identifier.

It can also be used for references which are not yet defined.

See also:
  sswf::TagBaseID

  sswf::TagShape

Referenced by sswf::TagBase::FindID(), sswf::TagBaseID::NoIdentification(), sswf::TagRemove::PreSave(), sswf::Style::Reset(), sswf::TagRemove::Save(), sswf::Style::SetClipping(), sswf::TagBaseID::TagBaseID(), and sswf::TagRemove::TagRemove().

#define SSWF_KEY_COUNT 15

The special keys that SWF understands are defined with their code and name in the sswf::Event::f_key_names array. This #define represents the size of that array.

See also:
  sswf::Event

  sswf::Event::f_key_names

#define SSWF_SAFE 0

In debug mode, buffers are allocated with some extra safe guards before and after. If these are written to, checking the block of memory or trying to release the block of memory will generate an assertion.

In release, the safe area is set to 0 meaning that there is none so watch out!

See also:
  sswf::assert(int cond, const char *format, ...)

Referenced by sswf::Buffer::Buffer(), sswf::Buffer::FindBuffer(), sswf::Buffer::Realloc(), and sswf::Buffer::~Buffer().

#define SSWF_SPACE SSWF_ALIGN(sizeof(mem_buffer_t), sizeof(double))

Any memory block allocated by the SSWF library has a header defined by sswf::Buffer::mem_buffer_t. This size of this header is such that you can allocated a buffer for double values which are properly aligned. Note that will not work properly for MMX memory access or long double.

See also:
  SSWF_ALIGN

Referenced by sswf::Buffer::Buffer(), sswf::Buffer::FindBuffer(), sswf::Buffer::Realloc(), and sswf::Buffer::~Buffer().

#define SWF_TYPE_CONTROL 0x00000002

When this bit is set, the tag represents a control tag.

See also:
  SWF_TYPE_DEFINE

Referenced by sswf::TagStartSound::TypeFlags(), sswf::TagShowFrame::TypeFlags(), sswf::TagRemove::TypeFlags(), sswf::TagProtect::TypeFlags(), sswf::TagPlace::TypeFlags(), sswf::TagMetadata::TypeFlags(), sswf::TagFrameLabel::TypeFlags(), sswf::TagEnd::TypeFlags(), and sswf::TagDoAction::TypeFlags().

#define SWF_TYPE_DEFINE 0x00000001

When this bit is set, the tag represents a definition tag.

Another bit defines control tags. When neither are set, it is usually an SWF format tag.

See also:
  SWF_TYPE_CONTROL

Referenced by sswf::TagExport::PreSave(), sswf::TagText::TypeFlags(), sswf::TagSprite::TypeFlags(), sswf::TagSound::TypeFlags(), sswf::TagShape::TypeFlags(), sswf::TagSetTabIndex::TypeFlags(), sswf::TagSetBackgroundColor::TypeFlags(), sswf::TagScriptLimits::TypeFlags(), sswf::TagSceneFrameData::TypeFlags(), sswf::TagInfo::TypeFlags(), sswf::TagProductInfo::TypeFlags(), sswf::TagImport::TypeFlags(), sswf::TagImage::TypeFlags(), sswf::TagFont::TypeFlags(), sswf::TagExport::TypeFlags(), sswf::TagEditText::TypeFlags(), sswf::TagButton::TypeFlags(), and sswf::TagBinaryData::TypeFlags().

#define SWF_TYPE_HAS_ID 0x00000040

This bit is set on all the tags which derive from sswf::TagBaseID.

Referenced by sswf::TagBase::FindID(), sswf::TagText::TypeFlags(), sswf::TagSprite::TypeFlags(), sswf::TagSound::TypeFlags(), sswf::TagShape::TypeFlags(), sswf::TagImage::TypeFlags(), sswf::TagFont::TypeFlags(), and sswf::TagButton::TypeFlags().

#define SWF_TYPE_HEADER 0x80000000

Only the sswf::TagHeader object has this bit set. It is used here and there to know whether a tag is in a sprite or directly in the header.

See also:
  SWF_TYPE_SPRITE

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

#define SWF_TYPE_ONE 0x00000010

Tags marked with this bit represent tags which can be used at most once within a frame (between two sswf::TagShowFrame tags).

See also:
  SWF_TYPE_UNIQUE

Referenced by sswf::TagDoAction::TypeFlags().

#define SWF_TYPE_REFERENCE 0x00000020

This bit is set on tags which reference others (sswf::TagPlace).

Referenced by sswf::TagText::TypeFlags(), sswf::TagSprite::TypeFlags(), sswf::TagStartSound::TypeFlags(), sswf::TagShape::TypeFlags(), sswf::TagRemove::TypeFlags(), sswf::TagPlace::TypeFlags(), sswf::TagExport::TypeFlags(), sswf::TagEditText::TypeFlags(), sswf::TagDoAction::TypeFlags(), and sswf::TagButton::TypeFlags().

#define SWF_TYPE_SCRIPT 0x20000000

This flag is set in all the tags which can include an ActionScript.

See also:
  sswf::TagDoAction

  sswf::TagButton

  sswf::TagPlace

Referenced by sswf::TagSprite::TypeFlags(), sswf::TagPlace::TypeFlags(), sswf::TagDoAction::TypeFlags(), and sswf::TagButton::TypeFlags().

#define SWF_TYPE_SPRITE 0x40000000

At this time, only the sswf::TagSprite objects have this bit set.

See also:
  SWF_TYPE_HEADER

Referenced by sswf::TagSprite::TypeFlags().

#define SWF_TYPE_START 0x00000008

Some tags, such as the sswf::TagMetadata, should be defined early in the movie (one of the first format tags.) This bit is set on such tags. The order is unspecified and is usually not an issue.

Referenced by sswf::TagSetBackgroundColor::TypeFlags(), sswf::TagProtect::TypeFlags(), sswf::TagMetadata::TypeFlags(), and sswf::TagHeader::TypeFlags().

#define SWF_TYPE_UNIQUE 0x00000004

Some tags, such as sswf::SetBackgroundColor, cannot be defined more than once in the entire movie. This flag is set on such tags.

See also:
  SWF_TYPE_ONE

Referenced by sswf::TagSetBackgroundColor::TypeFlags(), sswf::TagProtect::TypeFlags(), sswf::TagMetadata::TypeFlags(), sswf::TagHeader::TypeFlags(), and sswf::TagExport::TypeFlags().

## Typedef Documentation

unsigned int wint_t

Some system functions require the use of the wint_t for wide characters. However, the wint_t is not defined on all systems, so it is defined here for that reason.

Otherwise, wint_t is pretty much the same as sswf_ucs4_t.

See also:
  typedef int32_t sswf::sswf_ucs4_t;