Adds q2 repos to migrate
This commit is contained in:
1 parent
ad1f62c4ee
commit
17f1c61c9e
991 files changed
+178451
No files matched your search
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
|
||||
|
||||
SET(wms_ds_SRCS
|
||||
IECC2WMS.h
|
||||
IWMS2ECC.h
|
||||
wms_ecc_equipmenttypes.cpp
|
||||
wms_ecc_equipmenttypes.h
|
||||
wms_ecc_equipRequirements.cpp
|
||||
wms_ecc_equipRequirements.h
|
||||
wms_ecc_exercises.cpp
|
||||
wms_ecc_exercises.h
|
||||
wms_ecc_ibase.h
|
||||
wms_ecc_playerInfo.cpp
|
||||
wms_ecc_playerInfo.h
|
||||
wms_ecc_registration.cpp
|
||||
wms_ecc_registration.h
|
||||
wms_ecc_unregister.cpp
|
||||
wms_ecc_unregister.h
|
||||
json_keys.h
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY2(AAR SV wms_json_ds SHARED ${wms_ds_SRCS})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(wms_json_ds
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
)
|
||||
NGL_TARGET_LINK_LIBRARIES(wms_json_ds
|
||||
PUBLIC
|
||||
Qt5::Core
|
||||
)
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace WmsJson
|
||||
{
|
||||
class IECC2WMS
|
||||
{
|
||||
|
||||
public:
|
||||
IECC2WMS() = default;
|
||||
virtual ~IECC2WMS() = default;
|
||||
|
||||
|
||||
virtual void playerChanged(int playerId, int exerciseId) = 0;
|
||||
virtual void exerciseDataChanged(int exerciseId, int betrZustand) = 0;
|
||||
|
||||
};
|
||||
}
|
||||
Executable
+137
@@ -0,0 +1,137 @@
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
#include <QSet>
|
||||
#include <QMetaType>
|
||||
|
||||
class IWMS2ECC
|
||||
{
|
||||
|
||||
public:
|
||||
IWMS2ECC() = default;
|
||||
virtual ~IWMS2ECC() = default;
|
||||
|
||||
enum RegisterReturnValue
|
||||
{
|
||||
RegistrationOk = 0,
|
||||
PlayerNotFound = 1,
|
||||
PlayerDeleted = 2,
|
||||
AssignmentIncorrect = 3,
|
||||
EquipNoAlreadyAssigned = 4,
|
||||
RegistrationFailed = 5
|
||||
};
|
||||
|
||||
enum UnregisterReturnValue
|
||||
{
|
||||
UnregisterOk = 0,
|
||||
EquipNoNotFound = 1,
|
||||
UnregisterFailed = 2
|
||||
};
|
||||
|
||||
enum PlayerState
|
||||
{
|
||||
NOT_FOUND = 0,
|
||||
FOUND = 1,
|
||||
DELETED = 2
|
||||
};
|
||||
|
||||
enum PlayerAssignState
|
||||
{
|
||||
UNDEFINED = -2,
|
||||
NOT_ASSIGNED = -1,
|
||||
ASSIGNED = 0,
|
||||
HANDOUT_EXCON = 1,
|
||||
HANDOUT_WMS = 2,
|
||||
HANDOUT_EXCON_OVERRULED_WMS = 3
|
||||
};
|
||||
static inline PlayerAssignState int2PlayerAssignState(int s)
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
case UNDEFINED:
|
||||
case NOT_ASSIGNED:
|
||||
case ASSIGNED:
|
||||
case HANDOUT_EXCON:
|
||||
case HANDOUT_WMS:
|
||||
case HANDOUT_EXCON_OVERRULED_WMS:
|
||||
return static_cast<PlayerAssignState>(s);
|
||||
}
|
||||
Q_ASSERT(false);
|
||||
return UNDEFINED;
|
||||
}
|
||||
|
||||
struct PlayerInfo
|
||||
{
|
||||
PlayerState playerState = NOT_FOUND;
|
||||
int playerId = -1;
|
||||
int parentPlayerId = -1;
|
||||
int equipNo = -1;
|
||||
PlayerAssignState assignState = UNDEFINED;
|
||||
int exerciseId = -1;
|
||||
int forceId = -1;
|
||||
int typeId = -1;
|
||||
int equipTypeId = -1;
|
||||
int typeClassId = -1;
|
||||
int symbolColor = -1;
|
||||
bool isDeleted = false;
|
||||
QByteArray symbolPNG;
|
||||
QString hierarchy;
|
||||
QString designator;
|
||||
QString tactIdent;
|
||||
QString info;
|
||||
QString alias;
|
||||
QString forceName;
|
||||
};
|
||||
|
||||
struct Exercise
|
||||
{
|
||||
int id = -1;
|
||||
int actExercise = 0;
|
||||
time_t start = 0;
|
||||
time_t end = 0;
|
||||
QString name;
|
||||
QString stateAsString;
|
||||
};
|
||||
using exerciseMap = QMap<int, Exercise>;
|
||||
|
||||
struct EquipmentType
|
||||
{
|
||||
QString name;
|
||||
int id = 0;
|
||||
int specialType = 0;
|
||||
int minEquipNo = 0;
|
||||
int maxEquipNo = 0;
|
||||
int taVulnerabilityModelId = 0;
|
||||
int taPlayerTypeId = 0;
|
||||
bool deletedInWMS = false;
|
||||
};
|
||||
using equipTypeMap = QMap<int, EquipmentType>;
|
||||
|
||||
|
||||
virtual RegisterReturnValue registerPlayer(int playerId, int equipNo, const PlayerAssignState &zuordnung, const QString &alias,
|
||||
const QString &info, int exerciseId) = 0;
|
||||
|
||||
virtual UnregisterReturnValue unregister(int equipNo, int exerciseId) = 0;
|
||||
virtual PlayerInfo getPlayerInfo(int playerId, int exerciseId) = 0;
|
||||
|
||||
virtual exerciseMap getExercises() const = 0;
|
||||
virtual Exercise getActualExercise() const = 0;
|
||||
|
||||
|
||||
virtual QMap<int, int> getEquipRequirements(int exerciseId) const = 0;
|
||||
|
||||
virtual QMap<int, PlayerInfo> getAllPlayers(int exerciseId) const = 0;
|
||||
virtual QMap<int, PlayerInfo> getAllVehicles(int exerciseId) const = 0;
|
||||
|
||||
virtual int getPlayerId(int equipNo, int exerciseId) const = 0;
|
||||
virtual int getEquipNo(int playerId, int exerciseId) const = 0;
|
||||
|
||||
virtual int getTypeClassId(int equipTypeId) const = 0;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(IWMS2ECC::Exercise)
|
||||
Q_DECLARE_METATYPE(IWMS2ECC::EquipmentType)
|
||||
Q_DECLARE_METATYPE(IWMS2ECC::RegisterReturnValue)
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QString>
|
||||
|
||||
namespace WebSocketInterface
|
||||
{
|
||||
|
||||
|
||||
namespace JsonKeys
|
||||
{
|
||||
|
||||
inline QString EXERCISE_ID() { return QStringLiteral("exerciseId"); }
|
||||
inline QString DATA_MODIFICATION() { return QStringLiteral("dataModification"); }
|
||||
inline QString PARTICIPANT_ID() { return QStringLiteral("participantId"); }
|
||||
inline QString REGISTRATION_RETURN_VALUE() { return QStringLiteral("registrationReturnValue"); }
|
||||
|
||||
|
||||
inline QString EQUIPMENT_TYPES_REQUEST() { return QStringLiteral("equipmentTypesRequest"); }
|
||||
|
||||
|
||||
inline QString EQUIPMENT_TYPES_REPLY() { return QStringLiteral("equipmentTypesReply"); }
|
||||
|
||||
|
||||
inline QString EXERCISES_REQUEST() { return QStringLiteral("exercisesRequest"); }
|
||||
|
||||
|
||||
inline QString EXERCISES_REPLY() { return QStringLiteral("exercisesReply"); }
|
||||
|
||||
|
||||
inline QString EXERCISE_UPDATE() { return QStringLiteral("exercisesUpdate"); }
|
||||
|
||||
|
||||
inline QString PARTICIPANTS_REQUEST() { return QStringLiteral("participantsRequest"); }
|
||||
|
||||
|
||||
inline QString PARTICIPANTS_REPLY() { return QStringLiteral("participantsReply"); }
|
||||
|
||||
|
||||
inline QString PARTICIPANTS_UPDATE() { return QStringLiteral("participantsUpdate"); }
|
||||
|
||||
|
||||
inline QString PARTICIPANT_REGISTER_IN_EXCON_REQUEST() { return QStringLiteral("participantRegisterInEXCONRequest");}
|
||||
|
||||
|
||||
inline QString PARTICIPANT_REGISTER_IN_EXCON_REPLY() { return QStringLiteral("participantRegisterInEXCONReply");}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
|
||||
|
||||
|
||||
#include "wms_ecc_equipRequirements.h"
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
|
||||
QJsonObject EquipRequirements::toJson() const
|
||||
{
|
||||
QJsonArray arr;
|
||||
for (QMap<int, int>::ConstIterator it = m_equipRequire.begin(); it != m_equipRequire.end(); ++it)
|
||||
{
|
||||
QJsonObject obj;
|
||||
obj[QLatin1String("key")] = it.key();
|
||||
obj[QLatin1String("value")] = it.value();
|
||||
arr.append(obj);
|
||||
}
|
||||
|
||||
QJsonObject retMap;
|
||||
retMap[QLatin1String("equipMap")] = arr;
|
||||
retMap[QLatin1String("ok")] = m_ok;
|
||||
|
||||
return retMap;
|
||||
}
|
||||
|
||||
EquipRequirements EquipRequirements::fromJson(const QJsonObject &map)
|
||||
{
|
||||
EquipRequirements eq;
|
||||
|
||||
const QJsonArray arr = map[QLatin1String("equipMap")].toArray();
|
||||
for (const auto &ele : arr)
|
||||
{
|
||||
const QJsonObject obj = ele.toObject();
|
||||
int equipmentTypeId = obj[QLatin1String("key")].toInt();
|
||||
int amount = obj[QLatin1String("value")].toInt();
|
||||
eq.m_equipRequire.insert(equipmentTypeId, amount);
|
||||
}
|
||||
|
||||
eq.m_ok = map[QLatin1String("ok")].toBool();
|
||||
|
||||
return eq;
|
||||
}
|
||||
|
||||
QVariantMap EquipRequirements::toVariantMap() const
|
||||
{
|
||||
QVariantMap viMap;
|
||||
for (QMap<int, int>::ConstIterator it = m_equipRequire.begin(); it != m_equipRequire.end(); ++it)
|
||||
viMap.insert(QString::number(it.key()), QVariant(it.value()));
|
||||
|
||||
QVariantMap retMap;
|
||||
retMap[QLatin1String("equipMap")] = QVariant(viMap);
|
||||
retMap[QLatin1String("ok")] = QVariant(m_ok);
|
||||
|
||||
return retMap;
|
||||
}
|
||||
|
||||
EquipRequirements EquipRequirements::fromVariantMap(const QVariantMap &map)
|
||||
{
|
||||
EquipRequirements eq;
|
||||
|
||||
const QVariantMap viMap = map[QLatin1String("equipMap")].toMap();
|
||||
for (QVariantMap::ConstIterator it = viMap.begin(); it != viMap.end(); ++it)
|
||||
{
|
||||
const int key = it.key().toInt();
|
||||
eq.m_equipRequire.insert(key, it.value().toInt());
|
||||
}
|
||||
|
||||
eq.m_ok = map[QLatin1String("ok")].toBool();
|
||||
|
||||
return eq;
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "wms_ecc_ibase.h"
|
||||
#include "IWMS2ECC.h"
|
||||
|
||||
#include <QtCore/QVariantMap>
|
||||
|
||||
class WMS_JSON_DS_EXPORT EquipRequirements : public IBase
|
||||
{
|
||||
public:
|
||||
QJsonObject toJson() const;
|
||||
static EquipRequirements fromJson(const QJsonObject &map);
|
||||
|
||||
QVariantMap toVariantMap() const;
|
||||
static EquipRequirements fromVariantMap(const QVariantMap &map);
|
||||
|
||||
|
||||
QMap<int, int> getEquipRequirements() const { return m_equipRequire; }
|
||||
bool getOk() const { return m_ok; }
|
||||
|
||||
void setEquipRequirements(const QMap<int, int> &equip) { m_equipRequire = equip; }
|
||||
void setOk(bool ok) { m_ok = ok; }
|
||||
|
||||
private:
|
||||
QMap<int, int> m_equipRequire;
|
||||
bool m_ok = false;
|
||||
};
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
|
||||
|
||||
|
||||
#include "wms_ecc_equipmenttypes.h"
|
||||
#include <QJsonArray>
|
||||
|
||||
QJsonObject EquipmentTypes::toJson(const IWMS2ECC::EquipmentType &et)
|
||||
{
|
||||
QJsonObject obj;
|
||||
|
||||
obj[QLatin1String("id")] = et.id;
|
||||
obj[QLatin1String("name")] = et.name;
|
||||
obj[QLatin1String("minEquipNo")] = et.minEquipNo;
|
||||
obj[QLatin1String("maxEquipNo")] = et.maxEquipNo;
|
||||
obj[QLatin1String("specialType")] = et.specialType;
|
||||
obj[QLatin1String("taVulnerabilityModelId")] = et.taVulnerabilityModelId;
|
||||
obj[QLatin1String("taPlayerTypeId")] = et.taPlayerTypeId;
|
||||
obj[QLatin1String("deletedInWMS")] = et.deletedInWMS;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
IWMS2ECC::EquipmentType EquipmentTypes::fromJson(const QJsonObject &obj)
|
||||
{
|
||||
IWMS2ECC::EquipmentType et;
|
||||
|
||||
et.id = obj[QLatin1String("id")].toInt();
|
||||
et.name = obj[QLatin1String("name")].toString();
|
||||
et.minEquipNo = obj[QLatin1String("minEquipNo")].toInt();
|
||||
et.maxEquipNo = obj[QLatin1String("maxEquipNo")].toInt();
|
||||
et.specialType = obj[QLatin1String("specialType")].toInt();
|
||||
et.taVulnerabilityModelId = obj[QLatin1String("taVulnerabilityModelId")].toInt();
|
||||
et.taPlayerTypeId = obj[QLatin1String("taPlayerTypeId")].toInt();
|
||||
et.deletedInWMS = obj[QLatin1String("deletedInWMS")].toBool();
|
||||
|
||||
return et;
|
||||
}
|
||||
|
||||
QJsonObject EquipmentTypes::toJsonAll() const
|
||||
{
|
||||
QJsonArray arr;
|
||||
for (const IWMS2ECC::EquipmentType &et : m_equipmentTypes)
|
||||
arr.append(toJson(et));
|
||||
|
||||
QJsonObject retMap;
|
||||
retMap[QLatin1String("etMap")] = arr;
|
||||
retMap[QLatin1String("ok")] = m_ok;
|
||||
|
||||
return retMap;
|
||||
}
|
||||
|
||||
EquipmentTypes EquipmentTypes::fromJsonAll(const QJsonObject &map)
|
||||
{
|
||||
EquipmentTypes ets;
|
||||
|
||||
const QJsonArray arr = map[QLatin1String("etMap")].toArray();
|
||||
for (const auto &ele : arr)
|
||||
{
|
||||
const IWMS2ECC::EquipmentType val = fromJson(ele.toObject());
|
||||
ets.m_equipmentTypes.insert(val.id, val);
|
||||
}
|
||||
|
||||
ets.m_ok = map[QLatin1String("ok")].toBool();
|
||||
|
||||
return ets;
|
||||
}
|
||||
|
||||
|
||||
QVariantMap EquipmentTypes::toVariantMap() const
|
||||
{
|
||||
QVariantMap vMap;
|
||||
|
||||
vMap[QLatin1String("id")] = QVariant(m_equipmentType.id);
|
||||
vMap[QLatin1String("name")] = m_equipmentType.name;
|
||||
vMap[QLatin1String("minEquipNo")] = QVariant((int)m_equipmentType.minEquipNo);
|
||||
vMap[QLatin1String("maxEquipNo")] = QVariant((int)m_equipmentType.maxEquipNo);
|
||||
vMap[QLatin1String("specialType")] = QVariant(m_equipmentType.specialType);
|
||||
vMap[QLatin1String("deletedInWMS")] = QVariant(m_equipmentType.deletedInWMS);
|
||||
|
||||
vMap[QLatin1String("ok")] = QVariant(m_ok);
|
||||
|
||||
return vMap;
|
||||
}
|
||||
|
||||
EquipmentTypes EquipmentTypes::fromVariantMap(const QVariantMap &map)
|
||||
{
|
||||
EquipmentTypes ets;
|
||||
|
||||
ets.m_equipmentType.id = map[QLatin1String("id")].toInt();
|
||||
ets.m_equipmentType.name = map[QLatin1String("name")].toString();
|
||||
ets.m_equipmentType.minEquipNo = map[QLatin1String("minEquipNo")].toInt();
|
||||
ets.m_equipmentType.maxEquipNo = map[QLatin1String("maxEquipNo")].toInt();
|
||||
ets.m_equipmentType.specialType = map[QLatin1String("specialType")].toInt();
|
||||
ets.m_equipmentType.deletedInWMS = map[QLatin1String("deletedInWMS")].toBool();
|
||||
|
||||
ets.m_ok = map[QLatin1String("ok")].toBool();
|
||||
|
||||
return ets;
|
||||
}
|
||||
|
||||
QVariantMap EquipmentTypes::toVariantMapAll() const
|
||||
{
|
||||
QVariantMap vMap;
|
||||
for (IWMS2ECC::equipTypeMap::ConstIterator it = m_equipmentTypes.begin(); it != m_equipmentTypes.end(); ++it)
|
||||
{
|
||||
m_equipmentType = it.value();
|
||||
vMap.insert(QString::number(it.key()), QVariant(toVariantMap()));
|
||||
}
|
||||
|
||||
QVariantMap retMap;
|
||||
retMap[QLatin1String("etMap")] = QVariant(vMap);
|
||||
retMap[QLatin1String("ok")] = QVariant(m_ok);
|
||||
|
||||
return retMap;
|
||||
}
|
||||
|
||||
EquipmentTypes EquipmentTypes::fromVariantMapAll(const QVariantMap &map)
|
||||
{
|
||||
EquipmentTypes ets;
|
||||
|
||||
const QVariantMap vMap = map[QLatin1String("etMap")].toMap();
|
||||
for (QVariantMap::ConstIterator it = vMap.begin(); it != vMap.end(); ++it)
|
||||
{
|
||||
int key = it.key().toInt();
|
||||
IWMS2ECC::EquipmentType et = EquipmentTypes::fromVariantMap(it.value().toMap()).m_equipmentType;
|
||||
ets.m_equipmentTypes.insert(key, et);
|
||||
}
|
||||
|
||||
ets.m_ok = map[QLatin1String("ok")].toBool();
|
||||
|
||||
return ets;
|
||||
}
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "wms_ecc_ibase.h"
|
||||
#include "IWMS2ECC.h"
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QVariantMap>
|
||||
|
||||
class WMS_JSON_DS_EXPORT EquipmentTypes : public IBase
|
||||
{
|
||||
public:
|
||||
QJsonObject toJsonAll() const;
|
||||
static EquipmentTypes fromJsonAll(const QJsonObject &map);
|
||||
static QJsonObject toJson(const IWMS2ECC::EquipmentType &et);
|
||||
static IWMS2ECC::EquipmentType fromJson(const QJsonObject &obj);
|
||||
|
||||
QVariantMap toVariantMapAll() const;
|
||||
static EquipmentTypes fromVariantMapAll(const QVariantMap &map);
|
||||
QVariantMap toVariantMap() const;
|
||||
static EquipmentTypes fromVariantMap(const QVariantMap &map);
|
||||
|
||||
IWMS2ECC::EquipmentType getEquipmentType() const { return m_equipmentType; }
|
||||
IWMS2ECC::equipTypeMap getEquipmentTypes() const { return m_equipmentTypes; }
|
||||
bool getOk() const { return m_ok; }
|
||||
|
||||
void setEquipmentType(const IWMS2ECC::EquipmentType &et) { m_equipmentType = et; }
|
||||
void setEquipmentTypes(const IWMS2ECC::equipTypeMap &map) { m_equipmentTypes = map; }
|
||||
void setOk(bool ok) { m_ok = ok; }
|
||||
|
||||
private:
|
||||
IWMS2ECC::equipTypeMap m_equipmentTypes;
|
||||
mutable IWMS2ECC::EquipmentType m_equipmentType;
|
||||
bool m_ok = false;
|
||||
};
|
||||
Executable
+135
@@ -0,0 +1,135 @@
|
||||
|
||||
|
||||
|
||||
#include "wms_ecc_exercises.h"
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
|
||||
namespace EXCON
|
||||
{
|
||||
|
||||
QJsonObject Exercises::toJson(const IWMS2ECC::Exercise &ex) const
|
||||
{
|
||||
QJsonObject obj;
|
||||
|
||||
obj[QLatin1String("id")] = ex.id;
|
||||
obj[QLatin1String("actExercise")] = ex.actExercise;
|
||||
obj[QLatin1String("start")] = static_cast<qint64>(ex.start);
|
||||
obj[QLatin1String("end")] = static_cast<qint64>(ex.end);
|
||||
obj[QLatin1String("name")] = ex.name;
|
||||
obj[QLatin1String("state")] = ex.stateAsString;
|
||||
|
||||
obj[QLatin1String("ok")] = m_ok;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
IWMS2ECC::Exercise Exercises::fromJson(const QJsonObject &obj)
|
||||
{
|
||||
IWMS2ECC::Exercise ex;
|
||||
|
||||
ex.id = obj[QLatin1String("id")].toInt();
|
||||
ex.actExercise = obj[QLatin1String("actExercise")].toInt();
|
||||
ex.start = static_cast<time_t>(obj[QLatin1String("start")].toInt());
|
||||
ex.end = static_cast<time_t>(obj[QLatin1String("end")].toInt());
|
||||
ex.name = obj[QLatin1String("name")].toString();
|
||||
ex.stateAsString = obj[QLatin1String("state")].toString();
|
||||
|
||||
return ex;
|
||||
}
|
||||
|
||||
QJsonObject Exercises::toJsonAll() const
|
||||
{
|
||||
QJsonArray arr;
|
||||
for (const IWMS2ECC::Exercise &ex : m_exercises)
|
||||
arr.append(toJson(ex));
|
||||
|
||||
QJsonObject obj;
|
||||
obj[QLatin1String("exMap")] = arr;
|
||||
obj[QLatin1String("ok")] = m_ok;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
Exercises Exercises::fromJsonAll(const QJsonObject &map)
|
||||
{
|
||||
Exercises ex;
|
||||
|
||||
const QJsonArray arr = map[QLatin1String("exMap")].toArray();
|
||||
for (const QJsonValue &val : arr)
|
||||
{
|
||||
const IWMS2ECC::Exercise exinfo = fromJson(val.toObject());
|
||||
ex.m_exercises.insert(exinfo.id, exinfo);
|
||||
}
|
||||
|
||||
ex.m_ok = map[QLatin1String("ok")].toBool();
|
||||
|
||||
return ex;
|
||||
}
|
||||
|
||||
|
||||
QVariantMap Exercises::toVariantMap() const
|
||||
{
|
||||
QVariantMap vMap;
|
||||
|
||||
vMap[QLatin1String("id")] = QVariant(m_exercise.id);
|
||||
vMap[QLatin1String("name")] = m_exercise.name;
|
||||
vMap[QLatin1String("start")] = QVariant(static_cast<qint64>(m_exercise.start));
|
||||
vMap[QLatin1String("end")] = QVariant(static_cast<qint64>(m_exercise.end));
|
||||
vMap[QLatin1String("state")] = m_exercise.stateAsString;
|
||||
|
||||
vMap[QLatin1String("ok")] = QVariant(m_ok);
|
||||
|
||||
return vMap;
|
||||
}
|
||||
|
||||
Exercises Exercises::fromVariantMap(const QVariantMap &map)
|
||||
{
|
||||
Exercises ex;
|
||||
|
||||
ex.m_exercise.id = map[QLatin1String("id")].toInt();
|
||||
ex.m_exercise.name = map[QLatin1String("name")].toString();
|
||||
ex.m_exercise.start = map[QLatin1String("start")].toLongLong();
|
||||
ex.m_exercise.end = map[QLatin1String("end")].toLongLong();
|
||||
ex.m_exercise.stateAsString = map[QLatin1String("state")].toString();
|
||||
|
||||
ex.m_ok = map[QLatin1String("ok")].toBool();
|
||||
|
||||
return ex;
|
||||
}
|
||||
|
||||
QVariantMap Exercises::toVariantMapAll() const
|
||||
{
|
||||
QVariantMap vMap;
|
||||
for (IWMS2ECC::exerciseMap::ConstIterator it = m_exercises.begin(); it != m_exercises.end(); ++it)
|
||||
{
|
||||
m_exercise = it.value();
|
||||
vMap.insert(QString::number(it.key()), QVariant(toVariantMap()));
|
||||
}
|
||||
|
||||
QVariantMap retMap;
|
||||
retMap[QLatin1String("exeMap")] = QVariant(vMap);
|
||||
retMap[QLatin1String("ok")] = QVariant(m_ok);
|
||||
|
||||
return retMap;
|
||||
}
|
||||
|
||||
Exercises Exercises::fromVariantMapAll(const QVariantMap &map)
|
||||
{
|
||||
Exercises ex;
|
||||
|
||||
const QVariantMap vMap = map[QLatin1String("exeMap")].toMap();
|
||||
for (QVariantMap::ConstIterator it = vMap.begin(); it != vMap.end(); ++it)
|
||||
{
|
||||
|
||||
int key = it.key().toInt();
|
||||
IWMS2ECC::Exercise e = Exercises::fromVariantMap(it.value().toMap()).m_exercise;
|
||||
ex.m_exercises.insert(key, e);
|
||||
}
|
||||
|
||||
ex.m_ok = map[QLatin1String("ok")].toBool();
|
||||
|
||||
return ex;
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "wms_ecc_ibase.h"
|
||||
#include "IWMS2ECC.h"
|
||||
|
||||
#include <QVariantMap>
|
||||
|
||||
namespace EXCON
|
||||
{
|
||||
|
||||
class WMS_JSON_DS_EXPORT Exercises : public IBase
|
||||
{
|
||||
public:
|
||||
QJsonObject toJsonAll() const;
|
||||
static Exercises fromJsonAll(const QJsonObject &map);
|
||||
QJsonObject toJson(const IWMS2ECC::Exercise &ex) const;
|
||||
static IWMS2ECC::Exercise fromJson(const QJsonObject &obj);
|
||||
|
||||
QVariantMap toVariantMapAll() const;
|
||||
static Exercises fromVariantMapAll(const QVariantMap &map);
|
||||
QVariantMap toVariantMap() const;
|
||||
static Exercises fromVariantMap(const QVariantMap &map);
|
||||
|
||||
IWMS2ECC::Exercise getExercise() const { return m_exercise; }
|
||||
IWMS2ECC::exerciseMap getExercises() const { return m_exercises; }
|
||||
bool getOk() const { return m_ok; }
|
||||
|
||||
void setExercise(const IWMS2ECC::Exercise &exe) { m_exercise = exe; }
|
||||
void setExercises(const IWMS2ECC::exerciseMap &exe) { m_exercises = exe; }
|
||||
void setOk(bool ok) { m_ok = ok; }
|
||||
|
||||
private:
|
||||
IWMS2ECC::exerciseMap m_exercises;
|
||||
mutable IWMS2ECC::Exercise m_exercise;
|
||||
bool m_ok = false;
|
||||
};
|
||||
|
||||
}
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <WMS_Interface/wms_json_ds_export.h>
|
||||
|
||||
class WMS_JSON_DS_EXPORT IBase
|
||||
{
|
||||
public:
|
||||
IBase() = default;
|
||||
virtual ~IBase() = default;
|
||||
|
||||
};
|
||||
|
||||
Executable
+176
@@ -0,0 +1,176 @@
|
||||
|
||||
|
||||
|
||||
#include "wms_ecc_playerInfo.h"
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
|
||||
QJsonObject PlayerInfo::toJson(const IWMS2ECC::PlayerInfo &pi)
|
||||
{
|
||||
QJsonObject obj;
|
||||
obj[QLatin1String("playerState")] = pi.playerState;
|
||||
obj[QLatin1String("playerId")] = pi.playerId;
|
||||
obj[QLatin1String("parentPlayerId")] = pi.parentPlayerId;
|
||||
obj[QLatin1String("equipNo")] = pi.equipNo;
|
||||
obj[QLatin1String("assignState")] = pi.assignState;
|
||||
obj[QLatin1String("exerciseId")] = pi.exerciseId;
|
||||
obj[QLatin1String("forceId")] = pi.forceId;
|
||||
obj[QLatin1String("typeId")] = pi.typeId;
|
||||
obj[QLatin1String("isDeleted")] = pi.isDeleted;
|
||||
obj[QLatin1String("equipTypeId")] = pi.equipTypeId;
|
||||
obj[QLatin1String("typeClassId")] = pi.typeClassId;
|
||||
obj[QLatin1String("symbolColor")] = pi.symbolColor;
|
||||
obj[QLatin1String("symbolPNG")] = QString::fromLatin1(pi.symbolPNG.toBase64());
|
||||
obj[QLatin1String("hierarchy")] = pi.hierarchy;
|
||||
obj[QLatin1String("designator")] = pi.designator;
|
||||
obj[QLatin1String("tactIdent")] = pi.tactIdent;
|
||||
obj[QLatin1String("info")] = pi.info;
|
||||
obj[QLatin1String("alias")] = pi.alias;
|
||||
obj[QLatin1String("forceName")] = pi.forceName;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
IWMS2ECC::PlayerInfo PlayerInfo::fromJson(const QJsonObject &obj)
|
||||
{
|
||||
IWMS2ECC::PlayerInfo pi;
|
||||
|
||||
pi.playerState = static_cast<IWMS2ECC::PlayerState>(obj[QLatin1String("playerState")].toInt());
|
||||
pi.playerId = obj[QLatin1String("playerId")].toInt();
|
||||
pi.parentPlayerId = obj[QLatin1String("parentPlayerId")].toInt();
|
||||
pi.equipNo = obj[QLatin1String("equipNo")].toInt();
|
||||
pi.assignState = static_cast<IWMS2ECC::PlayerAssignState>(obj[QLatin1String("assignState")].toInt());
|
||||
pi.exerciseId = obj[QLatin1String("exerciseId")].toInt();
|
||||
pi.forceId = obj[QLatin1String("forceId")].toInt();
|
||||
pi.typeId = obj[QLatin1String("typeId")].toInt();
|
||||
pi.isDeleted = obj[QLatin1String("isDeleted")].toBool();
|
||||
pi.equipTypeId = obj[QLatin1String("equipTypeId")].toInt();
|
||||
pi.typeClassId = obj[QLatin1String("typeClassId")].toInt();
|
||||
pi.symbolColor = obj[QLatin1String("symbolColor")].toInt();
|
||||
pi.symbolPNG = QByteArray::fromBase64(obj[QLatin1String("symbolPNG")].toString().toLatin1());
|
||||
pi.hierarchy = obj[QLatin1String("hierarchy")].toString();
|
||||
pi.designator = obj[QLatin1String("designator")].toString();
|
||||
pi.tactIdent = obj[QLatin1String("tactIdent")].toString();
|
||||
pi.info = obj[QLatin1String("info")].toString();
|
||||
pi.alias = obj[QLatin1String("alias")].toString();
|
||||
pi.forceName = obj[QLatin1String("forceName")].toString();
|
||||
|
||||
return pi;
|
||||
}
|
||||
|
||||
QJsonObject PlayerInfo::toJsonAll() const
|
||||
{
|
||||
QJsonArray arr;
|
||||
for (const IWMS2ECC::PlayerInfo &pi : m_allPlayerInfo)
|
||||
arr.append(toJson(pi));
|
||||
|
||||
QJsonObject retMap;
|
||||
retMap[QLatin1String("piMap")] = arr;
|
||||
retMap[QLatin1String("ok")] = m_ok;
|
||||
|
||||
return retMap;
|
||||
}
|
||||
|
||||
PlayerInfo PlayerInfo::fromJsonAll(const QJsonObject &map)
|
||||
{
|
||||
PlayerInfo pi;
|
||||
|
||||
const QJsonArray arr = map[QLatin1String("piMap")].toArray();
|
||||
for (const QJsonValue &val : arr)
|
||||
{
|
||||
const IWMS2ECC::PlayerInfo player = fromJson(val.toObject());
|
||||
|
||||
pi.m_allPlayerInfo.insert(player.playerId, player);
|
||||
}
|
||||
|
||||
pi.m_ok = map[QLatin1String("ok")].toBool();
|
||||
|
||||
return pi;
|
||||
}
|
||||
|
||||
QVariantMap PlayerInfo::toVariantMap() const
|
||||
{
|
||||
QVariantMap retMap;
|
||||
retMap[QLatin1String("playerId")] = QVariant(m_playerInfo.playerId);
|
||||
retMap[QLatin1String("parentPlayerId")] = QVariant(m_playerInfo.parentPlayerId);
|
||||
retMap[QLatin1String("equipNo")] = QVariant(m_playerInfo.equipNo);
|
||||
retMap[QLatin1String("equipTypeId")] = QVariant(m_playerInfo.equipTypeId);
|
||||
retMap[QLatin1String("typeClassId")] = QVariant(m_playerInfo.typeClassId);
|
||||
retMap[QLatin1String("forceId")] = QVariant(m_playerInfo.forceId);
|
||||
retMap[QLatin1String("designator")] = m_playerInfo.designator;
|
||||
retMap[QLatin1String("tactIdent")] = m_playerInfo.tactIdent;
|
||||
retMap[QLatin1String("hierarchy")] = m_playerInfo.hierarchy;
|
||||
retMap[QLatin1String("forceName")] = m_playerInfo.forceName;
|
||||
retMap[QLatin1String("info")] = m_playerInfo.info;
|
||||
retMap[QLatin1String("alias")] = m_playerInfo.alias;
|
||||
retMap[QLatin1String("symbolPNG")] = QVariant(m_playerInfo.symbolPNG);
|
||||
retMap[QLatin1String("symbolColor")] = QVariant(m_playerInfo.symbolColor);
|
||||
|
||||
retMap[QLatin1String("assignState")] = QVariant(m_playerInfo.assignState);
|
||||
retMap[QLatin1String("playerState")] = QVariant(m_playerInfo.playerState);
|
||||
|
||||
retMap[QLatin1String("ok")] = QVariant(m_ok);
|
||||
|
||||
return retMap;
|
||||
}
|
||||
|
||||
PlayerInfo PlayerInfo::fromVariantMap(const QVariantMap &map)
|
||||
{
|
||||
PlayerInfo pi;
|
||||
|
||||
pi.m_playerInfo.playerId = map[QLatin1String("playerId")].toInt();
|
||||
pi.m_playerInfo.parentPlayerId = map[QLatin1String("parentPlayerId")].toInt();
|
||||
pi.m_playerInfo.equipNo = map[QLatin1String("equipNo")].toInt();
|
||||
pi.m_playerInfo.forceId = map[QLatin1String("forceId")].toInt();
|
||||
pi.m_playerInfo.equipTypeId = map[QLatin1String("equipTypeId")].toInt();
|
||||
pi.m_playerInfo.typeClassId = map[QLatin1String("typeClassId")].toInt();
|
||||
pi.m_playerInfo.designator = map[QLatin1String("designator")].toString();
|
||||
pi.m_playerInfo.tactIdent = map[QLatin1String("tactIdent")].toString();
|
||||
pi.m_playerInfo.hierarchy = map[QLatin1String("hierarchy")].toString();
|
||||
pi.m_playerInfo.forceName = map[QLatin1String("forceName")].toString();
|
||||
pi.m_playerInfo.info = map[QLatin1String("info")].toString();
|
||||
pi.m_playerInfo.alias = map[QLatin1String("alias")].toString();
|
||||
pi.m_playerInfo.symbolPNG = map[QLatin1String("symbolPNG")].toByteArray();
|
||||
pi.m_playerInfo.symbolColor = map[QLatin1String("symbolColor")].toInt();
|
||||
pi.m_playerInfo.assignState = (IWMS2ECC::PlayerAssignState) map[QLatin1String("assignState")].toInt();
|
||||
pi.m_playerInfo.playerState = (IWMS2ECC::PlayerState) map[QLatin1String("playerState")].toInt();
|
||||
|
||||
pi.m_ok = map[QLatin1String("ok")].toBool();
|
||||
|
||||
return pi;
|
||||
}
|
||||
|
||||
QVariantMap PlayerInfo::toVariantMapAll() const
|
||||
{
|
||||
QVariantMap vMap;
|
||||
for (const IWMS2ECC::PlayerInfo &pi : m_allPlayerInfo)
|
||||
{
|
||||
m_playerInfo = pi;
|
||||
vMap.insert(QString::number(pi.playerId), QVariant(toVariantMap()));
|
||||
}
|
||||
|
||||
QVariantMap retMap;
|
||||
retMap[QLatin1String("plMap")] = QVariant(vMap);
|
||||
retMap[QLatin1String("ok")] = QVariant(m_ok);
|
||||
|
||||
return retMap;
|
||||
}
|
||||
|
||||
PlayerInfo PlayerInfo::fromVariantMapAll(const QVariantMap &map)
|
||||
{
|
||||
PlayerInfo players;
|
||||
|
||||
const QVariantMap vMap = map[QLatin1String("plMap")].toMap();
|
||||
for (const QVariant &data : vMap)
|
||||
{
|
||||
PlayerInfo player = PlayerInfo::fromVariantMap(data.toMap());
|
||||
IWMS2ECC::PlayerInfo pi = player.getPlayerInfo();
|
||||
players.m_allPlayerInfo.insert(pi.playerId, pi);
|
||||
}
|
||||
|
||||
players.m_ok = vMap[QLatin1String("ok")].toBool();
|
||||
return players;
|
||||
}
|
||||
|
||||
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "wms_ecc_ibase.h"
|
||||
#include "IWMS2ECC.h"
|
||||
|
||||
#include <QtCore/QVariantMap>
|
||||
|
||||
|
||||
class WMS_JSON_DS_EXPORT PlayerInfo : public IBase
|
||||
{
|
||||
public:
|
||||
static QJsonObject toJson(const IWMS2ECC::PlayerInfo &pi);
|
||||
static IWMS2ECC::PlayerInfo fromJson(const QJsonObject &obj);
|
||||
|
||||
QJsonObject toJsonAll() const;
|
||||
static PlayerInfo fromJsonAll(const QJsonObject &map);
|
||||
|
||||
QVariantMap toVariantMap() const;
|
||||
static PlayerInfo fromVariantMap(const QVariantMap &map);
|
||||
|
||||
QVariantMap toVariantMapAll() const;
|
||||
static PlayerInfo fromVariantMapAll(const QVariantMap &map);
|
||||
|
||||
IWMS2ECC::PlayerInfo getPlayerInfo() const { return m_playerInfo; }
|
||||
QMap<int, IWMS2ECC::PlayerInfo> getAllPlayerInfo() const { return m_allPlayerInfo; }
|
||||
bool getOk() const { return m_ok; }
|
||||
|
||||
void setPlayerInfo(const IWMS2ECC::PlayerInfo &info) { m_playerInfo = info; }
|
||||
void setAllPlayerInfo(const QMap<int, IWMS2ECC::PlayerInfo> &pi) { m_allPlayerInfo = pi; }
|
||||
void setOk(bool ok) { m_ok = ok; }
|
||||
|
||||
private:
|
||||
QMap<int, IWMS2ECC::PlayerInfo> m_allPlayerInfo;
|
||||
mutable IWMS2ECC::PlayerInfo m_playerInfo;
|
||||
bool m_ok = false;
|
||||
};
|
||||
|
||||
Executable
+89
@@ -0,0 +1,89 @@
|
||||
|
||||
|
||||
|
||||
#include "wms_ecc_registration.h"
|
||||
#include <QJsonObject>
|
||||
|
||||
QJsonObject Registration::toJson() const
|
||||
{
|
||||
QJsonObject obj;
|
||||
|
||||
obj[QLatin1String("playerId")] = m_playerId;
|
||||
obj[QLatin1String("assignment")] = m_assignment;
|
||||
obj[QLatin1String("exerciseId")] = m_exerciseId;
|
||||
obj[QLatin1String("ok")] = m_ok;
|
||||
|
||||
if (m_bEquipNoIsSet)
|
||||
obj[QLatin1String("equipNo")] = m_equipNo;
|
||||
if (m_bAliasIsSet)
|
||||
obj[QLatin1String("alias")] = m_alias;
|
||||
if (m_bInfoIsSet)
|
||||
obj[QLatin1String("info")] = m_info;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
Registration Registration::fromJson(const QJsonObject &obj)
|
||||
{
|
||||
Registration rg;
|
||||
|
||||
rg.m_playerId = obj[QLatin1String("playerId")].toInt();
|
||||
rg.m_assignment = IWMS2ECC::int2PlayerAssignState(obj[QLatin1String("assignment")].toInt());
|
||||
rg.m_exerciseId = obj[QLatin1String("exerciseId")].toInt();
|
||||
|
||||
rg.m_bEquipNoIsSet = obj.contains(QLatin1String("equipNo"));
|
||||
if (rg.m_bEquipNoIsSet)
|
||||
rg.m_equipNo = obj[QLatin1String("equipNo")].toInt();
|
||||
rg.m_bAliasIsSet = obj.contains(QLatin1String("alias"));
|
||||
if (rg.m_bAliasIsSet)
|
||||
rg.m_alias = obj[QLatin1String("alias")].toString();
|
||||
rg.m_bInfoIsSet = obj.contains(QLatin1String("info"));
|
||||
if (rg.m_bInfoIsSet)
|
||||
rg.m_info = obj[QLatin1String("info")].toString();
|
||||
rg.m_ok = obj[QLatin1String("ok")].toBool();
|
||||
|
||||
return rg;
|
||||
}
|
||||
|
||||
|
||||
QVariantMap Registration::toVariantMap() const
|
||||
{
|
||||
QVariantMap retMap;
|
||||
|
||||
retMap[QLatin1String("playerId")] = QVariant(m_playerId);
|
||||
retMap[QLatin1String("assignment")] = QVariant(m_assignment);
|
||||
retMap[QLatin1String("exerciseId")] = QVariant(m_exerciseId);
|
||||
|
||||
if (m_bEquipNoIsSet)
|
||||
retMap[QLatin1String("equipNo")] = QVariant(m_equipNo);
|
||||
if (m_bAliasIsSet)
|
||||
retMap[QLatin1String("alias")] = m_alias;
|
||||
if (m_bInfoIsSet)
|
||||
retMap[QLatin1String("info")] = m_info;
|
||||
|
||||
retMap[QLatin1String("ok")] = QVariant(m_ok);
|
||||
|
||||
return retMap;
|
||||
}
|
||||
|
||||
Registration Registration::fromVariantMap(const QVariantMap &map)
|
||||
{
|
||||
Registration rg;
|
||||
|
||||
rg.m_playerId = map[QLatin1String("playerId")].toInt();
|
||||
rg.m_assignment = IWMS2ECC::int2PlayerAssignState(map[QLatin1String("assignment")].toInt());
|
||||
rg.m_exerciseId = map[QLatin1String("exerciseId")].toInt();
|
||||
rg.m_ok = map[QLatin1String("ok")].toBool();
|
||||
|
||||
rg.m_bEquipNoIsSet = map.contains(QLatin1String("equipNo"));
|
||||
if (rg.m_bEquipNoIsSet)
|
||||
rg.m_equipNo = map[QLatin1String("equipNo")].toInt();
|
||||
rg.m_bAliasIsSet = map.contains(QLatin1String("alias"));
|
||||
if (rg.m_bAliasIsSet)
|
||||
rg.m_alias = map[QLatin1String("alias")].toString();
|
||||
rg.m_bInfoIsSet = map.contains(QLatin1String("info"));
|
||||
if (rg.m_bInfoIsSet)
|
||||
rg.m_info = map[QLatin1String("info")].toString();
|
||||
|
||||
return rg;
|
||||
}
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "wms_ecc_ibase.h"
|
||||
#include "IWMS2ECC.h"
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QVariantMap>
|
||||
|
||||
|
||||
class WMS_JSON_DS_EXPORT Registration : public IBase
|
||||
{
|
||||
public:
|
||||
QJsonObject toJson() const;
|
||||
static Registration fromJson(const QJsonObject &obj);
|
||||
|
||||
QVariantMap toVariantMap() const;
|
||||
static Registration fromVariantMap(const QVariantMap &map);
|
||||
|
||||
int getPlayerId() const { return m_playerId; }
|
||||
int getEquipNo() const { return m_equipNo; }
|
||||
int getExerciseId() const { return m_exerciseId; }
|
||||
QString getAlias() const { return m_alias; }
|
||||
QString getInfo() const { return m_info; }
|
||||
bool isEquipNoSet() const { return m_bEquipNoIsSet; }
|
||||
bool isAliasSet() const { return m_bAliasIsSet; }
|
||||
bool isInfoSet() const { return m_bInfoIsSet; }
|
||||
|
||||
IWMS2ECC::PlayerAssignState getAssignment() const { return m_assignment; }
|
||||
|
||||
bool getOk() const { return m_ok; }
|
||||
|
||||
void setPlayerId(int playerId) { m_playerId = playerId; }
|
||||
void setEquipNo(int equipNo) { m_equipNo = equipNo; m_bEquipNoIsSet = true; }
|
||||
void setAssignment(IWMS2ECC::PlayerAssignState assignment) { m_assignment = assignment; }
|
||||
void setExerciseId(int exerciseId) { m_exerciseId = exerciseId; }
|
||||
void setAlias(const QString &alias) { m_alias = alias; m_bAliasIsSet = true; }
|
||||
void setInfo(const QString &info) { m_info = info; m_bInfoIsSet = true; }
|
||||
void setOk(bool ok) { m_ok = ok; }
|
||||
|
||||
private:
|
||||
QString m_alias;
|
||||
QString m_info;
|
||||
IWMS2ECC::PlayerAssignState m_assignment = IWMS2ECC::UNDEFINED;
|
||||
int m_playerId = 0;
|
||||
int m_equipNo = 0;
|
||||
int m_exerciseId = -1;
|
||||
bool m_bEquipNoIsSet = false;
|
||||
bool m_bAliasIsSet = false;
|
||||
bool m_bInfoIsSet = false;
|
||||
bool m_ok = false;
|
||||
};
|
||||
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
|
||||
|
||||
|
||||
#include "wms_ecc_unregister.h"
|
||||
#include <QJsonObject>
|
||||
|
||||
QJsonObject Unregister::toJson() const
|
||||
{
|
||||
QJsonObject obj;
|
||||
|
||||
obj[QLatin1String("equipNo")] = m_equipNo;
|
||||
obj[QLatin1String("exerciseId")] = m_exerciseId;
|
||||
obj[QLatin1String("ok")] = m_ok;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
Unregister Unregister::fromJson(const QJsonObject &obj)
|
||||
{
|
||||
Unregister ur;
|
||||
|
||||
ur.m_equipNo = obj[QLatin1String("equipNo")].toInt();
|
||||
ur.m_exerciseId = obj[QLatin1String("exerciseId")].toInt();
|
||||
ur.m_ok = obj[QLatin1String("ok")].toBool();
|
||||
|
||||
return ur;
|
||||
}
|
||||
|
||||
QVariantMap Unregister::toVariantMap() const
|
||||
{
|
||||
QVariantMap retMap;
|
||||
|
||||
retMap[QLatin1String("equipNo")] = QVariant(m_equipNo);
|
||||
retMap[QLatin1String("exerciseId")] = QVariant(m_exerciseId);
|
||||
retMap[QLatin1String("ok")] = QVariant(m_ok);
|
||||
|
||||
return retMap;
|
||||
}
|
||||
|
||||
Unregister Unregister::fromVariantMap(const QVariantMap &map)
|
||||
{
|
||||
Unregister ur;
|
||||
|
||||
ur.m_equipNo = map[QLatin1String("equipNo")].toInt();
|
||||
ur.m_exerciseId = map[QLatin1String("exerciseId")].toInt();
|
||||
ur.m_ok = map[QLatin1String("ok")].toBool();
|
||||
|
||||
return ur;
|
||||
}
|
||||
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "wms_ecc_ibase.h"
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QVariantMap>
|
||||
|
||||
class WMS_JSON_DS_EXPORT Unregister : public IBase
|
||||
{
|
||||
public:
|
||||
QJsonObject toJson() const;
|
||||
static Unregister fromJson(const QJsonObject &obj);
|
||||
|
||||
QVariantMap toVariantMap() const;
|
||||
static Unregister fromVariantMap(const QVariantMap &map);
|
||||
|
||||
int getEquipNo() const { return m_equipNo; }
|
||||
int getExerciseId() const { return m_exerciseId; }
|
||||
bool getOk() const { return m_ok; }
|
||||
|
||||
void setEquipNo(int equipNo) { m_equipNo = equipNo; }
|
||||
void setExerciseId(int exerciseId) { m_exerciseId = exerciseId; }
|
||||
void setOk(bool ok) { m_ok = ok; }
|
||||
|
||||
private:
|
||||
int m_equipNo = 0;
|
||||
int m_exerciseId = -1;
|
||||
bool m_ok = false;
|
||||
};
|
||||
Reference in new issue
Block a user