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

cpp-qt-client.ServerVariable.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
{{>licenseInfo}}
/**
 * Representing a Server Variable for server URL template substitution.
 */
#ifndef {{prefix}}_SERVERVARIABLE_H
#define {{prefix}}_SERVERVARIABLE_H
#include 
#include 

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

class {{prefix}}ServerVariable {
public:

    /**
     * @param description A description for the server variable.
     * @param defaultValue The default value to use for substitution.
     * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
     */
    {{prefix}}ServerVariable(const QString &description, const QString &defaultValue, const QSet &enumValues)
    : _defaultValue(defaultValue),
      _description(description),
      _enumValues(enumValues){}

    {{prefix}}ServerVariable(){}
    ~{{prefix}}ServerVariable(){}

    int setDefaultValue(const QString& value){
      if( _enumValues.contains(value)){
        _defaultValue = value;
        return 0;
      }
      return -2;
    }

    QString getDefaultValue(){return _defaultValue;}
    QSet getEnumValues(){return _enumValues;}


    QString _defaultValue;
    QString _description;
    QSet _enumValues;

};

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

#endif // {{prefix}}_SERVERVARIABLE_H




© 2015 - 2024 Weber Informatics LLC | Privacy Policy