-// Copyright (C) 2009-2012 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
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
BEGIN_NAMESPACE_HEXA
-class XmlWriter
+class HexaExport XmlWriter
{
public :
XmlWriter ();
~XmlWriter () { closeXml () ; }
- int openXml (string& nom) { return openXml (nom.c_str()); }
- int openXml (cpchar nom=NULL);
+ int setFileName (cpchar filename); // Un seul xml par fichier
+ int setFile (pfile afile); // Plusieurs xml par fichier
+ int setStream (); // Sauvegarde par flux
+ int startXml ();
void closeXml ();
cpchar getXml () { return xml_buffer.c_str(); }
void addAttribute (cpchar attrib, cpchar valeur); // attrib="valeur"
void addAttribute (cpchar attrib, int valeur);
void addAttribute (cpchar attrib, double valeur);
- void addAttribute (cpchar attrib, string& valeur);
+ void addAttribute (cpchar attrib, std::string& valeur);
private :
void jumpLine ();
void alaLigne (bool force=false);
void ecrire (cpchar mot);
- void ecrire (string& mot) { ecrire (mot.c_str()) ; }
+ void ecrire (std::string& mot) { ecrire (mot.c_str()) ; }
void addMot (cpchar mot);
private :
+ enum {InaFile, InaStudy, InaStream} xml_mode;
enum {xml_decal=3, xml_size=80};
+
pfile xml_file;
int xml_level;
int xml_pos;
addAttribute (attrib, buffer);
}
// ====================================================== addAttribute (stl)
-inline void XmlWriter::addAttribute (cpchar attrib, string& valeur)
+inline void XmlWriter::addAttribute (cpchar attrib, std::string& valeur)
{
addAttribute (attrib, valeur.c_str());
}