2 #ifndef _CODEPARSERS_HXX_
3 #define _CODEPARSERS_HXX_
5 #include "parserBase.hxx"
6 #include "dataParsers.hxx"
13 /*! \brief Class for code parser in inline nodes.
16 struct codetypeParser: parser
18 static codetypeParser codeParser;
19 virtual void onStart(const XML_Char* el, const XML_Char** attr)
21 std::string element(el);
22 parser* pp=&parser::main_parser;
23 if(element == "code")pp=&stringtypeParser::stringParser;
24 this->SetUserDataAndPush(pp);
29 virtual void onEnd(const char *el,parser* child)
31 std::string element(el);
32 if(element == "code")code(((stringtypeParser*)child)->post());
34 virtual void pre (){_code="";}
35 virtual void code (const std::string& s)
40 _code=_code + '\n' + s;
42 virtual myfunc post ()
52 /*! \brief Class for function parser in inline nodes.
55 struct functypeParser: codetypeParser
57 static functypeParser funcParser;
58 virtual void buildAttr(const XML_Char** attr)
60 required("name",attr);
61 for (int i = 0; attr[i]; i += 2)
63 if(std::string(attr[i]) == "name")name(attr[i+1]);
66 virtual void name (const std::string& name)
70 virtual myfunc post ()