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

#include <SWGPresets.h>

+ Inheritance diagram for SWGSDRangel::SWGPresets:
+ Collaboration diagram for SWGSDRangel::SWGPresets:

Public Member Functions

 SWGPresets ()
 
 SWGPresets (QString *json)
 
virtual ~SWGPresets ()
 
void init ()
 
void cleanup ()
 
virtual QString asJson () override
 
virtual QJsonObject * asJsonObject () override
 
virtual void fromJsonObject (QJsonObject &json) override
 
virtual SWGPresetsfromJson (QString &jsonString) override
 
qint32 getNbGroups ()
 
void setNbGroups (qint32 nb_groups)
 
QList< SWGPresetGroup * > * getGroups ()
 
void setGroups (QList< SWGPresetGroup *> *groups)
 
virtual bool isSet () override
 
- Public Member Functions inherited from SWGSDRangel::SWGObject
virtual ~SWGObject ()
 

Private Attributes

qint32 nb_groups
 
bool m_nb_groups_isSet
 
QList< SWGPresetGroup * > * groups
 
bool m_groups_isSet
 

Detailed Description

Definition at line 33 of file SWGPresets.h.

Constructor & Destructor Documentation

◆ SWGPresets() [1/2]

SWGSDRangel::SWGPresets::SWGPresets ( )

Definition at line 30 of file SWGPresets.cpp.

References groups, m_groups_isSet, m_nb_groups_isSet, and nb_groups.

30  {
31  nb_groups = 0;
32  m_nb_groups_isSet = false;
33  groups = nullptr;
34  m_groups_isSet = false;
35 }
QList< SWGPresetGroup * > * groups
Definition: SWGPresets.h:59

◆ SWGPresets() [2/2]

SWGSDRangel::SWGPresets::SWGPresets ( QString *  json)

Definition at line 25 of file SWGPresets.cpp.

References fromJson(), and init().

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

◆ ~SWGPresets()

SWGSDRangel::SWGPresets::~SWGPresets ( )
virtual

Definition at line 37 of file SWGPresets.cpp.

References cleanup().

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

Member Function Documentation

◆ asJson()

QString SWGSDRangel::SWGPresets::asJson ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 79 of file SWGPresets.cpp.

References asJsonObject().

Referenced by WebAPIRequestMapper::instancePresetsService().

80 {
81  QJsonObject* obj = this->asJsonObject();
82 
83  QJsonDocument doc(*obj);
84  QByteArray bytes = doc.toJson();
85  delete obj;
86  return QString(bytes);
87 }
virtual QJsonObject * asJsonObject() override
Definition: SWGPresets.cpp:90
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ asJsonObject()

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 90 of file SWGPresets.cpp.

References groups, m_nb_groups_isSet, nb_groups, and SWGSDRangel::toJsonArray().

Referenced by asJson().

90  {
91  QJsonObject* obj = new QJsonObject();
93  obj->insert("nbGroups", QJsonValue(nb_groups));
94  }
95  if(groups->size() > 0){
96  toJsonArray((QList<void*>*)groups, obj, "groups", "SWGPresetGroup");
97  }
98 
99  return obj;
100 }
QList< SWGPresetGroup * > * groups
Definition: SWGPresets.h:59
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::SWGPresets::cleanup ( )

Definition at line 50 of file SWGPresets.cpp.

References groups.

Referenced by ~SWGPresets().

50  {
51 
52  if(groups != nullptr) {
53  auto arr = groups;
54  for(auto o: *arr) {
55  delete o;
56  }
57  delete groups;
58  }
59 }
QList< SWGPresetGroup * > * groups
Definition: SWGPresets.h:59
+ Here is the caller graph for this function:

◆ fromJson()

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 62 of file SWGPresets.cpp.

References fromJsonObject().

Referenced by SWGPresets().

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

◆ fromJsonObject()

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 71 of file SWGPresets.cpp.

References groups, nb_groups, and SWGSDRangel::setValue().

Referenced by fromJson().

71  {
72  ::SWGSDRangel::setValue(&nb_groups, pJson["nbGroups"], "qint32", "");
73 
74 
75  ::SWGSDRangel::setValue(&groups, pJson["groups"], "QList", "SWGPresetGroup");
76 }
QList< SWGPresetGroup * > * groups
Definition: SWGPresets.h:59
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:

◆ getGroups()

QList< SWGPresetGroup * > * SWGSDRangel::SWGPresets::getGroups ( )

Definition at line 113 of file SWGPresets.cpp.

References groups.

Referenced by WebAPIAdapterGUI::instancePresetsGet(), and WebAPIAdapterSrv::instancePresetsGet().

113  {
114  return groups;
115 }
QList< SWGPresetGroup * > * groups
Definition: SWGPresets.h:59
+ Here is the caller graph for this function:

◆ getNbGroups()

qint32 SWGSDRangel::SWGPresets::getNbGroups ( )

Definition at line 103 of file SWGPresets.cpp.

References nb_groups.

103  {
104  return nb_groups;
105 }

◆ init()

void SWGSDRangel::SWGPresets::init ( )

Definition at line 42 of file SWGPresets.cpp.

References groups, m_groups_isSet, m_nb_groups_isSet, and nb_groups.

Referenced by WebAPIAdapterGUI::instancePresetsGet(), WebAPIAdapterSrv::instancePresetsGet(), and SWGPresets().

42  {
43  nb_groups = 0;
44  m_nb_groups_isSet = false;
45  groups = new QList<SWGPresetGroup*>();
46  m_groups_isSet = false;
47 }
QList< SWGPresetGroup * > * groups
Definition: SWGPresets.h:59
+ Here is the caller graph for this function:

◆ isSet()

bool SWGSDRangel::SWGPresets::isSet ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 124 of file SWGPresets.cpp.

References groups, and m_nb_groups_isSet.

124  {
125  bool isObjectUpdated = false;
126  do{
127  if(m_nb_groups_isSet){ isObjectUpdated = true; break;}
128  if(groups->size() > 0){ isObjectUpdated = true; break;}
129  }while(false);
130  return isObjectUpdated;
131 }
QList< SWGPresetGroup * > * groups
Definition: SWGPresets.h:59

◆ setGroups()

void SWGSDRangel::SWGPresets::setGroups ( QList< SWGPresetGroup *> *  groups)

Definition at line 117 of file SWGPresets.cpp.

References groups, and m_groups_isSet.

117  {
118  this->groups = groups;
119  this->m_groups_isSet = true;
120 }
QList< SWGPresetGroup * > * groups
Definition: SWGPresets.h:59

◆ setNbGroups()

void SWGSDRangel::SWGPresets::setNbGroups ( qint32  nb_groups)

Definition at line 107 of file SWGPresets.cpp.

References m_nb_groups_isSet, and nb_groups.

Referenced by WebAPIAdapterGUI::instancePresetsGet(), and WebAPIAdapterSrv::instancePresetsGet().

107  {
108  this->nb_groups = nb_groups;
109  this->m_nb_groups_isSet = true;
110 }
+ Here is the caller graph for this function:

Member Data Documentation

◆ groups

QList<SWGPresetGroup*>* SWGSDRangel::SWGPresets::groups
private

◆ m_groups_isSet

bool SWGSDRangel::SWGPresets::m_groups_isSet
private

Definition at line 60 of file SWGPresets.h.

Referenced by init(), setGroups(), and SWGPresets().

◆ m_nb_groups_isSet

bool SWGSDRangel::SWGPresets::m_nb_groups_isSet
private

Definition at line 57 of file SWGPresets.h.

Referenced by asJsonObject(), init(), isSet(), setNbGroups(), and SWGPresets().

◆ nb_groups

qint32 SWGSDRangel::SWGPresets::nb_groups
private

Definition at line 56 of file SWGPresets.h.

Referenced by asJsonObject(), fromJsonObject(), getNbGroups(), init(), setNbGroups(), and SWGPresets().


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