Class HttpSimpleController

Synopsis

#include <lib/inc/drogon/HttpSimpleController.h>

template <typename T, bool AutoCreation = true>
class HttpSimpleController : public DrObject<T>, public HttpSimpleControllerBase

Description

The reflection base class template for HTTP simple controllers.

Template Parameters:

T - The type of the implementation class

AutoCreation - The flag for automatically creating, user can set this flag to false for classes that have nondefault constructors.

Mentioned in

Inheritance

Ancestors: DrObject, HttpSimpleControllerBase

Methods

HttpSimpleController
~HttpSimpleController
registerSelf__

Source

Lines 60-102 in lib/inc/drogon/HttpSimpleController.h. Line 62 in lib/inc/drogon/HttpSimpleController.h.

template <typename T, bool AutoCreation = true>
class HttpSimpleController : public DrObject<T>, public HttpSimpleControllerBase
{
  public:
    static const bool isAutoCreation = AutoCreation;
    virtual ~HttpSimpleController()
    {
    }

  protected:
    HttpSimpleController()
    {
    }
    static void registerSelf__(
        const std::string &path,
        const std::vector<internal::HttpConstraint> &filtersAndMethods)
    {
        LOG_TRACE << "register simple controller("
                  << HttpSimpleController<T>::classTypeName()
                  << ") on path:" << path;
        app().registerHttpSimpleController(
            path, HttpSimpleController<T>::classTypeName(), filtersAndMethods);
    }

  private:
    class pathRegistrator
    {
      public:
        pathRegistrator()
        {
            if (AutoCreation)
            {
                T::initPathRouting();
            }
        }
    };
    friend pathRegistrator;
    static pathRegistrator registrator_;
    virtual void *touch()
    {
        return &registrator_;
    }
};





Add Discussion as Guest

Log in to DocsForge