nymea/libguh/types/param.h

60 lines
2.3 KiB
C++

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Copyright (C) 2015 Simon Stuerz <simon.stuerz@guh.guru> *
* Copyright (C) 2014 Michael Zanetti <michael_zanetti@gmx.net> *
* *
* This file is part of guh. *
* *
* Guh is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, version 2 of the License. *
* *
* Guh is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with guh. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef PARAM_H
#define PARAM_H
#include <QString>
#include <QVariant>
class Param
{
public:
Param(const QString &name = QString(), const QVariant &value = QVariant());
QString name() const;
void setName(const QString &name);
QVariant value() const;
void setValue(const QVariant &value);
bool isValid() const;
private:
QString m_name;
QVariant m_value;
};
Q_DECLARE_METATYPE(Param)
QDebug operator<<(QDebug dbg, const Param &param);
class ParamList: public QList<Param>
{
public:
bool hasParam(const QString &paramName) const;
QVariant paramValue(const QString &paramName) const;
void setParamValue(const QString &paramName, const QVariant &value);
ParamList operator<<(const Param &param);
};
QDebug operator<<(QDebug dbg, const ParamList &params);
#endif // PARAM_H