summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2004-11-28 12:20:10 +0000
committerpixel <pixel>2004-11-28 12:20:10 +0000
commit822168327ddf2e8963cf820caef0d119ca19515e (patch)
tree6e2be0f81366db16dcd8f729361176f2c90e2532
parent338315a055e9ba12f6e1111995235524cbab6f1a (diff)
Adding some doxygen stuff...
-rw-r--r--include/Action.h31
-rw-r--r--include/BLua.h6
-rw-r--r--include/Exceptions.h28
3 files changed, 58 insertions, 7 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:
diff --git a/include/BLua.h b/include/BLua.h
index e2fc852..07b1cff 100644
--- a/include/BLua.h
+++ b/include/BLua.h
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: BLua.h,v 1.19 2004-11-27 21:46:02 pixel Exp $ */
+/* $Id: BLua.h,v 1.20 2004-11-28 12:20:10 pixel Exp $ */
#ifndef __BLUA_H__
#define __BLUA_H__
@@ -37,6 +37,10 @@ extern "C" {
#include <Exceptions.h>
#include <Handle.h>
+//!Basic LUA engine.
+/*!
+ This will create an LUA context, and provide mechanisms to interact with it.
+*/
class Lua : public Base {
public:
Lua();
diff --git a/include/Exceptions.h b/include/Exceptions.h
index b630def..470ee45 100644
--- a/include/Exceptions.h
+++ b/include/Exceptions.h
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: Exceptions.h,v 1.39 2004-11-27 23:45:10 pixel Exp $ */
+/* $Id: Exceptions.h,v 1.40 2004-11-28 12:20:10 pixel Exp $ */
#ifndef __EXCEPTIONS_H__
#define __EXCEPTIONS_H__
@@ -43,6 +43,12 @@ struct ugly_string;
void xfree(unsigned char *&);
+//! The Base class, that everybody should use.
+/*!
+ This base class should be derivated for every single class you create. That
+ way, common functions will be overloaded and safe to use (like malloc)12~
+*/
+
class Base {
public:
virtual ~Base() {};
@@ -61,6 +67,7 @@ class Base {
}
static int pipe(int * p, int flag = 0);
static pid_t fork();
+ //! This wrapper will call the xexit function.
static void exit(int);
static void printm(int level, const ugly_string &, ...);
static void printm(int level, const char *, ...);
@@ -72,11 +79,18 @@ class Base {
static std::vector<String> context;
};
+//! Every exception class should inherit from this one.
+/*!
+ This generic class should be handled from the main, so that the software
+ can exit nicely if an exception is thrown, with a built-in message.
+*/
class GeneralException : public Base {
public:
+ //! The constructor has to provide a string describing the exception.
GeneralException(String);
GeneralException(const GeneralException &);
~GeneralException();
+ //! This should only be used by the exception manager in order to display what went wrong.
const char * GetMsg() const;
protected:
@@ -90,6 +104,7 @@ void * xmalloc(size_t) throw (GeneralException);
void * xrealloc(void *, size_t);
int xpipe(int *, int = 0) throw (GeneralException);
pid_t xfork() throw (GeneralException);
+//! This will simply throw the Exit exception.
void xexit(int) throw (GeneralException);
void xexception(const String &) throw (GeneralException);
@@ -130,10 +145,17 @@ class TaskSwitch : public GeneralException {
TaskSwitch();
};
+//! This exception can be thrown anyway, in order to exit nicely the software.
+/*!
+ My suggestion when using this exception, is to add a special manager, in order to
+ handle clean up, in the same manner as the atexit function.
+*/
class Exit : public GeneralException {
public:
- Exit(int);
- int GetCode();
+ //! The provided code should be the exit code.
+ Exit(int code);
+ //! Fetches the exit code out of the Exit exception.
+ int GetCode();
private:
int code;
};