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

cpp-qt5-qhttpengine-server.object.mustache Maven / Gradle / Ivy

The newest version!
{{>licenseInfo}}
#ifndef {{prefix}}_OBJECT_H
#define {{prefix}}_OBJECT_H

#include 
#include 
#include 

{{#cppNamespaceDeclarations}}
namespace {{this}} {
{{/cppNamespaceDeclarations}}

class {{prefix}}Object {
  public:
    {{prefix}}Object() {

    }

    {{prefix}}Object(QString jsonString) {
        fromJson(jsonString);
    }

    virtual ~{{prefix}}Object(){

    }

    virtual QJsonObject asJsonObject() const {
        return jObj;
    }

    virtual QString asJson() const {
        QJsonDocument doc(jObj);
        return doc.toJson(QJsonDocument::Compact);
    }

    virtual void fromJson(QString jsonString) {
        QJsonDocument doc = QJsonDocument::fromJson(jsonString.toUtf8());
        jObj = doc.object();
    }

    virtual void fromJsonObject(QJsonObject json) {
        jObj = json;
    }

    virtual bool isSet() const {
        return false;
    }

    virtual bool isValid() const {
        return true;
    }
private :
    QJsonObject jObj;
};

{{#cppNamespaceDeclarations}}
}
{{/cppNamespaceDeclarations}}

Q_DECLARE_METATYPE({{#cppNamespaceDeclarations}}{{this}}::{{/cppNamespaceDeclarations}}{{prefix}}Object)

#endif // {{prefix}}_OBJECT_H




© 2015 - 2025 Weber Informatics LLC | Privacy Policy