void SWGPlansApi::showPlan(QString* id, qint32 year) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/plans/{id}"); QString idPathParam("{"); idPathParam.append("id").append("}"); fullPath.replace(idPathParam, stringValue(id)); if (fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("year")) .append("=") .append(QUrl::toPercentEncoding(stringValue(year))); HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "GET"); connect(worker, &HttpRequestWorker::on_execution_finished, this, &SWGPlansApi::showPlanCallback); worker->execute(&input); }
void SWGOutputApi::jobsJobIdOutputGet(QString* conversionId, QString* inputId, QString* xOcToken, QString* xOcApiKey, QString* jobId) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/jobs/{job_id}/output"); QString jobIdPathParam("{"); jobIdPathParam.append("jobId").append("}"); fullPath.replace(jobIdPathParam, stringValue(jobId)); if(fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("conversionId")) .append("=") .append(QUrl::toPercentEncoding(stringValue(conversionId))); if(fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("inputId")) .append("=") .append(QUrl::toPercentEncoding(stringValue(inputId))); HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "GET"); // TODO: add header support // TODO: add header support connect(worker, &HttpRequestWorker::on_execution_finished, this, &SWGOutputApi::jobsJobIdOutputGetCallback); worker->execute(&input); }
/* Executables::parseGameExe * Parses a game executable config from [node] *******************************************************************/ void Executables::parseGameExe(ParseTreeNode* node, bool custom) { // Get game_exe_t being parsed game_exe_t* exe = getGameExe(node->getName().Lower()); if (!exe) { // Create if new game_exe_t nexe; nexe.custom = custom; game_exes.push_back(nexe); exe = &(game_exes.back()); } exe->id = node->getName(); for (unsigned b = 0; b < node->nChildren(); b++) { auto prop = node->getChildPTN(b); string prop_name = prop->getName().Lower(); // Config if (prop->type().Lower() == "config") { // Update if exists bool found = false; for (unsigned c = 0; c < exe->configs.size(); c++) { if (exe->configs[c].key == prop->getName()) { exe->configs[c].value = prop->stringValue(); found = true; } } // Create if new if (!found) { exe->configs.push_back(key_value_t(prop->getName(), prop->stringValue())); exe->configs_custom.push_back(custom); } } // Name else if (prop_name == "name") exe->name = prop->stringValue(); // Executable name else if (prop_name == "exe_name") exe->exe_name = prop->stringValue(); } // Set path if loaded for (auto& path : exe_paths) if (path.key == exe->id) exe->path = path.value; }
void SWGPrivateApi::syncschedule(QString* deviceId, QString* moduleId, SWGNAThermProgram thermProgram) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/syncschedule"); if(fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("deviceId")) .append("=") .append(QUrl::toPercentEncoding(stringValue(deviceId))); if(fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("moduleId")) .append("=") .append(QUrl::toPercentEncoding(stringValue(moduleId))); HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "POST"); QString output = thermProgram.asJson(); input.request_body.append(output); connect(worker, &HttpRequestWorker::on_execution_finished, this, &SWGPrivateApi::syncscheduleCallback); worker->execute(&input); }
std::unique_ptr<Expr> FlowParser::interpolatedStr() { FNTRACE(); FlowLocation sloc(location()); std::unique_ptr<Expr> result = std::make_unique<StringExpr>(stringValue(), sloc.update(end())); nextToken(); // interpolation start std::unique_ptr<Expr> e(expr()); if (!e) return nullptr; result = asString(std::move(result)); if (!result) { reportError("Cast error in string interpolation."); return nullptr; } while (token() == FlowToken::InterpolatedStringFragment) { FlowLocation tloc = sloc.update(end()); result = std::make_unique<BinaryExpr>( Opcode::SADD, std::move(result), std::make_unique<StringExpr>(stringValue(), tloc) ); nextToken(); e = expr(); if (!e) return nullptr; e = asString(std::move(e)); if (!e) { reportError("Cast error in string interpolation."); return nullptr; } result = std::make_unique<BinaryExpr>(Opcode::SADD, std::move(result), std::move(e)); } if (!consume(FlowToken::InterpolatedStringEnd)) return nullptr; if (!stringValue().empty()) { result = std::make_unique<BinaryExpr>( Opcode::SADD, std::move(result), std::make_unique<StringExpr>(stringValue(), sloc.update(end())) ); } nextToken(); return result; }
void SWGJobsApi::jobsGet(QString* status, QString* xOcToken, QString* xOcApiKey, SWGNumber* page) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/jobs"); if(fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("status")) .append("=") .append(QUrl::toPercentEncoding(stringValue(status))); if(fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("page")) .append("=") .append(QUrl::toPercentEncoding(stringValue(page))); HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "GET"); // TODO: add header support // TODO: add header support connect(worker, &HttpRequestWorker::on_execution_finished, this, &SWGJobsApi::jobsGetCallback); worker->execute(&input); }
// Returns the string that results from concatenating the arguments. // concat() returns NULL if any argument is NULL. // string Func_concat::getStrVal(Row& row, FunctionParm& parm, bool& isNull, CalpontSystemCatalog::ColType&) { string ret = stringValue(parm[0], row, isNull); for ( unsigned int id = 1 ; id < parm.size() ; id++) { ret.append( stringValue(parm[id], row, isNull) ); } return ret; }
void SWGPrivateApi::getthermstate(QString* deviceId, QString* moduleId) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/getthermstate"); if(fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("deviceId")) .append("=") .append(QUrl::toPercentEncoding(stringValue(deviceId))); if(fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("moduleId")) .append("=") .append(QUrl::toPercentEncoding(stringValue(moduleId))); HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "GET"); connect(worker, &HttpRequestWorker::on_execution_finished, this, &SWGPrivateApi::getthermstateCallback); worker->execute(&input); }
void SWGMeasurementsApi::measurementsRangeGet(QString* sources, qint32 user) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/measurementsRange"); if(fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("sources")) .append("=") .append(QUrl::toPercentEncoding(stringValue(sources))); if(fullPath.indexOf("?") > 0) fullPath.append("&"); else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("user")) .append("=") .append(QUrl::toPercentEncoding(stringValue(user))); HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "GET"); connect(worker, &HttpRequestWorker::on_execution_finished, this, &SWGMeasurementsApi::measurementsRangeGetCallback); worker->execute(&input); }
size_t hash() const { Hasher hasher; hasher.add(kind()); switch (kind()) { case NULLVAL: break; case BOOLEAN: hasher.add(boolValue()); break; case INTEGER: hasher.add(integerValue()); break; case FLOATINGPOINT: hasher.add(floatValue()); break; case CHARACTER: hasher.add(characterValue()); break; case STRING: hasher.add(stringValue()); break; } return hasher.get(); }
ControlModeEnum ControlModeFromString( const std::string& origStringValue ) { std::string stringValue(origStringValue); boost::algorithm::trim(stringValue); if (stringValue == "ORAT") return ORAT; else if (stringValue == "WRAT") return WRAT; else if (stringValue == "GRAT") return GRAT; else if (stringValue == "LRAT") return LRAT; else if (stringValue == "CRAT") return CRAT; else if (stringValue == "RESV") return RESV; else if (stringValue == "BHP") return BHP; else if (stringValue == "THP") return THP; else if (stringValue == "GRUP") return GRUP; else throw std::invalid_argument("Unknown enum state string: " + stringValue ); }
float GxxValue::floatValue() { if (ptrStringData){ return (float)atof(stringValue()); } return 0; }
double GxxValue::doubleValue() { if (ptrStringData){ return atof(stringValue()); } return 0; }
void AsteriskManager::onReadyRead() { QRegExp keyValue("^([A-Za-z0-9\\-]+):\\s(.+)$"); QByteArray line; qDebug("<ami>"); while (canReadLine()) { line = readLine(); qDebug() << line.trimmed(); if (line != "\r\n") { if (keyValue.indexIn(line) > -1) { packetBuffer[keyValue.cap(1)] = stringValue(keyValue.cap(2).trimmed()); } else if (line.startsWith("Asterisk Call Manager")) { version_ = line.replace("Asterisk Call Manager/", QByteArray()).trimmed(); emit connected(version_); } } else if (!packetBuffer.isEmpty()) { dispatchPacket(); } } qDebug("</ami>"); }
int GxxValue::intValue() { if (ptrStringData){ return atoi(stringValue()); } return 0; }
int CMessageHandler::print() { if (callback_) { int messageNumber = currentMessage().externalNumber(); if (currentSource() != "Clp") messageNumber += 1000000; int i; int nDouble = numberDoubleFields(); assert (nDouble <= 10); double vDouble[10]; for (i = 0; i < nDouble; i++) vDouble[i] = doubleValue(i); int nInt = numberIntFields(); assert (nInt <= 10); int vInt[10]; for (i = 0; i < nInt; i++) vInt[i] = intValue(i); int nString = numberStringFields(); assert (nString <= 10); char * vString[10]; for (i = 0; i < nString; i++) { std::string value = stringValue(i); vString[i] = CoinStrdup(value.c_str()); } callback_(model_, messageNumber, nDouble, vDouble, nInt, vInt, nString, vString); for (i = 0; i < nString; i++) free(vString[i]); } return CoinMessageHandler::print(); }
void NPVariantData::encode(CoreIPC::ArgumentEncoder& encoder) const { encoder << m_type; switch (type()) { case NPVariantData::Void: case NPVariantData::Null: break; case NPVariantData::Bool: encoder << boolValue(); break; case NPVariantData::Int32: encoder << int32Value(); break; case NPVariantData::Double: encoder << doubleValue(); break; case NPVariantData::String: encoder << stringValue(); break; case NPVariantData::LocalNPObjectID: encoder << localNPObjectIDValue(); break; case NPVariantData::RemoteNPObjectID: encoder << remoteNPObjectIDValue(); break; } }
void SWGCloudFileApi::saveFileData(QString* myAppId, SWGFileBody fileObj) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("file/{my_app_id}"); QString myAppIdPathParam("{"); myAppIdPathParam.append("myAppId").append("}"); fullPath.replace(myAppIdPathParam, stringValue(myAppId)); HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "POST"); QString output = fileObj.asJson(); input.request_body.append(output); connect(worker, &HttpRequestWorker::on_execution_finished, this, &SWGCloudFileApi::saveFileDataCallback); worker->execute(&input); }
// XXX FIXME See comment at the other parseOptions variant. void LibvlcPlaylistNPObject::parseOptions(NPObject *obj, int *i_options, char*** ppsz_options) { /* WARNING: Safari does not implement NPN_HasProperty/NPN_HasMethod */ NPVariant value; /* we are expecting to have a Javascript Array object */ NPIdentifier propId = NPN_GetStringIdentifier("length"); if( NPN_GetProperty(_instance, obj, propId, &value) ) { int count = numberValue(value); NPN_ReleaseVariantValue(&value); if( count ) { long capacity = 16; char **options = (char **)malloc(capacity*sizeof(char *)); if( options ) { int nOptions = 0; while( nOptions < count ) { propId = NPN_GetIntIdentifier(nOptions); if( ! NPN_GetProperty(_instance, obj, propId, &value) ) /* return what we got so far */ break; if( ! NPVARIANT_IS_STRING(value) ) { /* return what we got so far */ NPN_ReleaseVariantValue(&value); break; } if( nOptions == capacity ) { capacity += 16; char **moreOptions = (char **)realloc(options, capacity*sizeof(char*)); if( ! moreOptions ) { /* failed to allocate more memory */ NPN_ReleaseVariantValue(&value); /* return what we got so far */ *i_options = nOptions; *ppsz_options = options; break; } options = moreOptions; } options[nOptions++] = stringValue(value); } *i_options = nOptions; *ppsz_options = options; } } } }
void SWGConversionApi::jobsJobIdConversionsGet(QString* xOcToken, QString* xOcApiKey, QString* jobId) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/jobs/{job_id}/conversions"); QString jobIdPathParam("{"); jobIdPathParam.append("jobId").append("}"); fullPath.replace(jobIdPathParam, stringValue(jobId)); HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "GET"); // TODO: add header support // TODO: add header support connect(worker, &HttpRequestWorker::on_execution_finished, this, &SWGConversionApi::jobsJobIdConversionsGetCallback); worker->execute(&input); }
bool FlowParser::importOne(std::list<std::string>& names) { switch (token()) { case FlowToken::Ident: case FlowToken::String: case FlowToken::RawString: names.push_back(stringValue()); nextToken(); break; case FlowToken::RndOpen: nextToken(); if (!importOne(names)) return false; while (token() == FlowToken::Comma) { nextToken(); // skip comma if (!importOne(names)) return false; } if (!consume(FlowToken::RndClose)) return false; break; default: reportError("Syntax error in import declaration."); return false; } return true; }
// 'var' IDENT ['=' EXPR] [';'] std::unique_ptr<Variable> FlowParser::varDecl() { FNTRACE(); FlowLocation loc(lexer_->location()); if (!consume(FlowToken::Var)) return nullptr; if (!consume(FlowToken::Ident)) return nullptr; std::string name = stringValue(); if (!consume(FlowToken::Assign)) return nullptr; std::unique_ptr<Expr> initializer = expr(); if (!initializer) return nullptr; loc.update(initializer->location().end); consumeIf(FlowToken::Semicolon); return std::make_unique<Variable>(name, std::move(initializer), loc); }
void NPVariantData::encode(CoreIPC::ArgumentEncoder* encoder) const { encoder->encode(m_type); switch (type()) { case NPVariantData::Void: case NPVariantData::Null: break; case NPVariantData::Bool: encoder->encode(boolValue()); break; case NPVariantData::Int32: encoder->encode(int32Value()); break; case NPVariantData::Double: encoder->encode(doubleValue()); break; case NPVariantData::String: encoder->encode(stringValue()); break; case NPVariantData::LocalNPObjectID: encoder->encode(localNPObjectIDValue()); break; case NPVariantData::RemoteNPObjectID: encoder->encode(remoteNPObjectIDValue()); break; } }
bool MLProfile::boolValue(QString section,QString tag, bool default_value,bool *ok) const { bool valid; QString str=stringValue(section,tag,"",&valid).lower(); if(!valid) { if(ok!=NULL) { *ok=false; } return default_value; } if((str=="yes")||(str=="true")||(str=="on")) { if(ok!=NULL) { *ok=true; } return true; } if((str=="no")||(str=="false")||(str=="off")) { if(ok!=NULL) { *ok=true; } return false; } if(ok!=NULL) { *ok=false; } return default_value; }
void Opcode8014Handler::_run() { auto& debug = Logger::debug("SCRIPT"); debug << "[8014] [+] value = op_fetch_external(name)" << std::endl; auto game = Game::getInstance(); auto EVARS = game->locationState()->EVARS(); std::string name; auto nameValue = _vm->dataStack()->pop(); switch (nameValue.type()) { case VMStackValue::Type::INTEGER: name = _vm->script()->identifiers()->at((unsigned int)nameValue.integerValue()); break; case VMStackValue::Type::STRING: { name = nameValue.stringValue(); break; } default: _error(std::string("op_fetch_external - invalid argument type: ") + nameValue.typeName()); } debug << " name = " << name; if (EVARS->find(name) == EVARS->end()) { _error(std::string() + "op_fetch_external: exported variable \"" + name + "\" not found."); } auto value = EVARS->at(name); debug << ", type = " << value.typeName() << ", value = " << value.toString() << std::endl; _vm->dataStack()->push(value); }
GuideRatePhaseEnum GuideRatePhaseEnumFromString( const std::string& origStringValue ) { std::string stringValue(origStringValue); boost::algorithm::trim(stringValue); if (stringValue == "OIL") return OIL; else if (stringValue == "WAT") return WAT; else if (stringValue == "GAS") return GAS; else if (stringValue == "LIQ") return LIQ; else if (stringValue == "COMB") return COMB; else if (stringValue == "WGA") return WGA; else if (stringValue == "CVAL") return CVAL; else if (stringValue == "RAT") return RAT; else if (stringValue == "RES") return RES; else if (stringValue == "UNDEFINED") return UNDEFINED; else throw std::invalid_argument("Unknown enum state string: " + stringValue ); }
bool PluginInfoCache::getPluginInfo(const String& pluginPath, PluginModuleInfo& plugin) { CString pluginGroup = pluginPath.utf8(); if (!g_key_file_has_group(m_cacheFile.get(), pluginGroup.data())) return false; time_t lastModified; if (!WebCore::getFileModificationTime(pluginPath, lastModified)) return false; time_t cachedLastModified = static_cast<time_t>(g_key_file_get_uint64(m_cacheFile.get(), pluginGroup.data(), "mtime", nullptr)); if (lastModified != cachedLastModified) return false; plugin.path = pluginPath; plugin.info.file = WebCore::pathGetFileName(pluginPath); GUniquePtr<char> stringValue(g_key_file_get_string(m_cacheFile.get(), pluginGroup.data(), "name", nullptr)); plugin.info.name = String::fromUTF8(stringValue.get()); stringValue.reset(g_key_file_get_string(m_cacheFile.get(), pluginGroup.data(), "description", nullptr)); plugin.info.desc = String::fromUTF8(stringValue.get()); #if PLUGIN_ARCHITECTURE(X11) stringValue.reset(g_key_file_get_string(m_cacheFile.get(), pluginGroup.data(), "mime-description", nullptr)); NetscapePluginModule::parseMIMEDescription(String::fromUTF8(stringValue.get()), plugin.info.mimes); #endif plugin.requiresGtk2 = g_key_file_get_boolean(m_cacheFile.get(), pluginGroup.data(), "requires-gtk2", nullptr); return true; }
QString VcsBaseClientSettings::binaryPath() const { if (d->m_binaryFullPath.isEmpty()) { d->m_binaryFullPath = Utils::Environment::systemEnvironment().searchInPath( stringValue(binaryPathKey), searchPathList()); } return d->m_binaryFullPath; }
double txNodeSet::numberValue() { nsAutoString str; stringValue(str); return Double::toDouble(str); }
JSValue* CInstance::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const { if (hint == PreferString) return stringValue(exec); if (hint == PreferNumber) return numberValue(exec); return valueOf(exec); }