本文整理汇总了C++中XmlParser类的典型用法代码示例。如果您正苦于以下问题:C++ XmlParser类的具体用法?C++ XmlParser怎么用?C++ XmlParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XmlParser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: passStandardCuts
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;
}
开发者ID:sakamoto-poteko,项目名称:Chewie,代码行数:28,代码来源:Resolution.cpp
示例2: _readLanguage
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));
}
开发者ID:NoAntzWk,项目名称:CatalanitzadorPerAWindows,代码行数:29,代码来源:LibreOfficeInspector.cpp
示例3: ParseXmlRpcParam
Value ParseXmlRpcParam(XmlParser& p)
{
p.PassTag("param");
Value v = ParseXmlRpcValue(p);
p.PassEnd();
return v;
}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:7,代码来源:Xml.cpp
示例4: main
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);
}
开发者ID:Sun42,项目名称:zia,代码行数:31,代码来源:main.cpp
示例5: main
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;
}
开发者ID:sitev,项目名称:cjCore,代码行数:35,代码来源:testXmlParser.cpp
示例6: root
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;
}
开发者ID:DelamarreAlban,项目名称:Mascaret,代码行数:27,代码来源:InstanceLoader.cpp
示例7: GetBundleFileHandleForReading
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;
}
}
开发者ID:,项目名称:,代码行数:27,代码来源:
示例8: XmlParser
AssetManagerGlue::XmlParser*
AssetManagerGlue::XmlBlock::nativeCreateParseState()
{
XmlParser* parser = new XmlParser(*this);
parser->restart();
return parser;
}
开发者ID:AliFarahnak,项目名称:XobotOS,代码行数:7,代码来源:AssetManagerGlue.cpp
示例9: save
///
/// 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;
}
开发者ID:rupinder,项目名称:GNU-MyServer-GSoC,代码行数:12,代码来源:mimetype.cpp
示例10: saveMemBuf
///
/// 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;
}
开发者ID:rupinder,项目名称:GNU-MyServer-GSoC,代码行数:12,代码来源:mimetype.cpp
示例11: LoadFromFile
bool CTextNode::LoadFromFile(IFile* file)
{
XmlParser parser;
m_xmlNode = parser.parse(file);
m_constXmlNode = m_xmlNode;
RebuildChildrenList();
return (m_xmlNode != NULL);
}
开发者ID:pjkui,项目名称:behaviac,代码行数:8,代码来源:textnode.cpp
示例12: ParseXmlRpcParams
ValueArray ParseXmlRpcParams(XmlParser& p)
{
ValueArray va;
if(p.Tag("params"))
while(!p.End())
va.Add(ParseXmlRpcParam(p));
return va;
}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:8,代码来源:Xml.cpp
示例13: Initialize
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");
}
开发者ID:rkolev,项目名称:diplomna-igra,代码行数:9,代码来源:NPC.cpp
示例14: CentralWidget
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"));
};
开发者ID:opamp,项目名称:gat2,代码行数:57,代码来源:MainWindow.cpp
示例15: loadMemBuf
///
/// 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;
}
开发者ID:rupinder,项目名称:GNU-MyServer-GSoC,代码行数:13,代码来源:mimetype.cpp
示例16: ParseArray
/**
* 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);
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:14,代码来源:XmlRpcParser.cpp
示例17: readFromFile
bool mainwid::readFromFile(QString& path){
XmlParser xf;
if(xf.open(config_file_path) == false){
return false;
}
xf.loadXmlData();
path = xf.getAlarmFile();
return true;
}
开发者ID:fosskers,项目名称:gat2,代码行数:9,代码来源:mainwid.cpp
示例18: load
///
/// 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;
}
开发者ID:rupinder,项目名称:GNU-MyServer-GSoC,代码行数:13,代码来源:mimetype.cpp
示例19: Ignore
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;
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:10,代码来源:XML.cpp
示例20: catch
//!======================================================================
//! @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;
}
开发者ID:CoffeeHacker,项目名称:usbdm-eclipse-makefiles-build,代码行数:62,代码来源:xmlParser.cpp
注:本文中的XmlParser类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论