sdrangel/swagger/sdrangel/code/qt5/client/SWGPresetItem.cpp

127 lines
2.6 KiB
C++

/**
* SDRangel
* This is the web API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube
*
* OpenAPI spec version: 4.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
#include "SWGPresetItem.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGPresetItem::SWGPresetItem(QString* json) {
init();
this->fromJson(*json);
}
SWGPresetItem::SWGPresetItem() {
init();
}
SWGPresetItem::~SWGPresetItem() {
this->cleanup();
}
void
SWGPresetItem::init() {
center_frequency = 0L;
type = new QString("");
name = new QString("");
}
void
SWGPresetItem::cleanup() {
if(type != nullptr) {
delete type;
}
if(name != nullptr) {
delete name;
}
}
SWGPresetItem*
SWGPresetItem::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGPresetItem::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&type, pJson["type"], "QString", "QString");
::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString");
}
QString
SWGPresetItem::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
return QString(bytes);
}
QJsonObject*
SWGPresetItem::asJsonObject() {
QJsonObject* obj = new QJsonObject();
obj->insert("centerFrequency", QJsonValue(center_frequency));
toJsonValue(QString("type"), type, obj, QString("QString"));
toJsonValue(QString("name"), name, obj, QString("QString"));
return obj;
}
qint64
SWGPresetItem::getCenterFrequency() {
return center_frequency;
}
void
SWGPresetItem::setCenterFrequency(qint64 center_frequency) {
this->center_frequency = center_frequency;
}
QString*
SWGPresetItem::getType() {
return type;
}
void
SWGPresetItem::setType(QString* type) {
this->type = type;
}
QString*
SWGPresetItem::getName() {
return name;
}
void
SWGPresetItem::setName(QString* name) {
this->name = name;
}
}