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::SWGPresetGroup Class Reference

#include <SWGPresetGroup.h>

+ Inheritance diagram for SWGSDRangel::SWGPresetGroup:
+ Collaboration diagram for SWGSDRangel::SWGPresetGroup:

Public Member Functions

 SWGPresetGroup ()
 
 SWGPresetGroup (QString *json)
 
virtual ~SWGPresetGroup ()
 
void init ()
 
void cleanup ()
 
virtual QString asJson () override
 
virtual QJsonObject * asJsonObject () override
 
virtual void fromJsonObject (QJsonObject &json) override
 
virtual SWGPresetGroupfromJson (QString &jsonString) override
 
QString * getGroupName ()
 
void setGroupName (QString *group_name)
 
qint32 getNbPresets ()
 
void setNbPresets (qint32 nb_presets)
 
QList< SWGPresetItem * > * getPresets ()
 
void setPresets (QList< SWGPresetItem *> *presets)
 
virtual bool isSet () override
 
- Public Member Functions inherited from SWGSDRangel::SWGObject
virtual ~SWGObject ()
 

Private Attributes

QString * group_name
 
bool m_group_name_isSet
 
qint32 nb_presets
 
bool m_nb_presets_isSet
 
QList< SWGPresetItem * > * presets
 
bool m_presets_isSet
 

Detailed Description

Definition at line 34 of file SWGPresetGroup.h.

Constructor & Destructor Documentation

◆ SWGPresetGroup() [1/2]

SWGSDRangel::SWGPresetGroup::SWGPresetGroup ( )

Definition at line 30 of file SWGPresetGroup.cpp.

References group_name, m_group_name_isSet, m_nb_presets_isSet, m_presets_isSet, nb_presets, and presets.

30  {
31  group_name = nullptr;
32  m_group_name_isSet = false;
33  nb_presets = 0;
34  m_nb_presets_isSet = false;
35  presets = nullptr;
36  m_presets_isSet = false;
37 }
QList< SWGPresetItem * > * presets

◆ SWGPresetGroup() [2/2]

SWGSDRangel::SWGPresetGroup::SWGPresetGroup ( QString *  json)

Definition at line 25 of file SWGPresetGroup.cpp.

References fromJson(), and init().

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

◆ ~SWGPresetGroup()

SWGSDRangel::SWGPresetGroup::~SWGPresetGroup ( )
virtual

Definition at line 39 of file SWGPresetGroup.cpp.

References cleanup().

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

Member Function Documentation

◆ asJson()

QString SWGSDRangel::SWGPresetGroup::asJson ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 88 of file SWGPresetGroup.cpp.

References asJsonObject().

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

◆ asJsonObject()

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 99 of file SWGPresetGroup.cpp.

References group_name, m_nb_presets_isSet, nb_presets, presets, SWGSDRangel::toJsonArray(), and SWGSDRangel::toJsonValue().

Referenced by asJson().

99  {
100  QJsonObject* obj = new QJsonObject();
101  if(group_name != nullptr && *group_name != QString("")){
102  toJsonValue(QString("groupName"), group_name, obj, QString("QString"));
103  }
104  if(m_nb_presets_isSet){
105  obj->insert("nbPresets", QJsonValue(nb_presets));
106  }
107  if(presets->size() > 0){
108  toJsonArray((QList<void*>*)presets, obj, "presets", "SWGPresetItem");
109  }
110 
111  return obj;
112 }
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
QList< SWGPresetItem * > * presets
void toJsonArray(QList< void *> *value, QJsonObject *output, QString innerName, QString innerType)
Definition: SWGHelpers.cpp:445
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanup()

void SWGSDRangel::SWGPresetGroup::cleanup ( )

Definition at line 54 of file SWGPresetGroup.cpp.

References group_name, and presets.

Referenced by ~SWGPresetGroup().

54  {
55  if(group_name != nullptr) {
56  delete group_name;
57  }
58 
59  if(presets != nullptr) {
60  auto arr = presets;
61  for(auto o: *arr) {
62  delete o;
63  }
64  delete presets;
65  }
66 }
QList< SWGPresetItem * > * presets
+ Here is the caller graph for this function:

◆ fromJson()

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 69 of file SWGPresetGroup.cpp.

References fromJsonObject().

Referenced by SWGPresetGroup().

69  {
70  QByteArray array (json.toStdString().c_str());
71  QJsonDocument doc = QJsonDocument::fromJson(array);
72  QJsonObject jsonObject = doc.object();
73  this->fromJsonObject(jsonObject);
74  return this;
75 }
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::SWGPresetGroup::fromJsonObject ( QJsonObject &  json)
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 78 of file SWGPresetGroup.cpp.

References group_name, nb_presets, presets, and SWGSDRangel::setValue().

Referenced by fromJson().

78  {
79  ::SWGSDRangel::setValue(&group_name, pJson["groupName"], "QString", "QString");
80 
81  ::SWGSDRangel::setValue(&nb_presets, pJson["nbPresets"], "qint32", "");
82 
83 
84  ::SWGSDRangel::setValue(&presets, pJson["presets"], "QList", "SWGPresetItem");
85 }
QList< SWGPresetItem * > * presets
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:

◆ getGroupName()

QString * SWGSDRangel::SWGPresetGroup::getGroupName ( )

Definition at line 115 of file SWGPresetGroup.cpp.

References group_name.

115  {
116  return group_name;
117 }

◆ getNbPresets()

qint32 SWGSDRangel::SWGPresetGroup::getNbPresets ( )

Definition at line 125 of file SWGPresetGroup.cpp.

References nb_presets.

125  {
126  return nb_presets;
127 }

◆ getPresets()

QList< SWGPresetItem * > * SWGSDRangel::SWGPresetGroup::getPresets ( )

Definition at line 135 of file SWGPresetGroup.cpp.

References presets.

135  {
136  return presets;
137 }
QList< SWGPresetItem * > * presets

◆ init()

void SWGSDRangel::SWGPresetGroup::init ( )

Definition at line 44 of file SWGPresetGroup.cpp.

References group_name, m_group_name_isSet, m_nb_presets_isSet, m_presets_isSet, nb_presets, and presets.

Referenced by SWGPresetGroup().

44  {
45  group_name = new QString("");
46  m_group_name_isSet = false;
47  nb_presets = 0;
48  m_nb_presets_isSet = false;
49  presets = new QList<SWGPresetItem*>();
50  m_presets_isSet = false;
51 }
QList< SWGPresetItem * > * presets
+ Here is the caller graph for this function:

◆ isSet()

bool SWGSDRangel::SWGPresetGroup::isSet ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 146 of file SWGPresetGroup.cpp.

References group_name, m_nb_presets_isSet, and presets.

146  {
147  bool isObjectUpdated = false;
148  do{
149  if(group_name != nullptr && *group_name != QString("")){ isObjectUpdated = true; break;}
150  if(m_nb_presets_isSet){ isObjectUpdated = true; break;}
151  if(presets->size() > 0){ isObjectUpdated = true; break;}
152  }while(false);
153  return isObjectUpdated;
154 }
QList< SWGPresetItem * > * presets

◆ setGroupName()

void SWGSDRangel::SWGPresetGroup::setGroupName ( QString *  group_name)

Definition at line 119 of file SWGPresetGroup.cpp.

References group_name, and m_group_name_isSet.

119  {
120  this->group_name = group_name;
121  this->m_group_name_isSet = true;
122 }

◆ setNbPresets()

void SWGSDRangel::SWGPresetGroup::setNbPresets ( qint32  nb_presets)

Definition at line 129 of file SWGPresetGroup.cpp.

References m_nb_presets_isSet, and nb_presets.

129  {
130  this->nb_presets = nb_presets;
131  this->m_nb_presets_isSet = true;
132 }

◆ setPresets()

void SWGSDRangel::SWGPresetGroup::setPresets ( QList< SWGPresetItem *> *  presets)

Definition at line 139 of file SWGPresetGroup.cpp.

References m_presets_isSet, and presets.

139  {
140  this->presets = presets;
141  this->m_presets_isSet = true;
142 }
QList< SWGPresetItem * > * presets

Member Data Documentation

◆ group_name

QString* SWGSDRangel::SWGPresetGroup::group_name
private

◆ m_group_name_isSet

bool SWGSDRangel::SWGPresetGroup::m_group_name_isSet
private

Definition at line 61 of file SWGPresetGroup.h.

Referenced by init(), setGroupName(), and SWGPresetGroup().

◆ m_nb_presets_isSet

bool SWGSDRangel::SWGPresetGroup::m_nb_presets_isSet
private

Definition at line 64 of file SWGPresetGroup.h.

Referenced by asJsonObject(), init(), isSet(), setNbPresets(), and SWGPresetGroup().

◆ m_presets_isSet

bool SWGSDRangel::SWGPresetGroup::m_presets_isSet
private

Definition at line 67 of file SWGPresetGroup.h.

Referenced by init(), setPresets(), and SWGPresetGroup().

◆ nb_presets

qint32 SWGSDRangel::SWGPresetGroup::nb_presets
private

◆ presets

QList<SWGPresetItem*>* SWGSDRangel::SWGPresetGroup::presets
private

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