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

#include <SWGPresetExport.h>

+ Inheritance diagram for SWGSDRangel::SWGPresetExport:
+ Collaboration diagram for SWGSDRangel::SWGPresetExport:

Public Member Functions

 SWGPresetExport ()
 
 SWGPresetExport (QString *json)
 
virtual ~SWGPresetExport ()
 
void init ()
 
void cleanup ()
 
virtual QString asJson () override
 
virtual QJsonObject * asJsonObject () override
 
virtual void fromJsonObject (QJsonObject &json) override
 
virtual SWGPresetExportfromJson (QString &jsonString) override
 
QString * getFilePath ()
 
void setFilePath (QString *file_path)
 
SWGPresetIdentifiergetPreset ()
 
void setPreset (SWGPresetIdentifier *preset)
 
virtual bool isSet () override
 
- Public Member Functions inherited from SWGSDRangel::SWGObject
virtual ~SWGObject ()
 

Private Attributes

QString * file_path
 
bool m_file_path_isSet
 
SWGPresetIdentifierpreset
 
bool m_preset_isSet
 

Detailed Description

Definition at line 33 of file SWGPresetExport.h.

Constructor & Destructor Documentation

◆ SWGPresetExport() [1/2]

SWGSDRangel::SWGPresetExport::SWGPresetExport ( )

Definition at line 30 of file SWGPresetExport.cpp.

References file_path, m_file_path_isSet, m_preset_isSet, and preset.

30  {
31  file_path = nullptr;
32  m_file_path_isSet = false;
33  preset = nullptr;
34  m_preset_isSet = false;
35 }
SWGPresetIdentifier * preset

◆ SWGPresetExport() [2/2]

SWGSDRangel::SWGPresetExport::SWGPresetExport ( QString *  json)

Definition at line 25 of file SWGPresetExport.cpp.

References fromJson(), and init().

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

◆ ~SWGPresetExport()

SWGSDRangel::SWGPresetExport::~SWGPresetExport ( )
virtual

Definition at line 37 of file SWGPresetExport.cpp.

References cleanup().

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

Member Function Documentation

◆ asJson()

QString SWGSDRangel::SWGPresetExport::asJson ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 77 of file SWGPresetExport.cpp.

References asJsonObject().

Referenced by SWGSDRangel::SWGInstanceApi::instancePresetFilePost().

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

◆ asJsonObject()

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 88 of file SWGPresetExport.cpp.

References file_path, SWGSDRangel::SWGPresetIdentifier::isSet(), preset, and SWGSDRangel::toJsonValue().

Referenced by asJson().

88  {
89  QJsonObject* obj = new QJsonObject();
90  if(file_path != nullptr && *file_path != QString("")){
91  toJsonValue(QString("filePath"), file_path, obj, QString("QString"));
92  }
93  if((preset != nullptr) && (preset->isSet())){
94  toJsonValue(QString("preset"), preset, obj, QString("SWGPresetIdentifier"));
95  }
96 
97  return obj;
98 }
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
SWGPresetIdentifier * preset
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanup()

void SWGSDRangel::SWGPresetExport::cleanup ( )

Definition at line 50 of file SWGPresetExport.cpp.

References file_path, and preset.

Referenced by ~SWGPresetExport().

50  {
51  if(file_path != nullptr) {
52  delete file_path;
53  }
54  if(preset != nullptr) {
55  delete preset;
56  }
57 }
SWGPresetIdentifier * preset
+ Here is the caller graph for this function:

◆ fromJson()

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 60 of file SWGPresetExport.cpp.

References fromJsonObject().

Referenced by WebAPIRequestMapper::instancePresetFileService(), and SWGPresetExport().

60  {
61  QByteArray array (json.toStdString().c_str());
62  QJsonDocument doc = QJsonDocument::fromJson(array);
63  QJsonObject jsonObject = doc.object();
64  this->fromJsonObject(jsonObject);
65  return this;
66 }
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::SWGPresetExport::fromJsonObject ( QJsonObject &  json)
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 69 of file SWGPresetExport.cpp.

References file_path, preset, and SWGSDRangel::setValue().

Referenced by fromJson().

69  {
70  ::SWGSDRangel::setValue(&file_path, pJson["filePath"], "QString", "QString");
71 
72  ::SWGSDRangel::setValue(&preset, pJson["preset"], "SWGPresetIdentifier", "SWGPresetIdentifier");
73 
74 }
SWGPresetIdentifier * preset
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:

◆ getFilePath()

QString * SWGSDRangel::SWGPresetExport::getFilePath ( )

Definition at line 101 of file SWGPresetExport.cpp.

References file_path.

Referenced by WebAPIAdapterSrv::instancePresetFilePost(), and WebAPIRequestMapper::validatePresetExport().

101  {
102  return file_path;
103 }
+ Here is the caller graph for this function:

◆ getPreset()

SWGPresetIdentifier * SWGSDRangel::SWGPresetExport::getPreset ( )

Definition at line 111 of file SWGPresetExport.cpp.

References preset.

Referenced by WebAPIAdapterSrv::instancePresetFilePost(), and WebAPIRequestMapper::validatePresetExport().

111  {
112  return preset;
113 }
SWGPresetIdentifier * preset
+ Here is the caller graph for this function:

◆ init()

void SWGSDRangel::SWGPresetExport::init ( )

Definition at line 42 of file SWGPresetExport.cpp.

References file_path, m_file_path_isSet, m_preset_isSet, and preset.

Referenced by SWGPresetExport().

42  {
43  file_path = new QString("");
44  m_file_path_isSet = false;
45  preset = new SWGPresetIdentifier();
46  m_preset_isSet = false;
47 }
SWGPresetIdentifier * preset
+ Here is the caller graph for this function:

◆ isSet()

bool SWGSDRangel::SWGPresetExport::isSet ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 122 of file SWGPresetExport.cpp.

References file_path, SWGSDRangel::SWGPresetIdentifier::isSet(), and preset.

122  {
123  bool isObjectUpdated = false;
124  do{
125  if(file_path != nullptr && *file_path != QString("")){ isObjectUpdated = true; break;}
126  if(preset != nullptr && preset->isSet()){ isObjectUpdated = true; break;}
127  }while(false);
128  return isObjectUpdated;
129 }
SWGPresetIdentifier * preset
+ Here is the call graph for this function:

◆ setFilePath()

void SWGSDRangel::SWGPresetExport::setFilePath ( QString *  file_path)

Definition at line 105 of file SWGPresetExport.cpp.

References file_path, and m_file_path_isSet.

105  {
106  this->file_path = file_path;
107  this->m_file_path_isSet = true;
108 }

◆ setPreset()

void SWGSDRangel::SWGPresetExport::setPreset ( SWGPresetIdentifier preset)

Definition at line 115 of file SWGPresetExport.cpp.

References m_preset_isSet, and preset.

115  {
116  this->preset = preset;
117  this->m_preset_isSet = true;
118 }
SWGPresetIdentifier * preset

Member Data Documentation

◆ file_path

QString* SWGSDRangel::SWGPresetExport::file_path
private

◆ m_file_path_isSet

bool SWGSDRangel::SWGPresetExport::m_file_path_isSet
private

Definition at line 57 of file SWGPresetExport.h.

Referenced by init(), setFilePath(), and SWGPresetExport().

◆ m_preset_isSet

bool SWGSDRangel::SWGPresetExport::m_preset_isSet
private

Definition at line 60 of file SWGPresetExport.h.

Referenced by init(), setPreset(), and SWGPresetExport().

◆ preset

SWGPresetIdentifier* SWGSDRangel::SWGPresetExport::preset
private

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