From d4c3033adcfa359ae0c82a0d3b1bee6a96245ba1 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Fri, 17 Apr 2015 21:09:36 +0200 Subject: first raw empty classes and structure --- src/content.hpp | 6 ++++++ src/main.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/master_content.hpp | 16 ++++++++++++++ src/strusCms.cpp | 5 +++++ src/strusCms.hpp | 11 ++++++++++ 5 files changed, 96 insertions(+) create mode 100644 src/content.hpp create mode 100644 src/main.cpp create mode 100644 src/master_content.hpp create mode 100644 src/strusCms.cpp create mode 100644 src/strusCms.hpp (limited to 'src') diff --git a/src/content.hpp b/src/content.hpp new file mode 100644 index 0000000..e476702 --- /dev/null +++ b/src/content.hpp @@ -0,0 +1,6 @@ +#ifndef CONTENT_HPP +#define CONTENT_HPP + +#include "master_content.hpp" + +#endif diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..9005e20 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,58 @@ +#include +#include +#include + +#include + +#include "strusCms.hpp" + +static bool terminate = false; +static bool got_sighup = false; +static cppcms::service *global_srv = 0; + +static void handle_signal( int sig ) +{ + switch( sig ) { + case SIGHUP: + got_sighup = true; + if( global_srv ) global_srv->shutdown( ); + break; + + default: + // unknown signal, ignore + break; + } +} + +int main( int argc, char *argv[] ) +{ + signal( SIGHUP, handle_signal ); + while( !terminate ) { + cppcms::service srv( argc, argv ); + global_srv = &srv; + + try { + BOOSTER_INFO( "strusCms" ) << "Restarting application.."; + + srv.applications_pool( ).mount( cppcms::applications_factory( ) ); + + srv.run( ); + + if( got_sighup ) { + BOOSTER_INFO( "strusCms" ) << "Reloading configuration on SIGHUP.."; + got_sighup = false; + } else { + terminate = true; + } + + } catch( std::exception const &e ) { + BOOSTER_ERROR( "strusCms" ) << e.what() ; + srv.shutdown( ); + continue; + } + + srv.shutdown( ); + } + + return 0; +} diff --git a/src/master_content.hpp b/src/master_content.hpp new file mode 100644 index 0000000..af331d0 --- /dev/null +++ b/src/master_content.hpp @@ -0,0 +1,16 @@ +#ifndef MASTER_CONTENT_HPP +#define MASTER_CONTENT_HPP + +#include + +#include + +namespace content { + +struct master : public cppcms::base_content { + std::string title; +}; + +} + +#endif diff --git a/src/strusCms.cpp b/src/strusCms.cpp new file mode 100644 index 0000000..da535ef --- /dev/null +++ b/src/strusCms.cpp @@ -0,0 +1,5 @@ +#include "strusCms.hpp" + +strusCms::strusCms( cppcms::service &srv ) : cppcms::application( srv ) +{ +} diff --git a/src/strusCms.hpp b/src/strusCms.hpp new file mode 100644 index 0000000..6dff31f --- /dev/null +++ b/src/strusCms.hpp @@ -0,0 +1,11 @@ +#ifndef STRUS_CMS_HPP +#define STRUS_CMS_HPP + +#include + +class strusCms : public cppcms::application { + public: + strusCms( cppcms::service &srv ); +}; + +#endif -- cgit v1.2.3-54-g00ecf