StelPropertyService.cpp   StelPropertyService.cpp 
skipping to change at line 31 skipping to change at line 31
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelLocationMgr.hpp" #include "StelLocationMgr.hpp"
#include <QJsonArray> #include <QJsonArray>
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject> #include <QJsonObject>
StelPropertyService::StelPropertyService(const QByteArray &serviceName, QOb StelPropertyService::StelPropertyService(QObject *parent)
ject *parent) : AbstractAPIService(parent)
: AbstractAPIService(serviceName,parent)
{ {
propMgr = StelApp::getInstance().getStelPropertyManager(); propMgr = StelApp::getInstance().getStelPropertyManager();
} }
void StelPropertyService::getImpl(const QByteArray& operation, const APIPar ameters &parameters, APIServiceResponse &response) void StelPropertyService::get(const QByteArray& operation, const APIParamet ers &parameters, APIServiceResponse &response)
{ {
Q_UNUSED(parameters); Q_UNUSED(parameters);
if(operation=="list") if(operation=="list")
{ {
QJsonObject rootObj; QJsonObject rootObj;
const StelPropertyMgr::StelPropertyMap& map = propMgr->getPr opertyMap(); const StelPropertyMgr::StelPropertyMap& map = propMgr->getPr opertyMap();
for(StelPropertyMgr::StelPropertyMap::const_iterator it = ma p.constBegin(); for(StelPropertyMgr::StelPropertyMap::const_iterator it = ma p.constBegin();
it!=map.constEnd();++it) it!=map.constEnd();++it)
skipping to change at line 73 skipping to change at line 73
response.writeJSON(QJsonDocument(rootObj)); response.writeJSON(QJsonDocument(rootObj));
} }
else else
{ {
//TODO some sort of service description? //TODO some sort of service description?
response.writeRequestError("unsupported operation. GET: list POST: set"); response.writeRequestError("unsupported operation. GET: list POST: set");
} }
} }
void StelPropertyService::postImpl(const QByteArray &operation, const APIPa rameters &parameters, const QByteArray &data, APIServiceResponse &response) void StelPropertyService::post(const QByteArray &operation, const APIParame ters &parameters, const QByteArray &data, APIServiceResponse &response)
{ {
Q_UNUSED(data); Q_UNUSED(data);
if(operation=="set") if(operation=="set")
{ {
QString id = QString::fromUtf8(parameters.value("id")); QString id = QString::fromUtf8(parameters.value("id"));
QString val = QString::fromUtf8(parameters.value("value")); QString val = QString::fromUtf8(parameters.value("value"));
QMetaProperty prop = propMgr->getMetaProperty(id); QMetaProperty prop = propMgr->getMetaProperty(id);
if(!prop.isValid()) if(!prop.isValid())
 End of changes. 3 change blocks. 
5 lines changed or deleted 4 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/