2 // Class : Ecriture d'un fichier XML
7 #include "hexa_base.hxx"
17 ~XmlWriter () { closeXml () ; }
19 int openXml (string& nom) { return openXml (nom.c_str()); }
20 int openXml (cpchar nom);
23 void openMark (cpchar balise); // <Balise ..
24 void addMark (cpchar balise, bool jump=true); // <Balise> + eol
25 void closeMark (bool jump=false); // </Balise> ou />
28 void addAttribute (cpchar attrib, cpchar valeur); // attrib="valeur"
29 void addAttribute (cpchar attrib, int valeur);
30 void addAttribute (cpchar attrib, double valeur);
31 void addAttribute (cpchar attrib, string& valeur);
35 void alaLigne (bool force=false);
36 void ecrire (cpchar mot);
37 void ecrire (string& mot) { ecrire (mot.c_str()) ; }
40 enum {xml_decal=3, xml_size=80};
44 std::stack <std::string, std::vector <std::string> > pile_mark;
45 std::stack <int, std::vector <int> > pile_etat;
47 // ====================================================== addAttribute (I)
48 inline void XmlWriter::addAttribute (cpchar attrib, int valeur)
51 sprintf (buffer, "%d", valeur);
52 addAttribute (attrib, buffer);
54 // ====================================================== addAttribute (R)
55 inline void XmlWriter::addAttribute (cpchar attrib, double valeur)
58 sprintf (buffer, "%g", valeur);
59 addAttribute (attrib, buffer);
61 // ====================================================== addAttribute (stl)
62 inline void XmlWriter::addAttribute (cpchar attrib, string& valeur)
64 addAttribute (attrib, valeur.c_str());