1 // Copyright (C) 2009-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // Class : Ecriture d'un fichier XML
25 #include "hexa_base.hxx"
31 enum EnumItem { M_NONE, M_BEGIN, M_END, M_BEGIN_CLOSE, M_CLOSE,
32 M_IDENT, M_EQUALS, M_STRING,
33 M_COMMENT, M_END_COMMENT, M_PROLOG, M_END_PROLOG,
35 class HexaExport XmlTree
38 XmlTree (const string& name, XmlTree* dad=NULL);
41 int parseFile (const string& name);
42 int parseStream (cpchar flux, int& posit);
44 cpchar getName () { return item_name.c_str() ; }
45 int getNbrAttributs () { return nbr_attributs ; }
46 int getNbrChildren () { return nbr_items ; }
48 int findAttribute (const string& nom);
49 const string& findValue (const string& nom);
50 int findInteger (const string& nom);
52 cpchar getAttribute (int nro) { return tab_attributs [nro].c_str(); }
53 cpchar getValue (int nro) { return tab_values [nro].c_str(); }
55 XmlTree* findChild (const string& nom);
56 XmlTree* getChild (int nro) { return tab_items [nro]; }
57 XmlTree* getParent () { return xml_parent; }
59 // ------------------------- Modifications
61 XmlTree* addChild (const string& nom);
62 void addAttribut (const string& nom, const string& valeur);
63 void setName (const string& nom) { item_name = nom; }
64 void dump (int niveau=0);
66 int goTo (cpchar ouca);
71 EnumItem readItem (string& item);
72 EnumItem getItem (string& item, EnumItem waited=M_NONE);
73 int getString (string& item);
74 int getIdent (string& item);
76 void putError (cpchar why);
85 vector <string> tab_attributs;
86 vector <string> tab_values;
87 vector <XmlTree*> tab_items;