Made to Order Software Corporation Logo

libsswf: sswf::TagMetadata Class Reference

The description of the SWF animation in humain language. More...

#include <libsswf.h>

Inheritance diagram for sswf::TagMetadata:

:TagBase :MemoryManager

List of all members.


Public Member Functions

virtual ErrorManager::error_code_t Save (Data &data)
 Save the TagMetadata tag.
void SetAuthor (const char *description)
 Defines the name of the SWF animation (main) author.
void SetCopyright (const char *copyright)
 Defines the legal information in regard to this SWF animation.
void SetDescription (const char *description)
 Defines the description of the SWF animation.
void SetFilename (const char *filename)
 Define the name of an XML file with the description.
void SetMetadata (const char *xml)
 Set a string which represents the whole XML metadata.
void SetPublisher (const char *publisher)
 Defines the name of the SWF animation publisher.
void SetTitle (const char *title)
 Defines the title.
void SetURL (const char *url)
 Defines a link to the source of the movie.
 TagMetadata (TagBase *parent)
 Initializes the TagMetadata object.
virtual swf_type_t TypeFlags (void) const
 Return the type of the metadata tag.

Private Member Functions

virtual ErrorManager::error_code_t ParseTag (swf_tag_t tag, const Data &data)
virtual ErrorManager::error_code_t PreSave (void)
 Inform the system that version 8 is required.

Private Attributes

char * f_author
char * f_copyright
char * f_description
char * f_filename
char * f_publisher
char * f_title
char * f_url
char * f_xml

Detailed Description

This class handles the metadata tag which encapsulate a full description of your SWF animation.

The description needs to be saved in a valid XML format as described in my reference: Alexis' SWF Reference—Metadata You can also look at this .c++ file which can generate a simplified XML description file.

This tag should appear very early on in the SWF file so search engines which will use this information do not have to upload the entire file to find the metadata tag.

Warning:
Notice that the TagMetadata requires one group of data to be defined to work properly. The groups are as follow:
Set the filename of an XML file including valid content for an TagMetadata XML buffer. All the other calls are ignored when this one call is made with a non-empty string.
Set the XML buffer directly. All the other calls, except SetFilename(), are ignored when this SetMetadata() function is called.
Any one of these functions will set a specific entry in the XML output. SSWF will take care of generating the XML code. The string of these functions should be plain text without any XML tags.
  • none of these calls
If nothing is defined, then the default provided by SSWF is saved as the SWF animation description.
See also:
Alexis' SWF Reference—Metadata

SWF Alexis' Reference—swf_tag


Constructor & Destructor Documentation

TagMetadata::TagMetadata ( TagBase parent  ) 

The constructor initializes a TagMetadata with no user description by default. If no description is added, then a default SSWF description is saved in the resulting SWF movie.

Parameters:
parent The sswf::TagHeader where this sswf::TagMetadata is inserted

References f_author, f_copyright, f_description, f_filename, f_publisher, f_title, f_url, and f_xml.


Member Function Documentation

virtual ErrorManager::error_code_t sswf::TagMetadata::ParseTag ( swf_tag_t  tag,
const Data data 
) [private, virtual]

Implements sswf::TagBase.

ErrorManager::error_code_t TagMetadata::PreSave ( void   )  [private, virtual]

This function is used by the TagMetadata to tell the Save() command that to save this tag a version 8 movie is required.

Returns:
ErrorManager::ERROR_CODE_NONE when no error occurs, and some other ErrorManager::error_code_t otherwise

Reimplemented from sswf::TagBase.

References sswf::ErrorManager::ERROR_CODE_NONE, and sswf::TagBase::MinimumVersion().

ErrorManager::error_code_t TagMetadata::Save ( Data data  )  [virtual]

This function saves the TagMetadata in the specified Data buffer.

The function creates the XML data for the TagMetadata tag and save the result in the data parameter.

The function tries to optimize the XML as much as possible.

Todo:
The loading and optimization code should probably be in a separate set of functions so one could check out what the XML is at anything.
Returns:
ErrorManager::ERROR_CODE_NONE when no error occurs, and some other ErrorManager::error_code_t otherwise

Implements sswf::TagBase.

References sswf::ErrorManager::ERROR_CODE_FILE_NOT_FOUND, sswf::ErrorManager::ERROR_CODE_IO, sswf::ErrorManager::ERROR_CODE_NONE, f_author, f_copyright, f_description, f_filename, f_publisher, f_title, f_url, f_xml, is_space(), sswf::MemoryManager::MemAlloc(), sswf::MemoryManager::MemFree(), sswf::TagBase::OnError(), sswf::TagBase::SaveTag(), sswf::MemoryManager::StrCat(), sswf::MemoryManager::StrDup(), sswf::TagBase::SWF_TAG_METADATA, and sswf::Data::Write().

void TagMetadata::SetAuthor ( const char *  author  ) 

Define the name of the SWF animation author. Unfortunately, this function does no currently support more than one author name.

Parameters:
author The name of the author; at this time, you can add multiple authors by adding semi-colon between names
See also:
sswf::TagMetadata::SetCopyright

sswf::TagMetadata::SetDescription

sswf::TagMetadata::SetPublisher

sswf::TagMetadata::SetTitle

sswf::TagMetadata::SetURL

References f_author, sswf::MemoryManager::MemFree(), and sswf::MemoryManager::StrDup().

void TagMetadata::SetCopyright ( const char *  copyright  ) 

Define legal information in link with the SWF animation. This is often a copyright statement including the year of publication.

This string can also defines the rights of the users in regard to this movie (i.e. free content, proprietary under patent, etc.)

Parameters:
copyright The copyright in some humain language
See also:
sswf::TagMetadata::SetAuthor

sswf::TagMetadata::SetDescription

sswf::TagMetadata::SetPublisher

sswf::TagMetadata::SetTitle

sswf::TagMetadata::SetURL

References f_copyright, sswf::MemoryManager::MemFree(), and sswf::MemoryManager::StrDup().

void TagMetadata::SetDescription ( const char *  description  ) 

Define the SWF animation description. This can be a very long string. There is no limit imposed.

Parameters:
description The description of the SWF animation
See also:
sswf::TagMetadata::SetAuthor

sswf::TagMetadata::SetCopyright

sswf::TagMetadata::SetPublisher

sswf::TagMetadata::SetTitle

sswf::TagMetadata::SetURL

References f_description, sswf::MemoryManager::MemFree(), and sswf::MemoryManager::StrDup().

void TagMetadata::SetFilename ( const char *  filename  ) 

This function can be used to define the name of a file holding the XML to be saved in the TagMetadata. The SSWF library will read the file at the time the tag is being saved.

The library does not check the content validity. You can use xmllint for that purpose.

Parameters:
filename The name of an XML file to read for the metadata
See also:
sswf::TagMetadata::SetMetadata

References f_filename, sswf::MemoryManager::MemFree(), and sswf::MemoryManager::StrDup().

void TagMetadata::SetMetadata ( const char *  xml  ) 

This function defines the entire XML metadata in one string. SSWF will directly save this string. At this time, SSWF does not check for the validity of the string.

Parameters:
xml The direct XML as the description of the SWF animation
See also:
sswf::TagMetadata::SetFilename

References f_xml, sswf::MemoryManager::MemFree(), and sswf::MemoryManager::StrDup().

void TagMetadata::SetPublisher ( const char *  publisher  ) 

Define the name of the SWF animation publisher. This is often the name of the company the author is working with. If you create a movie for yourself, you can put your own name.

Parameters:
publisher The name (and at times address, phone number, etc.) of the publisher
See also:
sswf::TagMetadata::SetAuthor

sswf::TagMetadata::SetCopyright

sswf::TagMetadata::SetDescription

sswf::TagMetadata::SetTitle

sswf::TagMetadata::SetURL

References f_publisher, sswf::MemoryManager::MemFree(), and sswf::MemoryManager::StrDup().

void TagMetadata::SetTitle ( const char *  title  ) 

void TagMetadata::SetURL ( const char *  url  ) 

Movies can easily be copied. This enables the search engines to know of the real source of the animation (until a hacker changes the URL, of course).

This should be your company or personal URL possibly directly to the page where the animation appears.

Parameters:
url The standard URL link to a webpage
See also:
sswf::TagMetadata::SetAuthor

sswf::TagMetadata::SetCopyright

sswf::TagMetadata::SetDescription

sswf::TagMetadata::SetPublisher

sswf::TagMetadata::SetTitle

References f_url, sswf::MemoryManager::MemFree(), and sswf::MemoryManager::StrDup().

TagBase::swf_type_t TagMetadata::TypeFlags ( void   )  const [virtual]

This function returns the type flags of the TagMetadata. The TagMetadata is a control, needs to be unique and should be close to the start of the movie.

Returns:
The set of flags representing an sswf::TagMetadata

Implements sswf::TagBase.

References SWF_TYPE_CONTROL, SWF_TYPE_START, and SWF_TYPE_UNIQUE.


Member Data Documentation

char* sswf::TagMetadata::f_author [private]

Referenced by Save(), SetAuthor(), and TagMetadata().

Referenced by Save(), SetCopyright(), and TagMetadata().

Referenced by Save(), SetFilename(), and TagMetadata().

Referenced by Save(), SetPublisher(), and TagMetadata().

char* sswf::TagMetadata::f_title [private]

Referenced by Save(), SetTitle(), and TagMetadata().

char* sswf::TagMetadata::f_url [private]

Referenced by Save(), SetURL(), and TagMetadata().

char* sswf::TagMetadata::f_xml [private]

Referenced by Save(), SetMetadata(), and TagMetadata().


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


Generated on Wed Mar 18 15:13:59 2009 for libsswf by  doxygen 1.5.5