#ifndef PAGE_HPP #define PAGE_HPP #include "master.hpp" #include "page_content.hpp" #include namespace apps { class page : public master { public: page( aCms &cms ); private: void display( std::string slug ); void api_pages( ); void api_page( std::string slug ); void ini( content::page &c ); }; } // namespace apps struct Page { std::string slug; std::string title; std::string content; }; namespace cppcms { namespace json { template<> struct traits { static Page get( value const &v ) { Page p; if( v.type( ) != is_object) { throw bad_value_cast( ); } p.slug = v.get( "slug" ); p.title = v.get( "title" ); p.content = v.get( "content" ); return p; } static void set( value &v, Page const &p ) { v.set( "slug", p.slug ); v.set( "title", p.title ); v.set( "content", p.content ); } }; } } // namespace cppcms::json #endif