1 // Copyright (C) 2009-2013 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.
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 "Hex_defines.hxx"
26 #include "hexa_base.hxx"
32 enum EnumItem { M_NONE, M_BEGIN, M_END, M_BEGIN_CLOSE, M_CLOSE,
33 M_IDENT, M_EQUALS, M_STRING,
34 M_COMMENT, M_END_COMMENT, M_PROLOG, M_END_PROLOG,
36 class HEXABLOCKENGINE_EXPORT XmlTree
39 XmlTree (const string& name, XmlTree* dad=NULL);
42 int parseFile (const string& name);
43 int parseStream (cpchar flux, int& posit);
45 cpchar getName () { return item_name.c_str() ; }
46 int getNbrAttributs () { return nbr_attributs ; }
47 int getNbrChildren () { return nbr_items ; }
49 int findAttribute (const string& nom);
50 const string& findValue (const string& nom);
51 int findInteger (const string& nom);
53 cpchar getAttribute (int nro) { return tab_attributs [nro].c_str(); }
54 cpchar getValue (int nro) { return tab_values [nro].c_str(); }
56 XmlTree* findChild (const string& nom);
57 XmlTree* getChild (int nro) { return tab_items [nro]; }
58 XmlTree* getParent () { return xml_parent; }
60 // ------------------------- Modifications
62 XmlTree* addChild (const string& nom);
63 void addAttribut (const string& nom, const string& valeur);
64 void setName (const string& nom) { item_name = nom; }
65 void dump (int niveau=0);
67 int goTo (cpchar ouca);
72 EnumItem readItem (string& item);
73 EnumItem getItem (string& item, EnumItem waited=M_NONE);
74 int getString (string& item);
75 int getIdent (string& item);
77 void putError (cpchar why);
86 vector <string> tab_attributs;
87 vector <string> tab_values;
88 vector <XmlTree*> tab_items;