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

#include <SWGInstanceConfigResponse.h>

+ Inheritance diagram for SWGSDRangel::SWGInstanceConfigResponse:
+ Collaboration diagram for SWGSDRangel::SWGInstanceConfigResponse:

Public Member Functions

 SWGInstanceConfigResponse ()
 
 SWGInstanceConfigResponse (QString *json)
 
virtual ~SWGInstanceConfigResponse ()
 
void init ()
 
void cleanup ()
 
virtual QString asJson () override
 
virtual QJsonObject * asJsonObject () override
 
virtual void fromJsonObject (QJsonObject &json) override
 
virtual SWGInstanceConfigResponsefromJson (QString &jsonString) override
 
SWGPreferencesgetPreferences ()
 
void setPreferences (SWGPreferences *preferences)
 
SWGPresetgetWorkingPreset ()
 
void setWorkingPreset (SWGPreset *working_preset)
 
QList< SWGPreset * > * getPresets ()
 
void setPresets (QList< SWGPreset *> *presets)
 
QList< SWGCommand * > * getCommands ()
 
void setCommands (QList< SWGCommand *> *commands)
 
virtual bool isSet () override
 
- Public Member Functions inherited from SWGSDRangel::SWGObject
virtual ~SWGObject ()
 

Private Attributes

SWGPreferencespreferences
 
bool m_preferences_isSet
 
SWGPresetworking_preset
 
bool m_working_preset_isSet
 
QList< SWGPreset * > * presets
 
bool m_presets_isSet
 
QList< SWGCommand * > * commands
 
bool m_commands_isSet
 

Detailed Description

Definition at line 35 of file SWGInstanceConfigResponse.h.

Constructor & Destructor Documentation

◆ SWGInstanceConfigResponse() [1/2]

SWGSDRangel::SWGInstanceConfigResponse::SWGInstanceConfigResponse ( )

◆ SWGInstanceConfigResponse() [2/2]

SWGSDRangel::SWGInstanceConfigResponse::SWGInstanceConfigResponse ( QString *  json)

Definition at line 25 of file SWGInstanceConfigResponse.cpp.

References fromJson(), and init().

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

◆ ~SWGInstanceConfigResponse()

SWGSDRangel::SWGInstanceConfigResponse::~SWGInstanceConfigResponse ( )
virtual

Definition at line 41 of file SWGInstanceConfigResponse.cpp.

References cleanup().

+ Here is the call graph for this function:

Member Function Documentation

◆ asJson()

QString SWGSDRangel::SWGInstanceConfigResponse::asJson ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 103 of file SWGInstanceConfigResponse.cpp.

References asJsonObject().

Referenced by WebAPIRequestMapper::instanceConfigService().

104 {
105  QJsonObject* obj = this->asJsonObject();
106 
107  QJsonDocument doc(*obj);
108  QByteArray bytes = doc.toJson();
109  delete obj;
110  return QString(bytes);
111 }
virtual QJsonObject * asJsonObject() override
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ asJsonObject()

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 114 of file SWGInstanceConfigResponse.cpp.

References commands, SWGSDRangel::SWGPreferences::isSet(), SWGSDRangel::SWGPreset::isSet(), preferences, presets, SWGSDRangel::toJsonArray(), SWGSDRangel::toJsonValue(), and working_preset.

Referenced by asJson().

114  {
115  QJsonObject* obj = new QJsonObject();
116  if((preferences != nullptr) && (preferences->isSet())){
117  toJsonValue(QString("preferences"), preferences, obj, QString("SWGPreferences"));
118  }
119  if((working_preset != nullptr) && (working_preset->isSet())){
120  toJsonValue(QString("workingPreset"), working_preset, obj, QString("SWGPreset"));
121  }
122  if(presets->size() > 0){
123  toJsonArray((QList<void*>*)presets, obj, "presets", "SWGPreset");
124  }
125  if(commands->size() > 0){
126  toJsonArray((QList<void*>*)commands, obj, "commands", "SWGCommand");
127  }
128 
129  return obj;
130 }
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
virtual bool isSet() override
Definition: SWGPreset.cpp:298
void toJsonArray(QList< void *> *value, QJsonObject *output, QString innerName, QString innerType)
Definition: SWGHelpers.cpp:445
virtual bool isSet() override
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanup()

void SWGSDRangel::SWGInstanceConfigResponse::cleanup ( )

Definition at line 58 of file SWGInstanceConfigResponse.cpp.

References commands, preferences, presets, and working_preset.

Referenced by ~SWGInstanceConfigResponse().

58  {
59  if(preferences != nullptr) {
60  delete preferences;
61  }
62  if(working_preset != nullptr) {
63  delete working_preset;
64  }
65  if(presets != nullptr) {
66  auto arr = presets;
67  for(auto o: *arr) {
68  delete o;
69  }
70  delete presets;
71  }
72  if(commands != nullptr) {
73  auto arr = commands;
74  for(auto o: *arr) {
75  delete o;
76  }
77  delete commands;
78  }
79 }
+ Here is the caller graph for this function:

◆ fromJson()

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 82 of file SWGInstanceConfigResponse.cpp.

References fromJsonObject().

Referenced by SWGInstanceConfigResponse().

82  {
83  QByteArray array (json.toStdString().c_str());
84  QJsonDocument doc = QJsonDocument::fromJson(array);
85  QJsonObject jsonObject = doc.object();
86  this->fromJsonObject(jsonObject);
87  return this;
88 }
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::SWGInstanceConfigResponse::fromJsonObject ( QJsonObject &  json)
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 91 of file SWGInstanceConfigResponse.cpp.

References commands, preferences, presets, SWGSDRangel::setValue(), and working_preset.

Referenced by fromJson().

91  {
92  ::SWGSDRangel::setValue(&preferences, pJson["preferences"], "SWGPreferences", "SWGPreferences");
93 
94  ::SWGSDRangel::setValue(&working_preset, pJson["workingPreset"], "SWGPreset", "SWGPreset");
95 
96 
97  ::SWGSDRangel::setValue(&presets, pJson["presets"], "QList", "SWGPreset");
98 
99  ::SWGSDRangel::setValue(&commands, pJson["commands"], "QList", "SWGCommand");
100 }
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:

◆ getCommands()

QList< SWGCommand * > * SWGSDRangel::SWGInstanceConfigResponse::getCommands ( )

Definition at line 163 of file SWGInstanceConfigResponse.cpp.

References commands.

163  {
164  return commands;
165 }

◆ getPreferences()

SWGPreferences * SWGSDRangel::SWGInstanceConfigResponse::getPreferences ( )

Definition at line 133 of file SWGInstanceConfigResponse.cpp.

References preferences.

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

133  {
134  return preferences;
135 }
+ Here is the caller graph for this function:

◆ getPresets()

QList< SWGPreset * > * SWGSDRangel::SWGInstanceConfigResponse::getPresets ( )

Definition at line 153 of file SWGInstanceConfigResponse.cpp.

References presets.

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

153  {
154  return presets;
155 }
+ Here is the caller graph for this function:

◆ getWorkingPreset()

SWGPreset * SWGSDRangel::SWGInstanceConfigResponse::getWorkingPreset ( )

Definition at line 143 of file SWGInstanceConfigResponse.cpp.

References working_preset.

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

143  {
144  return working_preset;
145 }
+ Here is the caller graph for this function:

◆ init()

void SWGSDRangel::SWGInstanceConfigResponse::init ( )

Definition at line 46 of file SWGInstanceConfigResponse.cpp.

References commands, m_commands_isSet, m_preferences_isSet, m_presets_isSet, m_working_preset_isSet, preferences, presets, and working_preset.

Referenced by WebAPIAdapterGUI::instanceConfigGet(), WebAPIAdapterSrv::instanceConfigGet(), and SWGInstanceConfigResponse().

+ Here is the caller graph for this function:

◆ isSet()

bool SWGSDRangel::SWGInstanceConfigResponse::isSet ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 174 of file SWGInstanceConfigResponse.cpp.

References commands, SWGSDRangel::SWGPreferences::isSet(), SWGSDRangel::SWGPreset::isSet(), preferences, presets, and working_preset.

174  {
175  bool isObjectUpdated = false;
176  do{
177  if(preferences != nullptr && preferences->isSet()){ isObjectUpdated = true; break;}
178  if(working_preset != nullptr && working_preset->isSet()){ isObjectUpdated = true; break;}
179  if(presets->size() > 0){ isObjectUpdated = true; break;}
180  if(commands->size() > 0){ isObjectUpdated = true; break;}
181  }while(false);
182  return isObjectUpdated;
183 }
virtual bool isSet() override
Definition: SWGPreset.cpp:298
virtual bool isSet() override
+ Here is the call graph for this function:

◆ setCommands()

void SWGSDRangel::SWGInstanceConfigResponse::setCommands ( QList< SWGCommand *> *  commands)

Definition at line 167 of file SWGInstanceConfigResponse.cpp.

References commands, and m_commands_isSet.

167  {
168  this->commands = commands;
169  this->m_commands_isSet = true;
170 }

◆ setPreferences()

void SWGSDRangel::SWGInstanceConfigResponse::setPreferences ( SWGPreferences preferences)

◆ setPresets()

void SWGSDRangel::SWGInstanceConfigResponse::setPresets ( QList< SWGPreset *> *  presets)

Definition at line 157 of file SWGInstanceConfigResponse.cpp.

References m_presets_isSet, and presets.

157  {
158  this->presets = presets;
159  this->m_presets_isSet = true;
160 }

◆ setWorkingPreset()

void SWGSDRangel::SWGInstanceConfigResponse::setWorkingPreset ( SWGPreset working_preset)

Member Data Documentation

◆ commands

QList<SWGCommand*>* SWGSDRangel::SWGInstanceConfigResponse::commands
private

◆ m_commands_isSet

bool SWGSDRangel::SWGInstanceConfigResponse::m_commands_isSet
private

Definition at line 74 of file SWGInstanceConfigResponse.h.

Referenced by init(), setCommands(), and SWGInstanceConfigResponse().

◆ m_preferences_isSet

bool SWGSDRangel::SWGInstanceConfigResponse::m_preferences_isSet
private

Definition at line 65 of file SWGInstanceConfigResponse.h.

Referenced by init(), setPreferences(), and SWGInstanceConfigResponse().

◆ m_presets_isSet

bool SWGSDRangel::SWGInstanceConfigResponse::m_presets_isSet
private

Definition at line 71 of file SWGInstanceConfigResponse.h.

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

◆ m_working_preset_isSet

bool SWGSDRangel::SWGInstanceConfigResponse::m_working_preset_isSet
private

Definition at line 68 of file SWGInstanceConfigResponse.h.

Referenced by init(), setWorkingPreset(), and SWGInstanceConfigResponse().

◆ preferences

SWGPreferences* SWGSDRangel::SWGInstanceConfigResponse::preferences
private

◆ presets

QList<SWGPreset*>* SWGSDRangel::SWGInstanceConfigResponse::presets
private

◆ working_preset

SWGPreset* SWGSDRangel::SWGInstanceConfigResponse::working_preset
private

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