SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Private Attributes | List of all members
SWGSDRangel::SWGPresetItem Class Reference

#include <SWGPresetItem.h>

+ Inheritance diagram for SWGSDRangel::SWGPresetItem:
+ Collaboration diagram for SWGSDRangel::SWGPresetItem:

Public Member Functions

 SWGPresetItem ()
 
 SWGPresetItem (QString *json)
 
virtual ~SWGPresetItem ()
 
void init ()
 
void cleanup ()
 
virtual QString asJson () override
 
virtual QJsonObject * asJsonObject () override
 
virtual void fromJsonObject (QJsonObject &json) override
 
virtual SWGPresetItemfromJson (QString &jsonString) override
 
qint64 getCenterFrequency ()
 
void setCenterFrequency (qint64 center_frequency)
 
QString * getType ()
 
void setType (QString *type)
 
QString * getName ()
 
void setName (QString *name)
 
virtual bool isSet () override
 
- Public Member Functions inherited from SWGSDRangel::SWGObject
virtual ~SWGObject ()
 

Private Attributes

qint64 center_frequency
 
bool m_center_frequency_isSet
 
QString * type
 
bool m_type_isSet
 
QString * name
 
bool m_name_isSet
 

Detailed Description

Definition at line 32 of file SWGPresetItem.h.

Constructor & Destructor Documentation

◆ SWGPresetItem() [1/2]

SWGSDRangel::SWGPresetItem::SWGPresetItem ( )

Definition at line 30 of file SWGPresetItem.cpp.

References center_frequency, m_center_frequency_isSet, m_name_isSet, m_type_isSet, name, and type.

30  {
31  center_frequency = 0L;
33  type = nullptr;
34  m_type_isSet = false;
35  name = nullptr;
36  m_name_isSet = false;
37 }

◆ SWGPresetItem() [2/2]

SWGSDRangel::SWGPresetItem::SWGPresetItem ( QString *  json)

Definition at line 25 of file SWGPresetItem.cpp.

References fromJson(), and init().

25  {
26  init();
27  this->fromJson(*json);
28 }
virtual SWGPresetItem * fromJson(QString &jsonString) override
+ Here is the call graph for this function:

◆ ~SWGPresetItem()

SWGSDRangel::SWGPresetItem::~SWGPresetItem ( )
virtual

Definition at line 39 of file SWGPresetItem.cpp.

References cleanup().

39  {
40  this->cleanup();
41 }
+ Here is the call graph for this function:

Member Function Documentation

◆ asJson()

QString SWGSDRangel::SWGPresetItem::asJson ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 84 of file SWGPresetItem.cpp.

References asJsonObject().

85 {
86  QJsonObject* obj = this->asJsonObject();
87 
88  QJsonDocument doc(*obj);
89  QByteArray bytes = doc.toJson();
90  delete obj;
91  return QString(bytes);
92 }
virtual QJsonObject * asJsonObject() override
+ Here is the call graph for this function:

◆ asJsonObject()

QJsonObject * SWGSDRangel::SWGPresetItem::asJsonObject ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 95 of file SWGPresetItem.cpp.

References center_frequency, m_center_frequency_isSet, name, SWGSDRangel::toJsonValue(), and type.

Referenced by asJson().

95  {
96  QJsonObject* obj = new QJsonObject();
98  obj->insert("centerFrequency", QJsonValue(center_frequency));
99  }
100  if(type != nullptr && *type != QString("")){
101  toJsonValue(QString("type"), type, obj, QString("QString"));
102  }
103  if(name != nullptr && *name != QString("")){
104  toJsonValue(QString("name"), name, obj, QString("QString"));
105  }
106 
107  return obj;
108 }
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanup()

void SWGSDRangel::SWGPresetItem::cleanup ( )

Definition at line 54 of file SWGPresetItem.cpp.

References name, and type.

Referenced by ~SWGPresetItem().

54  {
55 
56  if(type != nullptr) {
57  delete type;
58  }
59  if(name != nullptr) {
60  delete name;
61  }
62 }
+ Here is the caller graph for this function:

◆ fromJson()

SWGPresetItem * SWGSDRangel::SWGPresetItem::fromJson ( QString &  jsonString)
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 65 of file SWGPresetItem.cpp.

References fromJsonObject().

Referenced by SWGPresetItem().

65  {
66  QByteArray array (json.toStdString().c_str());
67  QJsonDocument doc = QJsonDocument::fromJson(array);
68  QJsonObject jsonObject = doc.object();
69  this->fromJsonObject(jsonObject);
70  return this;
71 }
virtual void fromJsonObject(QJsonObject &json) override
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromJsonObject()

void SWGSDRangel::SWGPresetItem::fromJsonObject ( QJsonObject &  json)
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 74 of file SWGPresetItem.cpp.

References center_frequency, name, SWGSDRangel::setValue(), and type.

Referenced by fromJson().

74  {
75  ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
76 
77  ::SWGSDRangel::setValue(&type, pJson["type"], "QString", "QString");
78 
79  ::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString");
80 
81 }
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCenterFrequency()

qint64 SWGSDRangel::SWGPresetItem::getCenterFrequency ( )

Definition at line 111 of file SWGPresetItem.cpp.

References center_frequency.

111  {
112  return center_frequency;
113 }

◆ getName()

QString * SWGSDRangel::SWGPresetItem::getName ( )

Definition at line 131 of file SWGPresetItem.cpp.

References name.

131  {
132  return name;
133 }

◆ getType()

QString * SWGSDRangel::SWGPresetItem::getType ( )

Definition at line 121 of file SWGPresetItem.cpp.

References type.

121  {
122  return type;
123 }

◆ init()

void SWGSDRangel::SWGPresetItem::init ( )

Definition at line 44 of file SWGPresetItem.cpp.

References center_frequency, m_center_frequency_isSet, m_name_isSet, m_type_isSet, name, and type.

Referenced by SWGPresetItem().

44  {
45  center_frequency = 0L;
47  type = new QString("");
48  m_type_isSet = false;
49  name = new QString("");
50  m_name_isSet = false;
51 }
+ Here is the caller graph for this function:

◆ isSet()

bool SWGSDRangel::SWGPresetItem::isSet ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 142 of file SWGPresetItem.cpp.

References m_center_frequency_isSet, name, and type.

142  {
143  bool isObjectUpdated = false;
144  do{
145  if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
146  if(type != nullptr && *type != QString("")){ isObjectUpdated = true; break;}
147  if(name != nullptr && *name != QString("")){ isObjectUpdated = true; break;}
148  }while(false);
149  return isObjectUpdated;
150 }

◆ setCenterFrequency()

void SWGSDRangel::SWGPresetItem::setCenterFrequency ( qint64  center_frequency)

Definition at line 115 of file SWGPresetItem.cpp.

References center_frequency, and m_center_frequency_isSet.

115  {
117  this->m_center_frequency_isSet = true;
118 }

◆ setName()

void SWGSDRangel::SWGPresetItem::setName ( QString *  name)

Definition at line 135 of file SWGPresetItem.cpp.

References m_name_isSet, and name.

135  {
136  this->name = name;
137  this->m_name_isSet = true;
138 }

◆ setType()

void SWGSDRangel::SWGPresetItem::setType ( QString *  type)

Definition at line 125 of file SWGPresetItem.cpp.

References m_type_isSet, and type.

125  {
126  this->type = type;
127  this->m_type_isSet = true;
128 }

Member Data Documentation

◆ center_frequency

qint64 SWGSDRangel::SWGPresetItem::center_frequency
private

◆ m_center_frequency_isSet

bool SWGSDRangel::SWGPresetItem::m_center_frequency_isSet
private

Definition at line 59 of file SWGPresetItem.h.

Referenced by asJsonObject(), init(), isSet(), setCenterFrequency(), and SWGPresetItem().

◆ m_name_isSet

bool SWGSDRangel::SWGPresetItem::m_name_isSet
private

Definition at line 65 of file SWGPresetItem.h.

Referenced by init(), setName(), and SWGPresetItem().

◆ m_type_isSet

bool SWGSDRangel::SWGPresetItem::m_type_isSet
private

Definition at line 62 of file SWGPresetItem.h.

Referenced by init(), setType(), and SWGPresetItem().

◆ name

QString* SWGSDRangel::SWGPresetItem::name
private

◆ type

QString* SWGSDRangel::SWGPresetItem::type
private

The documentation for this class was generated from the following files: