void Driver::getPath(char xmlFile[20]) { p.loadFile(xmlFile); p.get_cloud_path(cpath); p.get_mobile_path(mpath); p.get_local_path(lpath); }
bool Resolution::passStandardCuts(int planeID, const Data &data) { XmlParser* theParser = theAnalysisManager_->getXmlParser(); if(theParser->getAnalysesFromString("Charge")->applyStandardCuts()) { return true; } int minHits = 7;//To calculate efficiency on the telescope int excludeMe = 0; if(thePlaneMapping_->getPlaneName(planeID).find("Dut") != std::string::npos)//Dut case minHits = atoi(theParser->getAnalysesFromString("Charge")->getMinHits().c_str()); else if(data.getHasHit(planeID) && data.getClusterSize(planeID)<=2)//Telescope case excludeMe = 1; int hitsontelescope = 0; bool HitsClusterLE2 = true; for (unsigned int i = 0; i < 8; i++) { if (data.getHasHit(i) == true) hitsontelescope++; if (data.getClusterSize(i) > 2) { HitsClusterLE2 = false; } } if(hitsontelescope >= minHits) return true; else return false; }
void LibreOfficeInspector::_readLanguage() { XmlParser parser; wstring lang_found, file; _getPreferencesFile(file); if (parser.Load(file)) { parser.Parse(_readNodeCallback, &lang_found); if (m_version.size() > 0 && lang_found.size() == 0) { wstring locale; _readLocale(locale); lang_found = L"locale:" + locale; } g_log.Log(L"LibreOfficeInspector::_readLanguage. Preferences file '%s', language '%s'", (wchar_t *)file.c_str(), (wchar_t *) lang_found.c_str()); } else { g_log.Log(L"LibreOfficeInspector::_readLanguage. Could not open '%s'", (wchar_t *) file.c_str()); } m_KeyValues.push_back(InspectorKeyValue(L"lang",lang_found)); }
Value ParseXmlRpcParam(XmlParser& p) { p.PassTag("param"); Value v = ParseXmlRpcValue(p); p.PassEnd(); return v; }
int main(void) { XmlParser myParser; Configuration conf; if (true == myParser.read("ZiaConf.xml", conf)) { const Dictionnary& plugin = static_cast<const Dictionnary&>(conf.getHive("Plugins")); const Dictionnary& items = static_cast<const Dictionnary&>(conf.getHive("Main")); std::map<std::string, std::string> pluginMap = plugin.getContent(); std::map<std::string, std::string> itemsMap = items.getContent(); std::map<std::string, std::string>::iterator it; std::map<std::string, std::string>::iterator end; std::cerr << "file mapper:" << std::endl; for (it = pluginMap.begin(), end = pluginMap.end(); it != end; ++it) { std::cerr << "Key: " << it->first << std::endl; std::cerr << "Value: " << it->second << std::endl; } std::cerr << "ssl:" << std::endl; for (it = itemsMap.begin(), end = itemsMap.end(); it != end; ++it) { std::cerr << "Key: " << it->first << std::endl; std::cerr << "Value: " << it->second << std::endl; } } return (0); }
int main() { XmlParser *xmlParser = new XmlParser(); String xml = "<servers>\n"; xml += "<srv ip=\"1.2.3.4\" port=\"443\" />"; xml += "<srv ip=\"3.4.5.6\" port=\"80\" />"; xml += "<srv ip=\"5.6.7.8\" port=\"8080\" />"; xml += "</servers>"; xmlParser->setString(xml); xmlParser->parse(); int count = xmlParser->lstTag.getCount(); for (int i = 0; i < count; i++) { XmlTag *xmlTag = (XmlTag*)xmlParser->lstTag.getItem(i); printf("name = %s\n", xmlTag->name.to_string().c_str()); int count = xmlTag->lstTag.getCount(); for (int i = 0; i < count; i++) { XmlTag *xmlTag2 = (XmlTag*)xmlTag->lstTag.getItem(i); printf(" name2 = %s\n", xmlTag2->name.to_string().c_str()); int count = xmlTag2->attrs.getCount(); for (int i = 0; i < count; i++) { String name = xmlTag2->attrs.getName(i); String value = xmlTag2->attrs.getValue(i); printf(" name = %s, value = %s\n", name.to_string().c_str(), value.to_string().c_str()); } } } getchar(); return 0; }
InstanceLoader::InstanceLoader(shared_ptr<AgentPlateform> agentPlateform,shared_ptr <Environment> environment, string filename, bool toRun) { _toRun = toRun; if (filename != "") { _environment = environment; _agentPlateform = agentPlateform; _model = _environment->getModel(); XmlParser parser; #if BOOST_FILESYSTEM_VERSION == 2 _basedir=fs::path(filename).branch_path().file_string(); #else _basedir=fs::path(filename).branch_path().string(); #endif //remplacer branch_path par parent_path dans nouvelle version boost parser.parseFile(filename); shared_ptr<XmlNode> root (parser.getRoot()); _parseInstances(root); _addRelations(); } _relations.clear(); cerr << " ##################FIN INSTANCES " << endl; }
void Bundle::loadFromDisk() { std::ifstream file; GetBundleFileHandleForReading(this->bundleName, file); if (file.good()) { XmlParser* parser = new XmlParser(); parser->ParseXmlFile(file); XmlTree* tree = parser->GetXmlTree(); VERIFY(tree != nullptr, "Got xml tree for bundle data in bundle %s", this->bundleName.c_str()); XmlNode* rootNode = tree->GetRootNode(); VERIFY(rootNode != nullptr, "Got root node for bundle data in bundle %s", this->bundleName.c_str()); VERIFY(rootNode->GetName() == BUNDLE_TAG, "Got bundle node for bundle data in bundle %s", this->bundleName.c_str()); XmlNode* dataNode = rootNode->GetFirstChildByNodeName(DATA_TAG); while(dataNode != nullptr) { std::string key = dataNode->GetAttributeValueS(KEY_ATTRIBUTE); std::string value = dataNode->GetAttributeValueS(VALUE_ATTRIBUTE); this->PutString(key, value); // dataNode = dataNode->GetNextSiblingByNodeName(DATA_TAG); } delete parser; } }
AssetManagerGlue::XmlParser* AssetManagerGlue::XmlBlock::nativeCreateParseState() { XmlParser* parser = new XmlParser(*this); parser->restart(); return parser; }
int main(void) { signal(SIGINT, stopServer); Server *server; unsigned short portSSL, portHttp, portAdmin; XmlParser parser; Configuration ziaConf; parser.read("ZiaConf.xml", ziaConf); loadConfiguration(ziaConf, portSSL, portHttp, portAdmin); try { server = Server::getInstance(static_cast<const Dictionnary &>(ziaConf.getHive("Main")), portSSL, portHttp, portAdmin); } catch (const std::exception& e) { std::cerr << e.what() << std::endl; return (EXIT_FAILURE); } server->loadStartingPlugins(ziaConf.getHive("Plugins")); server->run(); std::cerr << "DEBUG ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CA TERMINE PROPREMENT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl; Server::destroyInstance(); return (EXIT_SUCCESS); }
/// /// Save the MIME types configuration to file. /// Returns negative on error. /// int MIMEtypeXML::save(const char * filename) { XmlParser xmlFile; int ret = save_core(xmlFile); xmlFile.save((char *)filename); // But, but, but I promis xmlFile.close(); return ret; }
/// /// Save the MIME types configuration to a memory buffer. /// Returns negative on error. /// int MIMEtypeXML::saveMemBuf(MemBuf & buffer) { XmlParser xmlFile; int ret = save_core(xmlFile); xmlFile.saveMemBuf(buffer); xmlFile.close(); return ret; }
bool CTextNode::LoadFromFile(IFile* file) { XmlParser parser; m_xmlNode = parser.parse(file); m_constXmlNode = m_xmlNode; RebuildChildrenList(); return (m_xmlNode != NULL); }
ValueArray ParseXmlRpcParams(XmlParser& p) { ValueArray va; if(p.Tag("params")) while(!p.End()) va.Add(ParseXmlRpcParam(p)); return va; }
void NPC::Initialize(XmlParser& parser, CL_ResourceManager& resources) { Character::Initialize(parser, resources); m_behaviorValues[eAggression] = parser.ReadInt("/ObjectData/BehaviorValues/AGGRESSION"); m_behaviorValues[eDesire] = parser.ReadInt("/ObjectData/BehaviorValues/DESIRE"); m_behaviorValues[eFear] = parser.ReadInt("/ObjectData/BehaviorValues/FEAR"); m_behaviorValues[eMisc] = parser.ReadInt("/ObjectData/BehaviorValues/MISC"); m_behaviorValues[eWander] = parser.ReadInt("/ObjectData/BehaviorValues/WANDER"); }
MainWindow::MainWindow() { XmlParser xf; xf.open(config_file_path); xf.loadXmlData(); enableSysTray = xf.getCheckbox(QString::fromStdString("notification")); real_close = false; w = new CentralWidget(); connect(w,SIGNAL(change_ctd_d(const ctd_d*)),this,SLOT(changeTrayTime(const ctd_d*))); connect(w,SIGNAL(change_pause_f(QString)),this,SLOT(changeWindowTitle(QString))); sysTrayIcon = new QSystemTrayIcon(QIcon(":/photos/resource/p_icon.png")); sysTrayIcon->setVisible(true);//show!! if(enableSysTray) sysTrayIcon->showMessage(tr("gat2"),tr("Welcome to gat2!"),QSystemTrayIcon::Information,1500); connect(w,SIGNAL(finishCountDown()),this,SLOT(userCall())); config_editor = new PreferenceDialog(); connect(config_editor,SIGNAL(chNotificationCheckBox(bool)),this,SLOT(changeNotificationCheckBox(bool))); about_widget = new gat_about_widget(); a_about = new QAction(tr("&About"),this); a_about->setIcon(QIcon(":/photos/resource/p_icon_mini2.png")); connect(a_about,SIGNAL(triggered()),this,SLOT(about())); a_config = new QAction(tr("&Preferences"),this); connect(a_config,SIGNAL(triggered()),this,SLOT(callConfigDialog())); a_close = new QAction(tr("&Close"),this); connect(a_close,SIGNAL(triggered()),this,SLOT(closeApplication())); vSwitch = new QAction(tr("gat2"),this); connect(vSwitch,SIGNAL(triggered()),this,SLOT(changeVisible())); showTime = new QAction(tr("-----"),this); connect(showTime,SIGNAL(triggered()),this,SLOT(timeMessage())); help_bar = menuBar()->addMenu(tr("&gat2")); help_bar->addAction(a_about); help_bar->addAction(a_close); config_app = menuBar()->addMenu(tr("&Options")); config_app->addAction(a_config); sTaryIcon_Menu = new QMenu(tr("ContextMenu")); sTaryIcon_Menu->addAction(showTime); sTaryIcon_Menu->addSeparator(); sTaryIcon_Menu->addAction(vSwitch); sTaryIcon_Menu->addAction(a_close); sysTrayIcon->setContextMenu(sTaryIcon_Menu); connect(this,SIGNAL(close_mainwid()),w,SLOT(delete_phonon_object())); setCentralWidget(w); setWindowTitle(tr("Gat2")); setWindowIcon(QIcon(":/photos/resource/p_icon.png")); };
/// /// Load the MIME types configuration from memory. /// returns -1 on error. /// int MIMEtypeXML::loadMemBuf(MemBuf & buffer) { XmlParser parser; if(parser.openMemBuf(buffer)) return -1; int ret = load_core(parser); parser.close(); return ret; }
/** * parse the special value "array". this method parses the complexer value "array" and returns it * @param p XmlParser holding the xml document * @return the parsed array as Value (not ValueArray!) */ Value XmlRpcParser::ParseArray(XmlParser& p) { ValueArray va; p.PassTag("data"); while(!p.End()) { Value v = Parse(p); va.Add(v); } return Value(va); }
bool mainwid::readFromFile(QString& path){ XmlParser xf; if(xf.open(config_file_path) == false){ return false; } xf.loadXmlData(); path = xf.getAlarmFile(); return true; }
/// /// Load the MIME types configuration file. /// Returns -1 on error. /// int MIMEtypeXML::load(const char * filename) { XmlParser parser; if(parser.open((char *)filename)) // but I promis I wont modify return -1; int ret = load_core(parser); parser.close(); return ret; }
bool Ignore(XmlParser& p, dword style) { if((XML_IGNORE_DECLS & style) && p.IsDecl() || (XML_IGNORE_PIS & style) && p.IsPI() || (XML_IGNORE_COMMENTS & style) && p.IsComment()) { p.Skip(); return true; } return false; }
//!====================================================================== //! @param sourcePath //! @param destinationPath //! @param patchPath //! //! @return 0 => OK //! int XmlParser::addUsbdmWizard(const char *sourcePath, const char *destinationPath, const char *patchPath) { int rc = 0; if (verbose) { cout << "Applying patches: " << patchPath <<"\n" " <= " << sourcePath << "\n" " => " << destinationPath << "\n"; } try { XMLPlatformUtils::Initialize(); } catch (const XMLException& toCatch) { char* message = XMLString::transcode(toCatch.getMessage()); cerr << "Error during XML Initialisation! :\n" << message << "\n"; XMLString::release(&message); return -1; } try { XmlParser parser; if (verbose) cerr << "Opening source: '" << sourcePath << "'" << endl; parser.openSourcefile(sourcePath); if (verbose) cerr << "Opening patch: '" << patchPath << "'" << endl; parser.openPatchfile(patchPath); if (verbose) cerr << "Parsing XML file\n"; parser.mergePatchfile(); if (verbose) cerr << "Saving result: '" << destinationPath << "'" << endl; parser.commit(destinationPath); } catch (runtime_error *ex) { cerr << "Exception while parsing, reason: " << ex->what() << endl; rc = -1; } try { xercesc::XMLPlatformUtils::Terminate(); } catch( xercesc::XMLException& e ){ cerr<< " in catch()\n"; char* message = xercesc::XMLString::transcode( e.getMessage() ) ; cerr << "XML toolkit tear-down error: " << message << endl; XMLString::release( &message ) ; rc = -1; } if (rc == 0) cout << "OK\n"; return rc; }
/*! * pathでaudio fileへのPATHを受け取ってファイルに書き出す */ bool configDialog::writeToFile(const QString &path){ XmlParser xf; if(xf.open(config_file_path) == false){ std::cout<<"Failed to save xml"<<std::endl; return false; } xf.loadXmlData(); xf.setAlarmFile(path); xf.save(); return true; };
void ConfigurationRemoteXmlParser::Parse() { XmlParser parser; if (parser.Load(m_file) == false) { g_log.Log(L"ConfigurationXmlParser::Parse. Could not open / error parsing '%s'", (wchar_t *) m_file.c_str()); return; } m_configurationBlock = ConfigurationBlockNone; parser.Parse(_readNodeCallback, this); }
void Map::loadSceneTerrainFrom(const std::shared_ptr<XmlChunk> &chunk, const XmlParser &xmlParser) { std::shared_ptr<XmlChunk> terrainsListChunk = xmlParser.getUniqueChunk(true, TERRAINS_TAG, XmlAttribute(), chunk); std::vector<std::shared_ptr<XmlChunk>> terrainsChunk = xmlParser.getChunks(TERRAIN_TAG, XmlAttribute(), terrainsListChunk); for (const auto &terrainChunk : terrainsChunk) { auto *sceneTerrain = new SceneTerrain(); sceneTerrain->loadFrom(terrainChunk, xmlParser); addSceneTerrain(sceneTerrain); } }
void Map::loadSceneWaterFrom(const std::shared_ptr<XmlChunk> &chunk, const XmlParser &xmlParser) { std::shared_ptr<XmlChunk> watersListChunk = xmlParser.getUniqueChunk(true, WATERS_TAG, XmlAttribute(), chunk); std::vector<std::shared_ptr<XmlChunk>> watersChunk = xmlParser.getChunks(WATER_TAG, XmlAttribute(), watersListChunk); for (const auto &waterChunk : watersChunk) { auto *sceneWater = new SceneWater(); sceneWater->loadFrom(waterChunk, xmlParser); addSceneWater(sceneWater); } }
void Map::loadSceneSoundsFrom(const std::shared_ptr<XmlChunk> &chunk, const XmlParser &xmlParser) { std::shared_ptr<XmlChunk> soundElementsListChunk = xmlParser.getUniqueChunk(true, SOUND_ELEMENTS_TAG, XmlAttribute(), chunk); std::vector<std::shared_ptr<XmlChunk>> soundElementsChunk = xmlParser.getChunks(SOUND_ELEMENT_TAG, XmlAttribute(), soundElementsListChunk); for (const auto &soundElementChunk : soundElementsChunk) { auto *sceneSound = new SceneSound(); sceneSound->loadFrom(soundElementChunk, xmlParser); addSceneSound(sceneSound); } }
void Map::loadSceneObjectsFrom(const std::shared_ptr<XmlChunk> &chunk, const XmlParser &xmlParser) { std::shared_ptr<XmlChunk> objectsListChunk = xmlParser.getUniqueChunk(true, OBJECTS_TAG, XmlAttribute(), chunk); std::vector<std::shared_ptr<XmlChunk>> objectsChunk = xmlParser.getChunks(OBJECT_TAG, XmlAttribute(), objectsListChunk); for (const auto &objectChunk : objectsChunk) { auto *sceneObject = new SceneObject(); sceneObject->loadFrom(objectChunk, xmlParser); addSceneObject(sceneObject); } }
void Map::loadSceneLightsFrom(const std::shared_ptr<XmlChunk> &chunk, const XmlParser &xmlParser) { std::shared_ptr<XmlChunk> lightsListChunk = xmlParser.getUniqueChunk(true, LIGHTS_TAG, XmlAttribute(), chunk); std::vector<std::shared_ptr<XmlChunk>> lightsChunk = xmlParser.getChunks(LIGHT_TAG, XmlAttribute(), lightsListChunk); for (const auto &lightChunk : lightsChunk) { auto *sceneLight = new SceneLight(); sceneLight->loadFrom(lightChunk, xmlParser); addSceneLight(sceneLight); } }
void RigidBodyReaderWriter::loadBodyPropertiesOn(RigidBody *rigidBody, const std::shared_ptr<XmlChunk> &physicsChunk, const XmlParser &xmlParser) const { std::shared_ptr<XmlChunk> massChunk = xmlParser.getUniqueChunk(true, MASS_TAG, XmlAttribute(), physicsChunk); float bodyMass = massChunk->getFloatValue(); rigidBody->setMass(bodyMass); std::shared_ptr<XmlChunk> restitutionChunk = xmlParser.getUniqueChunk(true, RESTITUTION_TAG, XmlAttribute(), physicsChunk); rigidBody->setRestitution(restitutionChunk->getFloatValue()); std::shared_ptr<XmlChunk> frictionChunk = xmlParser.getUniqueChunk(true, FRICTION_TAG, XmlAttribute(), physicsChunk); rigidBody->setFriction(frictionChunk->getFloatValue()); std::shared_ptr<XmlChunk> rollingFrictionChunk = xmlParser.getUniqueChunk(true, ROLLING_FRICTION_TAG, XmlAttribute(), physicsChunk); rigidBody->setRollingFriction(rollingFrictionChunk->getFloatValue()); std::shared_ptr<XmlChunk> linearDampingChunk = xmlParser.getUniqueChunk(true, LINEAR_DAMPING_TAG, XmlAttribute(), physicsChunk); std::shared_ptr<XmlChunk> angularDampingChunk = xmlParser.getUniqueChunk(true, ANGULAR_DAMPING_TAG, XmlAttribute(), physicsChunk); rigidBody->setDamping(linearDampingChunk->getFloatValue(), angularDampingChunk->getFloatValue()); std::shared_ptr<XmlChunk> linearFactorChunk = xmlParser.getUniqueChunk(true, LINEAR_FACTOR_TAG, XmlAttribute(), physicsChunk); rigidBody->setLinearFactor(linearFactorChunk->getVector3Value()); std::shared_ptr<XmlChunk> angularFactorChunk = xmlParser.getUniqueChunk(true, ANGULAR_FACTOR_TAG, XmlAttribute(), physicsChunk); rigidBody->setAngularFactor(angularFactorChunk->getVector3Value()); }