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

#include <SWGNamedEnum.h>

+ Inheritance diagram for SWGSDRangel::SWGNamedEnum:
+ Collaboration diagram for SWGSDRangel::SWGNamedEnum:

Public Member Functions

 SWGNamedEnum ()
 
 SWGNamedEnum (QString *json)
 
virtual ~SWGNamedEnum ()
 
void init ()
 
void cleanup ()
 
virtual QString asJson () override
 
virtual QJsonObject * asJsonObject () override
 
virtual void fromJsonObject (QJsonObject &json) override
 
virtual SWGNamedEnumfromJson (QString &jsonString) override
 
QString * getName ()
 
void setName (QString *name)
 
qint32 getValue ()
 
void setValue (qint32 value)
 
virtual bool isSet () override
 
- Public Member Functions inherited from SWGSDRangel::SWGObject
virtual ~SWGObject ()
 

Private Attributes

QString * name
 
bool m_name_isSet
 
qint32 value
 
bool m_value_isSet
 

Detailed Description

Definition at line 32 of file SWGNamedEnum.h.

Constructor & Destructor Documentation

◆ SWGNamedEnum() [1/2]

SWGSDRangel::SWGNamedEnum::SWGNamedEnum ( )

Definition at line 30 of file SWGNamedEnum.cpp.

References m_name_isSet, m_value_isSet, name, and value.

30  {
31  name = nullptr;
32  m_name_isSet = false;
33  value = 0;
34  m_value_isSet = false;
35 }

◆ SWGNamedEnum() [2/2]

SWGSDRangel::SWGNamedEnum::SWGNamedEnum ( QString *  json)

Definition at line 25 of file SWGNamedEnum.cpp.

References fromJson(), and init().

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

◆ ~SWGNamedEnum()

SWGSDRangel::SWGNamedEnum::~SWGNamedEnum ( )
virtual

Definition at line 37 of file SWGNamedEnum.cpp.

References cleanup().

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

Member Function Documentation

◆ asJson()

QString SWGSDRangel::SWGNamedEnum::asJson ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 75 of file SWGNamedEnum.cpp.

References asJsonObject().

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

◆ asJsonObject()

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 86 of file SWGNamedEnum.cpp.

References m_value_isSet, name, SWGSDRangel::toJsonValue(), and value.

Referenced by asJson().

86  {
87  QJsonObject* obj = new QJsonObject();
88  if(name != nullptr && *name != QString("")){
89  toJsonValue(QString("name"), name, obj, QString("QString"));
90  }
91  if(m_value_isSet){
92  obj->insert("value", QJsonValue(value));
93  }
94 
95  return obj;
96 }
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::SWGNamedEnum::cleanup ( )

Definition at line 50 of file SWGNamedEnum.cpp.

References name.

Referenced by ~SWGNamedEnum().

50  {
51  if(name != nullptr) {
52  delete name;
53  }
54 
55 }
+ Here is the caller graph for this function:

◆ fromJson()

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 58 of file SWGNamedEnum.cpp.

References fromJsonObject().

Referenced by SWGNamedEnum().

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 67 of file SWGNamedEnum.cpp.

References name, SWGSDRangel::setValue(), and value.

Referenced by fromJson().

67  {
68  ::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString");
69 
70  ::SWGSDRangel::setValue(&value, pJson["value"], "qint32", "");
71 
72 }
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:

◆ getName()

QString * SWGSDRangel::SWGNamedEnum::getName ( )

Definition at line 99 of file SWGNamedEnum.cpp.

References name.

99  {
100  return name;
101 }

◆ getValue()

qint32 SWGSDRangel::SWGNamedEnum::getValue ( )

Definition at line 109 of file SWGNamedEnum.cpp.

References value.

109  {
110  return value;
111 }

◆ init()

void SWGSDRangel::SWGNamedEnum::init ( )

Definition at line 42 of file SWGNamedEnum.cpp.

References m_name_isSet, m_value_isSet, name, and value.

Referenced by SWGNamedEnum().

42  {
43  name = new QString("");
44  m_name_isSet = false;
45  value = 0;
46  m_value_isSet = false;
47 }
+ Here is the caller graph for this function:

◆ isSet()

bool SWGSDRangel::SWGNamedEnum::isSet ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 120 of file SWGNamedEnum.cpp.

References m_value_isSet, and name.

120  {
121  bool isObjectUpdated = false;
122  do{
123  if(name != nullptr && *name != QString("")){ isObjectUpdated = true; break;}
124  if(m_value_isSet){ isObjectUpdated = true; break;}
125  }while(false);
126  return isObjectUpdated;
127 }

◆ setName()

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

Definition at line 103 of file SWGNamedEnum.cpp.

References m_name_isSet, and name.

103  {
104  this->name = name;
105  this->m_name_isSet = true;
106 }

◆ setValue()

void SWGSDRangel::SWGNamedEnum::setValue ( qint32  value)

Definition at line 113 of file SWGNamedEnum.cpp.

References m_value_isSet, and value.

113  {
114  this->value = value;
115  this->m_value_isSet = true;
116 }

Member Data Documentation

◆ m_name_isSet

bool SWGSDRangel::SWGNamedEnum::m_name_isSet
private

Definition at line 56 of file SWGNamedEnum.h.

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

◆ m_value_isSet

bool SWGSDRangel::SWGNamedEnum::m_value_isSet
private

Definition at line 59 of file SWGNamedEnum.h.

Referenced by asJsonObject(), init(), isSet(), setValue(), and SWGNamedEnum().

◆ name

QString* SWGSDRangel::SWGNamedEnum::name
private

◆ value

qint32 SWGSDRangel::SWGNamedEnum::value
private

Definition at line 58 of file SWGNamedEnum.h.

Referenced by asJsonObject(), fromJsonObject(), getValue(), init(), setValue(), and SWGNamedEnum().


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