1 // Copyright (C) 2006-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 #ifndef _CODEPARSERS_HXX_
21 #define _CODEPARSERS_HXX_
23 #include "parserBase.hxx"
24 #include "dataParsers.hxx"
26 #include "factory.hxx"
31 /*! \brief Class for code parser in inline nodes.
34 struct codetypeParser: parser
36 static codetypeParser codeParser;
37 virtual void onStart(const XML_Char* el, const XML_Char** attr)
39 std::string element(el);
40 parser* pp=&parser::main_parser;
41 if(element == "code")pp=&stringtypeParser::stringParser;
42 this->SetUserDataAndPush(pp);
47 virtual void onEnd(const char *el,parser* child)
49 std::string element(el);
50 if(element == "code")code(((stringtypeParser*)child)->post());
52 virtual void pre (){_code="";}
53 virtual void code (const std::string& s)
58 _code=_code + '\n' + s;
60 virtual myfunc post ()
70 /*! \brief Class for function parser in inline nodes.
73 struct functypeParser: codetypeParser
75 static functypeParser funcParser;
76 virtual void buildAttr(const XML_Char** attr)
80 required("name",attr);
81 for (int i = 0; attr[i]; i += 2)
83 if(std::string(attr[i]) == "name")name(attr[i+1]);
86 virtual void name (const std::string& name)
90 virtual myfunc post ()