Coin* Coin::create(rapidjson::Value& _value) { auto _coin = Coin::create(); _coin->loadJson(_value); _coin->debugShow(); return _coin; }
void Settings::loadDefaults() { ConfigDefaults::populateDefaults(*this); QString path = ConfPath::search("hoot.json"); loadEnvironment(); loadJson(path); try { QString localPath = ConfPath::search("LocalHoot.json"); loadJson(localPath); } catch(FileNotFoundException& e) { // pass } }
bool Bundle3D::load(const std::string& path) { if (_path == path) return true; getModelRelativePath(path); bool ret = false; std::string ext = path.substr(path.length() - 4, 4); std::transform(ext.begin(), ext.end(), ext.begin(), tolower); if (ext == ".c3t") { _isBinary = false; ret = loadJson(path); } else if (ext == ".c3b") { _isBinary = true; ret = loadBinary(path); } else { CCLOGINFO("%s is invalid file formate", path); } ret?(_path = path):(_path = ""); return ret; }
void reFBXAsset::load() { clearChildren(); bool importNeeded = true; ifstream ifs(metaPath().toStdString().c_str(), ios::in); if (!ifs.fail()) { Json::Reader reader; Json::Value root; reader.parse(ifs, root); QString hash = root["hash"].asString().c_str(); if (fileHash() == hash) { loadJson(root); importNeeded = false; } } if (importNeeded) import(); loadNodeAssets(); Json::StyledWriter writer; ofstream fs(metaPath().toStdString().c_str(), ios::out); fs << writer.write(getJson()); fs.close(); }
JsonViewerApplication::JsonViewerApplication(int& argc, char** argv): QApplication(argc, argv){ engine.addImageProvider("imageProvider", &imageProvider); engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); rootQML = engine.rootObjects()[0]; QObject::connect(rootQML,SIGNAL(jsonLoaded(QUrl)), this,SLOT(loadJson(QUrl))); }
void Manifest::parseVersion(const std::string& versionUrl) { loadJson(versionUrl); if (_json.IsObject()) { loadVersion(_json); } }
sprite::sprite(game *g, int x, int y, int z, std::string tex, Json::Value json) : drawable(g, x, y, z, tex) { frame = 0; intcount = 0; animation = 0; flip_x = 0; flip_y = 0; loadJson(json); }
void Manifest::parse(const std::string& manifestUrl) { loadJson(manifestUrl); if (_json.IsObject()) { // Register the local manifest root size_t found = manifestUrl.find_last_of("/\\"); if (found != std::string::npos) { _manifestRoot = manifestUrl.substr(0, found+1); } loadManifest(_json); } }
void sm::BoostPropertyTree::load(const boost::filesystem::path& fileName) { switch(getFileFormatAndThrowIfUnknown(fileName)){ case XML: loadXml(fileName); break; case INI: loadIni(fileName); break; case JSON: loadJson(fileName); break; case INFO: loadInfo(fileName); break; } }
minidragon::minidragon(game *g, int x, int y, int z) : sprite(g, x, y, z, "gfx.png") { loadJson(std::string("minidragon1.json")); setAnimation(0); isdead = 0; falling = 0; walk_dir = 2; walking = 1; untilfire = 40 + (rand() % 40); fire = 0; killminidragon = g->rm->getSound("killminidragon.wav"); firesound = g->rm->getSound("fire.wav"); myflame = new flame(g, x, y, z); }
L2DExpressionMotion* L2DExpressionMotion::loadJson(const string & filepath ) { int size = 0 ; char * buf = UtFile::loadFile(filepath.c_str() , &size ) ;// ファイルのロード if( buf == NULL ){ UtDebug::error( "load file failed : file : %s @L2DExpressionMotion#loadJson()" , filepath.c_str() ) ; return NULL ; } L2DExpressionMotion* ret = loadJson( buf , size ) ;// モデルに展開 if( buf ) UtFile::releaseLoadBuffer( buf ) ; return ret ; }
/*! * \brief Loads the environment configuration from a json file. * \author Sascha Kaden * \param[in] file path * \param[out] result of the loading * \date 2017-10-18 */ bool EnvironmentConfigurator::loadConfig(const std::string &filePath) { nlohmann::json json = loadJson(filePath); if (json.empty()) return false; m_obstaclePaths.clear(); auto numObstacles = json["NumObstacles"].get<size_t>(); for (size_t i = 0; i < numObstacles; ++i) m_obstaclePaths.push_back(json["ObstaclePath" + std::to_string(i)].get<std::string>()); m_workspaceDim = json["WorkspaceDim"].get<unsigned int>(); Vector3 bottomLeft = stringToVector<3>(json["MinWorkspaceBound"].get<std::string>()); Vector3 topRight = stringToVector<3>(json["MaxWorkspaceBound"].get<std::string>()); m_workspceBounding = AABB(bottomLeft, topRight); m_factoryType = static_cast<FactoryType>(json["FactoryType"].get<int>()); m_robotType = static_cast<RobotType>(json["RobotType"].get<int>()); return true; }
bool LyricJson::loadLRC(const QString& path, const QString& musicPath) { QFile infile(path); if (!infile.open(QIODevice::ReadOnly | QIODevice::Text)) { return false; } _song.Clear(); auto settings = Settings::getInstance(); _song.general.maxline = 2; // always 2 ? while (!infile.atEnd()) { QByteArray lineByte = infile.readLine(); QString line = QString::fromStdString(lineByte.toStdString()).trimmed(); if (!line.startsWith("[")) { continue; } if (!line.contains("]")) { continue; } int indexOfClose = line.indexOf("]"); QString controlPart = line.mid(1, indexOfClose - 1).trimmed(); if (controlPart.startsWith("ti:")) { _song.info.title = controlPart.right(controlPart.length() - 3); // no trim } else if (controlPart.startsWith("au:")) { _song.info.author = controlPart.right(controlPart.length() - 3); // no trim } else if (controlPart.startsWith("ar:")) { _song.info.artist = controlPart.right(controlPart.length() - 3); // no trim } else if (controlPart.startsWith("al:")) { _song.info.album = controlPart.right(controlPart.length() - 3); // no trim } else if (controlPart.startsWith("by:")) { _song.info.by = controlPart.right(controlPart.length() - 3); // no trim } else if (controlPart.startsWith("offset:")) { _song.general.offset = controlPart.right(controlPart.length() - 7).toLongLong(); } else if (controlPart.at(0).isDigit()) { QTime beginTime = QTime::fromString(controlPart + "0", "mm:ss.zzz"); qint64 begin = beginTime.msecsSinceStartOfDay(); KJsonSentence sentence; KJsonWord word; word.begin = begin; word.end = begin + settings->maximumDuration(); //std::numeric_limits<qint64>::max(); word.text = line.right(line.length() - indexOfClose - 1); if (word.text.isEmpty()) { int thisIndex = _song.lyric.sentencelist.count(); if (thisIndex % _song.general.maxline == 0) { // skip continue; } else { // move up // skip multiple whites if (_song.lyric.sentencelist.last().wordlist.last().begin < 0) { continue; } else { word.end = word.begin + settings->minimumDuration(); } } } if (!_song.lyric.sentencelist.empty()) { KJsonWord& lastword = _song.lyric.sentencelist.last().wordlist.last(); if (lastword.end - lastword.begin> settings->minimumDuration()) { lastword.end = begin;// - lastword.begin; } } sentence.wordlist.append(word); _song.lyric.sentencelist.append(sentence); } } KJsonSong songCopy = _song; // first generate weak version treatSentecesAsControl(); QString jsonPath = Settings::getInstance()->makeJsonPath(path, false); exportToJson(jsonPath); _song = songCopy; lrcWordSeparate(); exportToASS(Settings::getInstance()->makeASSPath(path), musicPath); return loadJson(jsonPath); }
MissionPage* MissionPage::create(rapidjson::Value& _value) { auto _missionPage = MissionPage::create(); _missionPage->loadJson(_value); return _missionPage; }
bool JsonTableModel::load(QIODevice *device) { return loadJson(device->readAll()); }
void sprite::loadJson(std::string res) { loadJson(resource(res).getJson()); }