diff options
Diffstat (limited to 'include/Action.h')
-rw-r--r-- | include/Action.h | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/include/Action.h b/include/Action.h index 2a4c75a..6110945 100644 --- a/include/Action.h +++ b/include/Action.h @@ -6,20 +6,45 @@ #include <Variables.h> #include <Exceptions.h> +//! This is the basic HTTP action. +/*! + This pure virtual class contains the framework to build a basic HTTP action. +*/ class Action : public Base { public: - Action(const String & = ""); + //! The provided string should contain the url of that action. + /*! + If no URL is provided, one will be generated on the fly. + */ + Action(const String & url = ""); virtual ~Action(); + //! Will recursively resolve an URL, and return the corresponding action, or NULL if not found. Action * Look4URL(const String &); - virtual Task * Do(Variables *, Variables *, Handle *) = 0; + //! This pure virtual method has to be filled. It will be launched if the URL is called. + /*! + This method will be called when the URL gets invoked. The vars variable will contain the POST + or GET variables. The headers is a single list of the HTTP headers. And the out handle will + be dumped as the output to the brower. + */ + virtual Task * Do(Variables * vars, Variables * headers, Handle * out) = 0; + //! This helper will dump the basic HTML headers. virtual void SendHead(Handle *); + //! This helper will dump the basic HTML footers. virtual void SendFoot(Handle *); - virtual void ShowButton(Handle *, const String & = " Ok ", const String & = "start"); + //! This helper will display a button. + /*! + The button will have the caption provided, and will redirect to the provided url. + */ + virtual void ShowButton(Handle *, const String & caption = " Ok ", const String & url = "start"); + //! This pure virtual method has to gives the page title. Will be used in SendHead. virtual String GetTitle(void) = 0; + //! This returns the recorded URL for that action. String GetURL(void); + //! Mark this action to be erased as soon as the Do method ends. void CleanUp(void); protected: + //! Mark this action as beeing accessed. void Accessed(void); private: |