All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pistache-server.modelbase-header.mustache Maven / Gradle / Ivy

There is a newer version: 3.0.0-rc1
Show newest version
{{>licenseInfo}}
/*
 * ModelBase.h
 *
 * This is the base class for all model classes
 */

#ifndef ModelBase_H_
#define ModelBase_H_

{{{defaultInclude}}}
#include "json.hpp"
#include 
#include 

{{#modelNamespaceDeclarations}}
namespace {{this}} {
{{/modelNamespaceDeclarations}}

class {{declspec}} ModelBase
{
public:
    ModelBase();
    virtual ~ModelBase();

    virtual void validate() = 0;

    virtual nlohmann::json toJson() const = 0;
    virtual void fromJson(nlohmann::json& json) = 0;

    static std::string toJson( const std::string& value );
    static std::string toJson( const std::time_t& value );
    static int32_t toJson( int32_t value );
    static int64_t toJson( int64_t value );
    static double toJson( double value );
    static bool toJson( bool value );
    static nlohmann::json toJson( std::shared_ptr content );

};

{{#modelNamespaceDeclarations}}
}
{{/modelNamespaceDeclarations}}

#endif /* ModelBase_H_ */




© 2015 - 2024 Weber Informatics LLC | Privacy Policy