1 // Copyright (C) 2006-2021 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 #ifndef _TYPEPARSERS_HXX_
21 #define _TYPEPARSERS_HXX_
23 #include "parserBase.hxx"
24 #include "TypeCode.hxx"
25 #include "factory.hxx"
30 /*! \brief Class for type parser.
32 * Class used to parse a type definition (class TypeCode in implementation)
33 * with a name and a kind (reserved to atomic types)
37 <xsd:complexType name="TypeType">
38 <xsd:attribute name="name" type="xsd:string" use="required"/>
39 <xsd:attribute name="kind" type="xsd:string" use="required"/>
43 struct typetypeParser: parser
45 static typetypeParser typeParser;
46 virtual void buildAttr(const XML_Char** attr);
48 virtual void name(const std::string& name);
49 virtual void kind(const std::string& name);
50 virtual mytype post();
55 /*! \brief Class for sequence parser.
57 * Class used to parse a sequence (type) definition (class TypeCodeSeq in implementation)
62 <xsd:complexType name="SequenceType">
63 <xsd:attribute name="name" type="xsd:string" use="required"/>
64 <xsd:attribute name="content" type="xsd:string" use="required"/>
69 struct seqtypeParser:public parser
71 static seqtypeParser seqParser;
72 virtual void onStart(const XML_Char* el, const XML_Char** attr);
73 virtual void onEnd(const char *el,parser* child);
74 virtual void buildAttr(const XML_Char** attr);
75 void name(const std::string& name);
76 void content(const std::string& name);
77 YACS::ENGINE::TypeCode* post();
78 YACS::ENGINE::TypeCode* _contentType;
82 /*! \brief Class for objref parser.
84 * Class used to parse a objref (type) definition (class TypeCodeObjref in implementation)
88 <xsd:complexType name="ObjrefType">
90 <xsd:element name="base" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
92 <xsd:attribute name="name" type="xsd:string" use="required"/>
93 <xsd:attribute name="id" type="xsd:string" />
98 struct objtypeParser: parser
100 static objtypeParser objParser;
101 virtual void onStart(const XML_Char* el, const XML_Char** attr);
102 virtual void onEnd(const char *el,parser* child);
103 virtual void buildAttr(const XML_Char** attr);
105 virtual void name(const std::string& name);
106 virtual void id(const std::string& name);
107 virtual void base(const std::string& name);
108 virtual YACS::ENGINE::TypeCode * post();
111 std::list<YACS::ENGINE::TypeCodeObjref *> _ltc;
114 /*! \brief Class for member parser.
116 * Class used to parse a struct member
117 * A struct member is a pair of name(string), type(string)
121 <xsd:complexType name="MemberType">
122 <xsd:attribute name="name" type="xsd:string" use="required"/>
123 <xsd:attribute name="type" type="xsd:string" use="required"/>
128 struct membertypeParser: parser
130 static membertypeParser memberParser;
131 virtual void buildAttr(const XML_Char** attr);
132 virtual void name(const std::string& name);
133 virtual void type(const std::string& name);
138 /*! \brief Class for struct parser.
140 * Class used to parse a struct (type) definition (class TypeCodeStruct in implementation)
144 <xsd:complexType name="StructType">
146 <xsd:element name="member" type="MemberType" minOccurs="0" maxOccurs="unbounded"/>
148 <xsd:attribute name="name" type="xsd:string" use="required"/>
149 <xsd:attribute name="id" type="xsd:string" />
154 struct structtypeParser: parser
156 static structtypeParser structParser;
158 virtual void onStart(const XML_Char* el, const XML_Char** attr);
159 virtual void onEnd(const char *el,parser* child);
160 virtual void buildAttr(const XML_Char** attr);
162 virtual void name(const std::string& name);
163 virtual void id(const std::string& name);
164 virtual void member (const myprop& prop);
165 virtual YACS::ENGINE::TypeCode * post();
168 std::vector<myprop> _members;