Mercurial > archived > louis > epitech > zia-api
changeset 4:81af35509f71
Added documentation the rot13 module and handler
author | Zoltan K |
---|---|
date | Fri, 19 Mar 2010 22:56:21 +0100 |
parents | e80935852b9a |
children | aa427c18ffe2 |
files | src/examples/rot13/Rot13Module.hpp |
diffstat | 1 files changed, 50 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/examples/rot13/Rot13Module.hpp Fri Mar 19 19:07:43 2010 +0100 +++ b/src/examples/rot13/Rot13Module.hpp Fri Mar 19 22:56:21 2010 +0100 @@ -10,27 +10,46 @@ char Rot13Char(char c); +/** + ** @brief this class is an simple implementation of the StreamIt IHttpHandler interface + */ class Rot13Handler : public zia::api::handler::IHttpHandler { public: virtual ~Rot13Handler(void) { } + /** + ** @brief Getter to know were we should plug this hook. + ** @return Enumeration telling when we should call this handler. + */ virtual zia::api::handler::EHook getHook(void) const; -/* -** This is the normal methode the server should call. -** But since the purpose of this example is to show how -** std::iostream and std::streambuf works, we overload the -** functor so we haven't to implement ITransaction. -*/ + /** + ** @brief This is the normal method the server should call. + ** But since the purpose of this example is to show how + ** std::istream, std::ostream and std::streambuf works, + ** we overload the functor so we haven't to implement ITransaction. + */ virtual int operator()(zia::api::http::ITransaction & transac, std::istream & is, std::ostream & os); - virtual int operator()(std::istream & is, - std::ostream & os); + + /** + ** @brief This is the method we will call in our example. + ** It is the same as the functor defined in the interface, + ** except there is no ITransaction parameter. + ** @param [in] input stream where to read data + ** @param [in] ouput stream where to write data + ** @return an integer TODO define an enum XXX + */ + int operator()(std::istream & is, + std::ostream & os); }; +/** + ** @brief this class is an simple implementation of the StreamIt IModule interface + */ class ModRot13 : public zia::api::IModule { @@ -39,19 +58,38 @@ ModRot13(void); virtual ~ModRot13(void) { } + /** + ** @brief Module name getter + ** @return The module name + */ const std::string & getName(void) const; + + /** + ** @brief Module version getter + ** @return The module version + */ const std::string & getVersion(void) const; + /** + ** @brief Module's handlers getter + ** @return the module's handlers in a vector + */ const std::vector<zia::api::handler::IHandler *> & getHandlers(void) const; + /** + ** @brief Allow us to configure the module. + ** This example won't implement this method since we want + ** to show the IHandler's basics + ** @return true if the configuration was succesful. + ** In our example, it will always return true + */ bool configure(zia::api::IConfig *); private: - std::string _name; - std::string _version; - std::vector<zia::api::handler::IHandler *> _handlers; + std::string _name; + std::string _version; + std::vector<zia::api::handler::IHandler *> _handlers; }; #endif /* ! _ZIA_ROT13_MODULE_HPP_ */ -