From e3c0b9d5bbec3f4a2ca931a3dccc2db6ca636857 Mon Sep 17 00:00:00 2001 From: aebersol Date: Wed, 29 Mar 2023 22:27:56 +0200 Subject: [PATCH] Almost there to try first parsing --- .gitignore | 3 + CMakeLists.txt | 13 +- reqif.cpp | 47 +++++ src/xml/element_factory.cpp | 4 +- src/xml/reqif/CMakeLists.txt | 3 +- src/xml/reqif/document.cpp | 180 +++++++++++++++++++ src/xml/reqif/document.h | 111 ++++++++++++ src/xml/reqif/parser_base.h | 27 +-- src/xml/reqif/parsers.h.inc | 2 - src/xml/reqif/reqif_element.h | 4 +- src/xml/reqif/reqif_elements_parser.cpp | 53 +++--- src/xml/reqif/reqif_elements_parser.h | 43 ++--- src/xml/reqif/reqif_elements_parser_root.cpp | 10 +- 13 files changed, 429 insertions(+), 71 deletions(-) create mode 100644 .gitignore create mode 100644 reqif.cpp create mode 100644 src/xml/reqif/document.cpp create mode 100644 src/xml/reqif/document.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9dce1e3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ + +Build +*~ diff --git a/CMakeLists.txt b/CMakeLists.txt index c99a8c3..5b68e6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,11 +37,22 @@ INCLUDE_DIRECTORIES("${antcc_BINARY_DIR}/src") - +# +# Antcc main entry +# ADD_EXECUTABLE(antcc main.cpp) TARGET_LINK_LIBRARIES(antcc libantcc_parser libantcc_os libantcc propertylib ${EXPAT_LIBRARY} ltdl) +# +# ReqIf main entry +# +ADD_EXECUTABLE(reqif reqif.cpp) + +TARGET_LINK_LIBRARIES(reqif reqif_parser libantcc_os libantcc propertylib ${EXPAT_LIBRARY} ltdl) +# +# +# OPTION(ANTCC_WITH_BOOST "Build antcc with boost dependency" OFF) OPTION(ANTCC_WITH_AEB "Build antcc with aeb shared pointer" ON) diff --git a/reqif.cpp b/reqif.cpp new file mode 100644 index 0000000..c2ed284 --- /dev/null +++ b/reqif.cpp @@ -0,0 +1,47 @@ +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "xml/reqif/parser_base.h" +#include "xml/reqif/reqif_elements_parser.h" +#include "xml/reqif/document.h" + +#include +#include "xml/reqif/reqif_element.h" +#include "xml/element_factory.h" +//#include +//#include +//#include +//#include + +#include + +//#include + +void parse(const std::string &file) +{ + std::cout<<"Build Parser"< #include #include -#include -#include +#include "xml/element_factory.h" +#include "xml/reqif/reqif_element.h" namespace reqif { diff --git a/src/xml/reqif/CMakeLists.txt b/src/xml/reqif/CMakeLists.txt index 24a42d8..85c3f6e 100644 --- a/src/xml/reqif/CMakeLists.txt +++ b/src/xml/reqif/CMakeLists.txt @@ -16,7 +16,8 @@ ENDIF(NOT WIN32) INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIR}) ADD_LIBRARY(reqif_parser STATIC - #document.cpp + document.cpp + ../element_factory.cpp # ant_elements_parser.cpp # ant_elements_parser_root.cpp reqif_elements_parser.cpp diff --git a/src/xml/reqif/document.cpp b/src/xml/reqif/document.cpp new file mode 100644 index 0000000..7b3d89e --- /dev/null +++ b/src/xml/reqif/document.cpp @@ -0,0 +1,180 @@ +#include +#include +#include + +#include "antcc/config.h" +#include "logger.h" +#include "location.h" +#include "xml/reqif/reqif_element.h" +#include "xml/reqif/parser_base.h" +#include "xml/reqif/document.h" + +namespace xml +{ + namespace reqif + { + + + /** + * Funny fact to parse a xml entity.... + */ + bool Document::parse(std::istream &is) + { + char buf[16384]; + parser_auto_ptr parser = XML_ParserCreateNS(0,XML_Char(' ')); + m_parser = parser; + parser_init(); + do + { + is.read(buf,sizeof(buf)); + if (is.bad() || (is.fail() && !is.eof())) + { + break; /* End of parsing */ + } + if (XML_Parse ( m_parser,buf,is.gcount(),is.eof()) == XML_STATUS_ERROR) + { + break; + } + } while (! is.eof()); + parser_clear(); + return true; + } + + void Document::parser_init() + { + XML_SetUserData(m_parser,this); + XML_SetStartElementHandler(m_parser,startElement_glb); + XML_SetEndElementHandler(m_parser,endElement_glb); + XML_SetCharacterDataHandler(m_parser,characters_glb); + /** + * XML_SetNamespaveDecHandler(m_parser,start,end); + */ + XML_SetNamespaceDeclHandler(m_parser,startNamespace_glb,endNamespace_glb); + } + + void Document::parser_clear() + { + XML_SetUserData(m_parser,0); + XML_SetStartElementHandler(m_parser,0); + XML_SetEndElementHandler(m_parser,0); + XML_SetNamespaceDeclHandler(m_parser,0,0); + } + + void Document::startElement_glb(void *d,const XML_Char *ns, const XML_Char **attr) + { + Document &doc = (*reinterpret_cast(d)); + doc.startElement(ns,attr); + } + + void Document::endElement_glb(void *d,const XML_Char *ns) + { + Document &doc = (*reinterpret_cast(d)); + doc.endElement(ns); + } + + void Document::characters_glb(void *d,const XML_Char *ns,int ds) + { + Document &doc = (*reinterpret_cast(d)); + doc.Characters(ns,ds); + } + + void Document::split_name(const XML_Char *s,const char *&ns,size_t &ns_s, + const char *&name,size_t &name_s) + { + const char *p = std::strchr(s,' '); + ns=s; + if (p) + { + ns_s=p-s; + name=p+1; + } else + { + ns_s =0; + name=s; + } + name_s = strlen(name); + + } + /** + * Well first see how it works. Right now, I do not really now + * But it's important for soap. + * + */ + void Document::startNamespace_glb(void *d,const XML_Char *prefix, const XML_Char *uri) + { + Document &doc = (*reinterpret_cast(d)); + } + void Document::endNamespace_glb(void *d,const XML_Char *prefix) + { + Document &doc = (*reinterpret_cast(d)); + } + + /* Ok, call the parser objects with the given events ... */ + void Document::startElement(const XML_Char *name,const XML_Char **attr) + { + const char *ns; + const char *nm; + size_t ns_s,nm_s; + + split_name(name,ns,ns_s,nm,nm_s); + updateLocation(); + if (m_depth++ > 0 ) + { + /* under root */ + m_root_parser._startElement(std::string(ns,ns_s),std::string(nm,nm_s),std::string("")); + ANTCC_PARSER_DEBUG("**** Document after having called _startElement %s *****",name); + m_root_parser.updateLocation(m_location); + } else + { + ANTCC_PARSER_DEBUG("**** Document root start %s*****",name); + /* root element */ + std::string n(nm,nm_s); + if (n == m_name) + { + /* Yes we are right */ + //std::cout<<" Yes, start root "< 0) + { + m_root_parser._endElement(std::string(ns,ns_s),std::string(nm,nm_s)); + } else + { + /* end root element */ + m_root_parser.postImpl(); + } + } + void Document::Characters(const XML_Char *name,size_t sz) + { + m_root_parser._Characters(std::string(name,sz)); + } + void Document::Attribute(const std::string &ns,const std::string &n,const std::string &val) + { + m_root_parser._Attribute(ns,n,val); + } + void Document::updateLocation() + { + m_location.m_Column = XML_GetCurrentColumnNumber(m_parser); + m_location.m_Line = XML_GetCurrentLineNumber(m_parser); + } + } /* end ns parser */ +} diff --git a/src/xml/reqif/document.h b/src/xml/reqif/document.h new file mode 100644 index 0000000..878ee2e --- /dev/null +++ b/src/xml/reqif/document.h @@ -0,0 +1,111 @@ +#ifndef REQIF_PARSER_DOC_H +#define REQIF_PARSER_DOC_H +#include + +namespace xml +{ + + namespace reqif + { + + /** + * + */ + class DocumentBase + { + public: + DocumentBase(xml::reqif::ParserBase &p,const char *root) : m_root_parser(p) ,m_depth(0) ,m_name(root) {}; + virtual ~DocumentBase() {}; + + virtual void startElement(std::string &ns,std::string &name,std::string tp){}; + protected: + ParserBase &m_root_parser; + std::size_t m_depth; + std::string m_name; /* Root name of the document */ + }; + + + struct parser_auto_ptr + { + ~parser_auto_ptr() + { + if (m_parser!= 0) + { + XML_ParserFree(m_parser); + } + }; + parser_auto_ptr(XML_Parser p = 0) :m_parser(p) {}; + + parser_auto_ptr& operator =(XML_Parser p) + { + if(m_parser != 0) XML_ParserFree(m_parser); + m_parser = p; + return *this; + } + public: + operator XML_Parser() + { + return m_parser; + }; + private: + XML_Parser m_parser; + }; + + + /** + * \brief First try to parse an xml document + * I do not yet have all the information. + * + * \author EBERSOLD Andre + * \date 11/09/09 + */ + class Document : public DocumentBase { + public: + /** + * \brief default constructor, see ParseBase + * \param root, is the root element we want to parse + * \param root_element_name is the name of the root element + */ + Document( ParserBase &root,const char *root_element_name) + : xml::reqif::DocumentBase(root,root_element_name),m_location(NULL,0,0) {}; + /* What do I realy need */ + ~Document() { }; + bool parse(std::string filename); + /** + * + */ + bool parse(std::istream &is); + private: + void split_name(const XML_Char *s,const char *&ns,size_t &ns_s, const char *&name,size_t &name_s); + /* For expact we need static functions .... */ + + static void XMLCALL startElement_glb(void *, const XML_Char *,const XML_Char **attr); + static void XMLCALL endElement_glb(void *,const XML_Char *name); + static void XMLCALL characters_glb(void *d,const XML_Char *ns,int dt); + + static void XMLCALL startNamespace_glb(void *, const XML_Char *prefix,const XML_Char *uri); + static void XMLCALL endNamespace_glb(void *, const XML_Char *prefix); + /* + * + */ + void parser_init(); + /** + * + * + */ + void parser_clear(); + + void startElement(const XML_Char *name,const XML_Char **attr); + void endElement(const XML_Char *name); + void Characters(const XML_Char *name,size_t sz); + void Attribute(const std::string &ns,const std::string &name,const std::string &val); + void updateLocation(); + protected: + XML_Parser m_parser; + antcc::Location m_location; + }; + + + } // End ns +} +#endif diff --git a/src/xml/reqif/parser_base.h b/src/xml/reqif/parser_base.h index b3042e7..b1accc5 100644 --- a/src/xml/reqif/parser_base.h +++ b/src/xml/reqif/parser_base.h @@ -1,10 +1,16 @@ -#ifndef ANTCC_PARSER_ELEMENTS_H -#define ANTCC_PARSER_ELEMENTS_H +#ifndef XML_REQIF_PARSER_ELEMENTS_H +#define XML_REQIF_PARSER_ELEMENTS_H #include + namespace reqif { struct Element; - namespace parser { +} +namespace xml { +namespace reqif +{ + + class Document; class ComplexElement; class SimpleElement; @@ -21,7 +27,7 @@ namespace reqif ParserBase() {}; virtual void pre() {}; - virtual Element *post() { return NULL; }; + virtual ::reqif::Element *post() { return NULL; }; virtual void preInternal() {}; virtual void postInternal() {}; @@ -52,17 +58,16 @@ namespace reqif virtual const std::string &dynamicType() {static std::string s="base";return s;}; virtual void updateLocation(const antcc::Location &l) {}; - friend class reqif::parser::Document; - friend class reqif::parser::ComplexElement; - friend class reqif::parser::RootElement; - friend class reqif::parser::SimpleElement; + friend class xml::reqif::Document; + friend class xml::reqif::ComplexElement; + friend class xml::reqif::RootElement; + friend class xml::reqif::SimpleElement; }; - } -} - +} // end ns reqid +} // end ns xml #endif diff --git a/src/xml/reqif/parsers.h.inc b/src/xml/reqif/parsers.h.inc index 1ca3cf7..edd6145 100644 --- a/src/xml/reqif/parsers.h.inc +++ b/src/xml/reqif/parsers.h.inc @@ -17,7 +17,6 @@ COMPLEX_PARSER(THE-HEADER,ReqifHeaderParser) //SIMPLE_PARSER(SOURCE-TOOL-ID,DescriptionParser) //SIMPLE_PARSER(TITLE,DescriptionParser) - COMPLEX_PARSER(CORE-CONTENT,CoreContentParser) COMPLEX_PARSER(REQ-IF-CONTENT,ReqifContentParser) COMPLEX_PARSER(DATATYPES,DatatypesParser) @@ -90,5 +89,4 @@ COMPLEX_PARSER(CHILDREN,ChildrenParser) //SIMPLE_PARSER(SPEC-OBJECT-REF,DatatypeRefParser) - //COMPLEX_PARSER(TOOL-EXTENSIONS,ChildrenParser) diff --git a/src/xml/reqif/reqif_element.h b/src/xml/reqif/reqif_element.h index 2be6821..d70438f 100644 --- a/src/xml/reqif/reqif_element.h +++ b/src/xml/reqif/reqif_element.h @@ -40,9 +40,9 @@ namespace reqif { inline const char *getName() const { return m_Name.c_str(); }; // what are the public methods available on all elements ? - virtual void addChild(const char *_name,reqif::Element *_task) {} ; + virtual void addChild(const char *_name,::reqif::Element *_task) {} ; /// - virtual void setProject(::antcc::project *_p) {}; + //virtual void setProject(::antcc::project *_p) {}; virtual void setLocation(const ::antcc::Location &_loc) {} ; /** diff --git a/src/xml/reqif/reqif_elements_parser.cpp b/src/xml/reqif/reqif_elements_parser.cpp index 12f1b0b..ea0d852 100644 --- a/src/xml/reqif/reqif_elements_parser.cpp +++ b/src/xml/reqif/reqif_elements_parser.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include "xml/reqif/parser_base.h" #include //#include @@ -14,12 +14,12 @@ //#define PARSER_DEBUG 1 -namespace reqif { - namespace parser { +namespace xml { + namespace reqif { -EmptyElement::EmptyElement(reqif::Element *_elt ) +EmptyElement::EmptyElement(::reqif::Element *_elt ) : m_str(""), m_CurrentElement(_elt) { ANTCC_PARSER_DEBUG("%s(%0x) ctor m_CurrentElement=%0x" @@ -73,7 +73,7 @@ SimpleElement::updateLocation(const antcc::Location &l) * Implement ComplexElement parsing function */ -ComplexElement::ComplexElement(reqif::Element *_elt ) +ComplexElement::ComplexElement(::reqif::Element *_elt ) : EmptyElement(_elt) { ANTCC_PARSER_DEBUG("Cplx(%0x)::Cplx ctor m_CurElt=%0x" @@ -82,7 +82,7 @@ ComplexElement::ComplexElement(reqif::Element *_elt ) } ComplexElement::ComplexElement(const ComplexElement &c) - : reqif::parser::EmptyElement(c.m_CurrentElement) + : xml::reqif::EmptyElement(c.m_CurrentElement) { ANTCC_PARSER_DEBUG("Cplx(%0x)::Cplx copy c.m_CurElt=%0x" ,this @@ -152,8 +152,9 @@ void ComplexElement::_startElement(const std::string &ns,const std::string &name } } } -} - +#if 1 +} // end ns bas +#endif void ComplexElement::_endElement(const std::string &ns,const std::string &name) { @@ -369,7 +370,7 @@ cls :: cls(const cls &_c) : RootElement(_c.m_CurrentElement) \ ,_c.m_CurrentElement \ ); \ } \ -cls::cls(antcc::project *_project,reqif::Element *_elt) \ +cls::cls(antcc::project *_project,::reqif::Element *_elt) \ : RootElement(_elt) , m_Project(_project) \ { \ ANTCC_PARSER_DEBUG("%s(%0x)::%s elt=%0x" \ @@ -387,7 +388,7 @@ cls::cls(antcc::project *_project,reqif::Element *_elt) \ ); \ } else \ { \ - _elt->setProject(_project);\ + /*_elt->setProject(_project);*/\ } \ } \ cls::~cls() \ @@ -454,7 +455,7 @@ cls :: cls(const cls &_c) : ComplexElement(_c.m_CurrentElement) \ ,_c.m_CurrentElement \ ); \ } \ -cls::cls(antcc::project *_project,reqif::Element *_elt) \ +cls::cls(antcc::project *_project,::reqif::Element *_elt) \ : ComplexElement(_elt) ,m_Project(_project) \ { \ ANTCC_PARSER_DEBUG("%s(%0x)::%s elt=%0x" \ @@ -472,7 +473,7 @@ cls::cls(antcc::project *_project,reqif::Element *_elt) \ ); \ } else \ { \ - _elt->setProject(_project);\ + /*_elt->setProject(_project); */ \ } \ } \ cls::~cls() \ @@ -530,7 +531,7 @@ void cls::postInternal() \ } \ #define SIMPLE_PARSER(cls,attr) \ -cls :: cls(const cls &_c) : SimpleElement() \ +cls :: cls(const cls &_c) : xml::reqif::SimpleElement() \ { \ ANTCC_PARSER_DEBUG("%s::%s cp elt=%0x" \ ,#cls \ @@ -538,7 +539,7 @@ cls :: cls(const cls &_c) : SimpleElement() \ ,_c.m_CurrentElement \ ); \ } \ -cls::cls(antcc::project *_project,reqif::Element *_elt) \ +cls::cls(antcc::project *_project,::reqif::Element *_elt) \ : SimpleElement(_elt), m_Project(_project) \ { \ ANTCC_PARSER_DEBUG("%s(%0x)::%s elt=%0x" \ @@ -556,7 +557,7 @@ cls::cls(antcc::project *_project,reqif::Element *_elt) \ ); \ } else \ { \ - _elt->setProject(_project);\ + /* _elt->setProject(_project);*/ \ } \ } \ cls::~cls() \ @@ -578,7 +579,7 @@ ROOT_PARSER(ReqifParser, if (name == "THE-HEADER" && ns.empty()) { s.m_parser = SHARED_PTR(new TargetParser(m_Project - , reqif::ElementFactory::get().orderElement(name.c_str()) + , ::reqif::ElementFactory::get().orderElement(name.c_str()) )); } else if (name == "TOOL-EXTENSION" && ns.empty()) { @@ -588,7 +589,7 @@ if (name == "THE-HEADER" && ns.empty()) } else if (name == "CORE-CONTENT" && ns.empty()) { s.m_parser = SHARED_PTR(new CoreContentParser(m_Project - , reqif::ElementFactory::get().orderElement(name.c_str()) + , ::reqif::ElementFactory::get().orderElement(name.c_str()) ) ); } else @@ -625,18 +626,18 @@ COMPLEX_PARSER(ReqifHeaderParser, if (name == "REQ-IF-HEADER" && ns.empty()) { s.m_parser = SHARED_PTR(new DescriptionParser(m_Project - , reqif::ElementFactory::get().orderElement(name.c_str()) + , ::reqif::ElementFactory::get().orderElement(name.c_str()) )); } else if (name == "exec" && ns.empty()) { s.m_parser = SHARED_PTR(new DescriptionParser(m_Project - , reqif::ElementFactory::get().orderElement(name.c_str()) + , ::reqif::ElementFactory::get().orderElement(name.c_str()) )); } else { s.m_parser = SHARED_PTR(new DescriptionParser(m_Project - , reqif::ElementFactory::get().orderElement(name.c_str()) + , ::reqif::ElementFactory::get().orderElement(name.c_str()) )); } return true; @@ -689,7 +690,7 @@ COMPLEX_PARSER(ReqifContentParser, ,name.c_str() ,m_context.size()); s.m_parser = SHARED_PTR(new DatatypesParser(m_Project - , reqif::ElementFactory::get().orderElement(name.c_str()) + , ::reqif::ElementFactory::get().orderElement(name.c_str()) )); } else if (name == "SPEC-TYPES" && ns.empty()) @@ -697,7 +698,7 @@ COMPLEX_PARSER(ReqifContentParser, } else { s.m_parser = SHARED_PTR(new TypeParser(m_Project - , reqif::ElementFactory::get().orderElement(name.c_str()) + , ::reqif::ElementFactory::get().orderElement(name.c_str()) )); } return true; @@ -722,7 +723,7 @@ COMPLEX_PARSER(ReqifContentParser, COMPLEX_PARSER(DatatypesParser, { s.m_parser = SHARED_PTR(new DatatypeParser(m_Project - , reqif::ElementFactory::get().orderElement(name.c_str()) + , ::reqif::ElementFactory::get().orderElement(name.c_str()) )); return true; @@ -749,7 +750,7 @@ COMPLEX_PARSER(TypeParser, if (name == "include" && ns.empty()) { s.m_parser = SHARED_PTR(new TypeParser(m_Project - , reqif::ElementFactory::get().orderElement(name.c_str()) + , ::reqif::ElementFactory::get().orderElement(name.c_str()) )); return true; } @@ -776,7 +777,7 @@ COMPLEX_PARSER(TypeParser, COMPLEX_PARSER(SpecObjectTypeParser, { s.m_parser = SHARED_PTR(new SpecAttributesParser(m_Project - , reqif::ElementFactory::get().orderElement(name.c_str()) + , ::reqif::ElementFactory::get().orderElement(name.c_str()) )); return true; @@ -806,7 +807,7 @@ COMPLEX_PARSER(AttributeDefinitionParser, ,name.c_str() ,m_context.size()); s.m_parser = SHARED_PTR(new TypeParser(m_Project - , reqif::ElementFactory::get().orderElement("TYPE") + , ::reqif::ElementFactory::get().orderElement("TYPE") )); return true; } diff --git a/src/xml/reqif/reqif_elements_parser.h b/src/xml/reqif/reqif_elements_parser.h index c81c44a..5783b76 100644 --- a/src/xml/reqif/reqif_elements_parser.h +++ b/src/xml/reqif/reqif_elements_parser.h @@ -6,20 +6,20 @@ #include -namespace reqif +namespace xml { class project; - namespace parser + namespace reqif { template struct _parser_data { }; - class EmptyElement : public reqif::parser::ParserBase + class EmptyElement : public xml::reqif::ParserBase { protected: public: - EmptyElement(reqif::Element *_elt ) ; + EmptyElement(::reqif::Element *_elt ) ; EmptyElement(const EmptyElement &_e) : m_str(""), m_CurrentElement(_e.m_CurrentElement) {} virtual ~EmptyElement() {}; @@ -65,7 +65,7 @@ namespace reqif std::cerr<<"post(bool) with bad value:"< m_parser; - reqif::Element *m_data; /* To solve recurse issue ....*/ + SHARED_PTR m_parser; + ::reqif::Element *m_data; /* To solve recurse issue ....*/ }; std::vector m_context; }; @@ -175,7 +175,7 @@ namespace reqif * \param * */ - class RootElement : public ::reqif::parser::EmptyElement + class RootElement : public xml::reqif::EmptyElement { private: RootElement(const RootElement &c); @@ -189,7 +189,7 @@ namespace reqif */ virtual void postImpl(); public: - RootElement(reqif::Element *_elt ) ; + RootElement(::reqif::Element *_elt ) ; virtual ~RootElement() {}; @@ -210,8 +210,8 @@ namespace reqif virtual ~State(); bool m_any; int m_depth; /* I need to find another name for this*/ - SHARED_PTR m_parser; - reqif::Element *m_data; /* To solve recurse issue ....*/ + SHARED_PTR m_parser; + ::reqif::Element *m_data; /* To solve recurse issue ....*/ }; std::vector m_context; }; @@ -221,7 +221,7 @@ namespace reqif #define ROOT_PARSER(nm,cls) class cls; #define SIMPLE_PARSER(nm,cls) class cls; -#include +#include #undef SIMPLE_PARSER #undef COMPLEX_PARSER #undef ROOT_PARSER @@ -233,7 +233,7 @@ class cls : public ComplexElement \ protected: \ cls(const cls &_c) ; \ public: \ - cls(antcc::project *_project,reqif::Element *_elt = NULL ) ; \ + cls(antcc::project *_project,::reqif::Element *_elt = NULL ) ; \ virtual ~cls() ; \ \ virtual bool startElementImpl(const std::string &ns,const std::string &name,const std::string &type) ; \ @@ -258,7 +258,7 @@ class cls : public RootElement \ protected: \ cls(const cls &_c) ; \ public: \ - cls(antcc::project *_project,reqif::Element *_elt = NULL ) ; \ + cls(antcc::project *_project,::reqif::Element *_elt = NULL ) ; \ virtual ~cls() ; \ \ virtual bool startElementImpl(const std::string &ns,const std::string &name,const std::string &type) ; \ @@ -282,7 +282,7 @@ class cls : public SimpleElement \ protected: \ cls(const cls &_c) ; \ public: \ - cls(antcc::project *_project,reqif::Element *_elt = NULL ) ; \ + cls(antcc::project *_project,::reqif::Element *_elt = NULL ) ; \ virtual ~cls() ; \ \ virtual bool AttributeImpl(const std::string &ns,const std::string &name,const std::string &val); \ @@ -295,9 +295,10 @@ class cls : public SimpleElement \ // Parser DataType Specialization before usage #define COMPLEX_DATA_PARSER(eltname,parse,data) \ template <> \ -struct _parser_data< ::reqif::parser:: parse> \ +struct _parser_data< ::xml::reqif:: parse> \ data ; \ +#if 0 COMPLEX_DATA_PARSER(target,TargetParser,{ TaskParser *m_TaskParser; CopyParser *m_CopyParser; @@ -309,7 +310,7 @@ COMPLEX_DATA_PARSER(copy,CopyParser,{}) COMPLEX_DATA_PARSER(fileset,TypeParser,{}) COMPLEX_DATA_PARSER(redirector,RedirectorParser,{}) COMPLEX_DATA_PARSER(macrodef,MacrodefParser,{}) - +#endif #include #undef COMPLEX_PARSER diff --git a/src/xml/reqif/reqif_elements_parser_root.cpp b/src/xml/reqif/reqif_elements_parser_root.cpp index 1b2f8f0..1c00bab 100644 --- a/src/xml/reqif/reqif_elements_parser_root.cpp +++ b/src/xml/reqif/reqif_elements_parser_root.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include "reqif/reqif_element.h" #include "reqif/reqif_elements_parser.h" @@ -13,8 +13,8 @@ //#include //#include -namespace reqif { - namespace parser { +namespace xml { + namespace reqif { @@ -22,7 +22,7 @@ namespace reqif { * Implement RootElement parsing function */ -RootElement::RootElement(reqif::Element *_elt ) +RootElement::RootElement(::reqif::Element *_elt ) : EmptyElement(_elt) { ANTCC_PARSER_DEBUG("Cplx(%0x)::Cplx ctor m_CurElt=%0x" @@ -31,7 +31,7 @@ RootElement::RootElement(reqif::Element *_elt ) } RootElement::RootElement(const RootElement &c) - : reqif::parser::EmptyElement(c.m_CurrentElement) + : xml::reqif::EmptyElement(c.m_CurrentElement) { ANTCC_PARSER_DEBUG("Cplx(%0x)::Cplx copy c.m_CurElt=%0x" ,this -- 2.30.2