Made to Order Software Corporation Logo

libsswf: sswf::ActionURL Class Reference

Go to a static or dynamic URL. More...

#include <libsswf.h>

Inheritance diagram for sswf::ActionURL:

:Action :MemoryManager :ItemBase :MemBuffer

List of all members.


Public Types

enum  url_method_t {
  URL_METHOD_UNDEFINED = -1, URL_METHOD_NOVARIABLE = 0, URL_METHOD_NOVARIABLES = URL_METHOD_NOVARIABLE, URL_METHOD_GET = 1,
  URL_METHOD_POST = 2
}
 The different methods which can be used with the ActionURL. More...

Public Member Functions

 ActionURL (TagBase *tag, action_t action=ACTION_URL)
 Initialize the ActionURL action.
void SetMethod (url_method_t method)
 Set the method used to pass the URL to the browser.
void SetURL (const char *url, const char *target)
 Set the URL and target names.

Private Member Functions

virtual ActionDuplicate (void) const
 Create a clone of this action.
virtual ErrorManager::error_code_t ParseData (const Data &data)
 Parse the action extraneous data from the Data buffer.
virtual ErrorManager::error_code_t SaveData (Data &data, Data &nested_data)
 Save the action extraneous data in the Data buffer.

Private Attributes

url_method_t f_method
char * f_target
char * f_url

Detailed Description

The ActionURL class is used to define a URL to load in the user browser.

Use the SetURL() or SetMethod() functions to setup this action appropriately.

Note:
The ACTION_URL expects a SetURL() call.
The ACTION_URL2 expects a SetMethod() call.

If the ActionURL does not automatically choose which of the ACTION_URL or ACTION_URL2 to save it is because the former does not use the stack whereas the latter does. Thus this action by itself cannot know which action to save.

See also:
SWF Alexis' Reference—Get URL

SWF Alexis' Reference—Get URL 2


Member Enumeration Documentation

The ActionURL can pass the data to the server with a GET, a POST or with no variable.

See also:
sswf::ActionURL::URL_METHOD_UNDEFINED

sswf::ActionURL::URL_METHOD_NOVARIABLE

sswf::ActionURL::URL_METHOD_NOVARIABLES

sswf::ActionURL::URL_METHOD_GET

sswf::ActionURL::URL_METHOD_POST


Enumerator:
URL_METHOD_UNDEFINED  The method is still undefined.

This is the default method value. It is required to be defined before the action is saved in a Flash animation.


URL_METHOD_NOVARIABLE  Send the request without any variable.

Send the URL with no variable.


URL_METHOD_NOVARIABLES  Send the request without any variable.

Send the URL with no variable.


URL_METHOD_GET  Send the request using an HTTP GET.

Send the request as an HTTP GET with the variables appended at the end of the URL.


URL_METHOD_POST  Send the request using an HTTP POST.

Send the request as an HTTP POST with the variables sent one per line, starting on the line after the URL.


Constructor & Destructor Documentation

ActionURL::ActionURL ( TagBase tag,
action_t  action = ACTION_URL 
)

The constructor defines default values to the different variable members. It sets the URL to none, the target to none and the method to URL_METHOD_NOVARIABLES.

This function can be called with either ACTION_URL or ACTION_URL2.

Parameters:
[in] tag The tag in which this action is being added
[in] action The SWF action to save this action

References sswf::Action::ACTION_URL, sswf::Action::ACTION_URL2, sswf::assert(), f_method, f_target, f_url, and URL_METHOD_NOVARIABLES.

Referenced by Duplicate().


Member Function Documentation

Action * ActionURL::Duplicate ( void   )  const [private, virtual]

This function creates a new ActionURL object and copy the URL, target and method in it. Finally, it returns the pointer to the new action.

Returns:
The pointer to the clone action

Reimplemented from sswf::Action.

References ActionURL(), sswf::Action::f_action, f_method, f_target, f_url, SetMethod(), SetURL(), and sswf::Action::Tag().

ErrorManager::error_code_t ActionURL::ParseData ( const Data data  )  [private, virtual]

This function parses the URL/target information (ACTION_URL) or the method (ACTION_URL2) from the specified Data buffer.

Parameters:
[in] data The Data buffer from which the URL information is parse
Returns:
An error code or ERROR_CODE_NONE

Reimplemented from sswf::Action.

References sswf::Action::ACTION_URL, sswf::ErrorManager::ERROR_CODE_NONE, sswf::Action::f_action, f_method, f_target, f_url, sswf::Data::GetByte(), and sswf::Data::GetString().

ErrorManager::error_code_t ActionURL::SaveData ( Data data,
Data nested_data 
) [private, virtual]

This function saves the URL/target information (ACTION_URL) or the method (ACTION_URL2) in the specified Data buffer.

Parameters:
[in] data The Data buffer where the URL information is saved
[in] nested_data There is no nested data in an ActionURL
Returns:
An error code or ERROR_CODE_NONE

Reimplemented from sswf::Action.

References sswf::Action::ACTION_URL, sswf::ErrorManager::ERROR_CODE_NONE, sswf::Action::f_action, f_method, f_target, f_url, sswf::ErrorManager::KeepFirst(), sswf::Data::PutByte(), and sswf::Action::SaveString().

void ActionURL::SetMethod ( url_method_t  method  ) 

Set the method to use execute the URL, this assumes that you defined this action as an ACTION_URL2. This is one of the following values:

URL_METHOD_NOVARIABLE or URL_METHOD_NOVARIABLES URL_METHOD_GET URL_METHOD_POST

Parameters:
[in] method One of the available methods

References f_method.

Referenced by Duplicate().

void ActionURL::SetURL ( const char *  url,
const char *  target 
)

This function is used to define a valid URL and target.

The target can be the name of a window or set to '_top' to replace the content of the current window.

This function assumes that you defined the action as ACTION_URL.

Parameters:
[in] url A standard URL (i.e. http://sswf.m2osw.com)
[in] target A window name or a standard HTML target

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

Referenced by Duplicate().


Member Data Documentation


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


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