// C++ : ParserXml
-// Copyright (C) 2009-2015 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2022 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
enum { HEND_FILE = -2, HEND_LINE = -1, CRLF = 13 };
// ====================================================== Constructeur
-XmlTree::XmlTree (const string& nom, XmlTree* dad)
+XmlTree::XmlTree (const std::string& nom, XmlTree* dad)
{
item_name = nom;
item_vide = "";
{
}
// ====================================================== findChild
-XmlTree* XmlTree::findChild (const string& nom)
+XmlTree* XmlTree::findChild (const std::string& nom)
{
for (int nro = 0 ; nro<nbr_items ; nro++)
{
return NULL;
}
// ====================================================== findAttribute
-int XmlTree::findAttribute (const string& nom)
+int XmlTree::findAttribute (const std::string& nom)
{
for (int nro = 0 ; nro<nbr_attributs ; nro++)
{
return NOTHING;
}
// ====================================================== findValue
-const string& XmlTree::findValue (const string& nom)
+const std::string& XmlTree::findValue (const std::string& nom)
{
for (int nro = 0 ; nro<nbr_attributs ; nro++)
{
return item_vide;
}
// ====================================================== findInteger
-int XmlTree::findInteger (const string& nom)
+int XmlTree::findInteger (const std::string& nom)
{
int val = 0;
- const string chnum = findValue (nom);
+ const std::string chnum = findValue (nom);
if (chnum==item_vide)
return val;
return val;
}
// ====================================================== parseFile
-int XmlTree::parseFile (const string& ficnom)
+int XmlTree::parseFile (const std::string& ficnom)
{
fic_buffer = "";
len_buffer = 0;
xml_file = fopen (ficnom.c_str(), "r");
if (xml_file==NULL)
{
- cout << " **** Fichier XML '" << ficnom << "' inaccessible"
- << endl;
+ std::cout << " **** Fichier XML '" << ficnom << "' inaccessible"
+ << std::endl;
return HERR;
}
XmlTree* node = this;
EnumItem item_lu;
- string nom, valeur, foo;
+ std::string nom, valeur, foo;
while ((item_lu=readItem (nom)) != M_NONE)
{
switch (item_lu)
return HOK;
}
// ====================================================== getItem
-EnumItem XmlTree::getItem (string& value, EnumItem waited)
+EnumItem XmlTree::getItem (std::string& value, EnumItem waited)
{
EnumItem item = readItem (value);
return item;
}
// ====================================================== readItem
-EnumItem XmlTree::readItem (string& value)
+EnumItem XmlTree::readItem (std::string& value)
{
value = "";
}
}
// ====================================================== getIdent
-int XmlTree::getIdent (string& ident)
+int XmlTree::getIdent (std::string& ident)
{
ident = "";
return HERR;
}
// ====================================================== getString
-int XmlTree::getString (string& chaine)
+int XmlTree::getString (std::string& chaine)
{
chaine = "";
int car = ' ';
// exit (102);
}
// ====================================================== addChild
-XmlTree* XmlTree::addChild (const string& nom)
+XmlTree* XmlTree::addChild (const std::string& nom)
{
XmlTree* child = new XmlTree (nom, this);
tab_items.push_back (child);
return child;
}
// ====================================================== addAttribut
-void XmlTree::addAttribut (const string& nom, const string& value)
+void XmlTree::addAttribut (const std::string& nom, const std::string& value)
{
tab_attributs.push_back (nom);
tab_values .push_back (value);
// ====================================================== dump
void XmlTree::dump (int niveau)
{
- string marge = "";
+ std::string marge = "";
for (int niv=0 ; niv<niveau ; niv++)
marge += " | ";
- cout << marge << item_name << endl;
+ std::cout << marge << item_name << std::endl;
for (int nc=0 ; nc<nbr_attributs ; nc++)
{
- cout << marge << " : "
+ std::cout << marge << " : "
<< tab_attributs [nc] << " = '" << tab_values [nc]
- << "'" << endl;
+ << "'" << std::endl;
}
for (int nc=0 ; nc<nbr_items ; nc++)