Made to Order Software Corporation Logo

libsswf: sswf::TagScriptLimits Class Reference

Defines the limits to the script interpreter. More...

#include <libsswf.h>

Inheritance diagram for sswf::TagScriptLimits:

:TagBase :MemoryManager

List of all members.

Public Member Functions

int GetMaxRecursionDepth (void) const
 Reads the current recursion depth.
int GetTimeoutSeconds (void) const
 Reads the current time out period.
virtual ErrorManager::error_code_t Save (Data &data)
 Saves the script limits.
void SetMaxRecursionDepth (int depth)
 Defines the maximum recursion depth.
void SetTimeoutSeconds (int timeout)
 Defines the amount of time for completion.
 TagScriptLimits (TagBase *parent)
 Initialize a script limit tag.
virtual swf_type_t TypeFlags (void) const
 Get the type of a script limit tag.

Private Member Functions

virtual ErrorManager::error_code_t ParseTag (swf_tag_t tag, const Data &data)
virtual ErrorManager::error_code_t PreSave (void)
 Ensures the minimum version.

Private Attributes

int f_depth
int f_timeout

Detailed Description

This tag is used to limit the script execution in regard to recursivity, length of time it takes to execute a script, and some other such parameters.

See also:

SWF Alexis' Reference—Script Limits

SWF Alexis' Reference—swf_tag

Constructor & Destructor Documentation

TagScriptLimits::TagScriptLimits ( TagBase parent  ) 

This object can be added to a TagHeader and represents the limits to use to execute all the action scripts.

By default, there is no limit.

[in] parent The parent of the script limit tag

References f_depth, and f_timeout.

Member Function Documentation

int TagScriptLimits::GetMaxRecursionDepth ( void   )  const

The recursion depth set by SetMaxRecursionDepth() can be retreived with this function.

When set to zero, the player default is used.

The current recursion depth
See also:

References f_depth.

int TagScriptLimits::GetTimeoutSeconds ( void   )  const

The time out period set by SetTimeOutSeconds() function can be retreived with this function.

When set to zero, the player default is used.

The current time out in seconds
See also:

References f_timeout.

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

Implements sswf::TagBase.

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

This function requests that the movie be at least of version 7.

ErrorManager::ERROR_CODE_NONE when no error occured, an error otherwise

Reimplemented from sswf::TagBase.

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

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

This function saves the script limits to the output Data buffer.

If the depth is still zero, 256 is used.

If the timeout value is still zero, 20 is used.

[in,out] data The Data buffer where the data is saved
An error if one occurs, or ErrorManager::ERROR_CODE_NONE

Implements sswf::TagBase.

References sswf::ErrorManager::ERROR_CODE_NONE, f_depth, f_timeout, sswf::Data::PutShort(), sswf::TagBase::SaveTag(), and sswf::TagBase::SWF_TAG_SCRIPT_LIMITS.

void TagScriptLimits::SetMaxRecursionDepth ( int  depth  ) 

This function defines the depth that the Call action can go to. This is called the recursion limit since in general you will hit the limit when a function calls itself this many times. It is very unlikely that this isn't simply used as the number of calls within calls can be done (A calls B, B calls C, C calls D is a depth of 3.)

In general, the default value is enough. You may want to increase this value if you have more level of recursion.

The value is limited between 1 and 65535.

[in] depth The depth level of recursion
See also:

References f_depth.

void TagScriptLimits::SetTimeoutSeconds ( int  timeout  ) 

This function defines the number of seconds a script can take before to be timed out.

Obviously, for a realtime movie, anything taking more than a few milliseconds is slow. So even 1 second will be considered very long.

Yet, if you use an ActionScript to do some complex mathematical computations, you may want to increase this timeout.

The value is limited between 1 and 65535.

See also:

References f_timeout.

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

This function determines what the type of a script limit tag is.


Implements sswf::TagBase.


Member Data Documentation

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

Generated on Wed Mar 18 15:14:00 2009 for libsswf by  doxygen 1.5.5