view examples/rot13/Rot13Handler.hpp @ 41:7c8cd74023ce

Rework file layout, fix build, add README and SUPPORT
author Louis Opter <kalessin@kalessin.fr>
date Mon, 22 Mar 2010 02:08:24 +0100
parents src/examples/rot13/Rot13Handler.hpp@e53daed19d97
children
line wrap: on
line source

#ifndef __ZIA_ROT13_HANDLER_HPP__
# define __ZIA_ROT13_HANDLER_HPP__

# include <ostream>
# include <istream>

# include "handler/IBodyHandler.hpp"

/**
 * @brief Simple implementation of the StreamIt IHttpHandler interface.
 */
class   Rot13Handler : public zia::api::handler::IBodyHandler
{
public:
    virtual ~Rot13Handler(void) { }

    /**
     * @brief Getter to know were we should plug this hook.
     *
     * @return An identifier telling when we should call this handler.
     */
    virtual zia::api::handler::EHook    getHook(void) const;

    /**
     * @brief This is the normal method the server should call.
     *
     * 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 zia::api::handler::ECode    operator()(zia::api::http::ITransaction & transac,
                                                   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] is Input stream where to read data.
     * @param [in] os ouput stream where to write data.
     *
     * @return A zia::api::Ecode
     */
    zia::api::handler::ECode            operator()(std::istream & is,
                                                   std::ostream & os);
};

#endif	/* ! __ZIA_ROT13_HANDLER_HPP__ */