Beispiel #1
0
 void logoEasingSetup(const int type, const std::string& easing, const picojson::object& params)
 {
   const picojson::array& array = params.find(easing)->second.get<picojson::array>();
   for(u_int i = 0; i < logos_.size(); ++i)
   {
     const picojson::array& a = params.find(array[i].get<std::string>())->second.get<picojson::array>();
     EasingArayVec3(type, a, logos_[i].easing);
   }
 }
T getValueFromJson( const picojson::object & o, const char * key ) {
    picojson::object::const_iterator it = o.find( key );
    if( it == o.end() ) {
        std::string err = keyNotFoundErrorMessage( key );
        LOG( ERROR ) << err;
        throw err;
    }
    return it->second.get<T>();
}
bool ApplicationConfig::load(picojson::object& obj)
{
    auto poProcessName = obj.find("processName");
    auto poDefaultEndpointId = obj.find("defaultEndpointId");

    if (poProcessName == obj.end() || poDefaultEndpointId == obj.end()) {
        return false;
    }

    if (!poProcessName->second.is<std::string>() ||
        !poDefaultEndpointId->second.is<std::string>()) {
        return false;
    }

    processName = poProcessName->second.get<std::string>();
    defaultEndpointId = poDefaultEndpointId->second.get<std::string>();
    return true;
}
Beispiel #4
0
 void logoWidgetsSetup(const std::string& widget, const picojson::object& params, const WidgetsMap& widgets)
 {
   const picojson::array& array = params.find(widget)->second.get<picojson::array>();
   for(picojson::array::const_iterator it = array.begin(); it != array.end(); ++it)
   {
     Logo logo;
     logo.widget = widgets.get(it->get<std::string>());
     logos_.push_back(logo);
   }
 }
void DriverConfig::load(picojson::object& obj)
{
    auto poDriverClsid = obj.find("driverClsid");
    auto poEndpoints = obj.find("endpoints");
    auto poApplications = obj.find("applications");

    if (poDriverClsid != obj.end() &&
        poDriverClsid->second.is<std::string>()) {

        driverClsid = poDriverClsid->second.get<std::string>();
    }

    if (poEndpoints != obj.end() && poEndpoints->second.is<picojson::array>()) {
        for (auto& item : poEndpoints->second.get<picojson::array>()) {
            if (!item.is<picojson::object>()) {
                continue;
            }

            EndpointConfig endpoint;

            endpoint.load(item.get<picojson::object>());
            endpoints.emplace_back(endpoint);
        }
    }

    if (poApplications != obj.end() &&
        poApplications->second.is<picojson::array>()) {
        for (auto& item : poApplications->second.get<picojson::array>()) {
            if (!item.is<picojson::object>()) {
                continue;
            }

            ApplicationConfig application;

            application.load(item.get<picojson::object>());
            applications.emplace_back(application);
        }
    }
}
bool ListingsRepository::validateJsonObject(const picojson::object& obj) const
{
  return obj.find("title") != obj.end() && obj.find("manufacturer") != obj.end() 
    && obj.find("currency") != obj.end() && obj.find("price") != obj.end();
}