Almost there to try first parsing
authoraebersol <aebersol@q6600.home>
Wed, 29 Mar 2023 20:27:56 +0000 (22:27 +0200)
committeraebersol <aebersol@q6600.home>
Wed, 29 Mar 2023 20:27:56 +0000 (22:27 +0200)
13 files changed:
.gitignore [new file with mode: 0644]
CMakeLists.txt
reqif.cpp [new file with mode: 0644]
src/xml/element_factory.cpp
src/xml/reqif/CMakeLists.txt
src/xml/reqif/document.cpp [new file with mode: 0644]
src/xml/reqif/document.h [new file with mode: 0644]
src/xml/reqif/parser_base.h
src/xml/reqif/parsers.h.inc
src/xml/reqif/reqif_element.h
src/xml/reqif/reqif_elements_parser.cpp
src/xml/reqif/reqif_elements_parser.h
src/xml/reqif/reqif_elements_parser_root.cpp

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..9dce1e3
--- /dev/null
@@ -0,0 +1,3 @@
+
+Build
+*~
index c99a8c339c29b5519a2568a093ffb1bf19d0073b..5b68e6f2cc2570778e7d11f71908d5db49925197 100644 (file)
@@ -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 (file)
index 0000000..c2ed284
--- /dev/null
+++ b/reqif.cpp
@@ -0,0 +1,47 @@
+#include <iostream>
+#include <fstream>
+
+#include <antcc/config.h>
+#include <os/path.h>
+#include <os/file.h>
+#include <utils/aeb/optionparser.h>
+
+#include <expat.h>
+#include <location.h>
+
+#include "xml/reqif/parser_base.h"
+#include "xml/reqif/reqif_elements_parser.h"
+#include "xml/reqif/document.h"
+
+#include <logger.h>
+#include "xml/reqif/reqif_element.h"
+#include "xml/element_factory.h"
+//#include <projectComponent.h>
+//#include <tasks/ITaskContainer.h>
+//#include <target.h>
+//#include <project.h>
+
+#include <properties/property_file.h>
+
+//#include <antcc/antcc.h>
+
+void parse(const std::string &file)
+{
+    std::cout<<"Build Parser"<<std::endl;
+    //xml::reqif::ReqifParser  project_parser(&m_Project,&m_Project);
+    xml::reqif::ReqifParser  project_parser(nullptr,nullptr);
+    xml::reqif::Document doc(project_parser,"project");
+
+    std::ifstream bf(file);
+    if (bf.is_open())
+    {
+        std::cout<<"Main Got build rules:"<<file<<std::endl;
+        doc.parse(bf);
+    }
+}
+
+
+int main(int argc,char **argv)
+{
+  std::cout<<"Hello world ReqIf Parsing"<<std::endl;
+}
index 2443b3a0493af1a157b95e98e5e13ff6f526a4a9..56e8e71823f5d2c996979c0ac57d52fb036484f1 100644 (file)
@@ -2,8 +2,8 @@
 #include <iostream>
 #include <antcc/config.h>
 #include <logger.h>
-#include <reqif/element_factory.h>
-#include <reqif/elements.h>
+#include "xml/element_factory.h"
+#include "xml/reqif/reqif_element.h"
 
 namespace reqif {
 
index 24a42d8f0c731bb9e4b90730f1d9215b1cb75c3e..85c3f6ec48a4d804692b8cadc35b2606fd6f1a43 100644 (file)
@@ -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 (file)
index 0000000..7b3d89e
--- /dev/null
@@ -0,0 +1,180 @@
+#include <cstring>
+#include <iostream>
+#include <expat.h>
+
+#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<Document*>(d));
+                doc.startElement(ns,attr);
+            }
+
+            void Document::endElement_glb(void *d,const XML_Char *ns)
+            {
+                Document &doc = (*reinterpret_cast<Document*>(d));
+                doc.endElement(ns);
+            }
+            
+            void Document::characters_glb(void *d,const XML_Char *ns,int ds)
+            {
+                Document &doc = (*reinterpret_cast<Document*>(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<Document*>(d));
+            }
+            void Document::endNamespace_glb(void *d,const XML_Char *prefix)
+            {
+                Document &doc = (*reinterpret_cast<Document*>(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 "<<m_name<<std::endl;
+                        m_root_parser.preImpl();
+                        m_root_parser.updateLocation(m_location);
+                    } else 
+                    {
+                        ANTCC_LOG_CRITICAL("**** Document wrong root start %s-%s*****",m_name,n);
+                    }
+                    /* I think I shoud proceed with the attributes now */
+                }
+                const XML_Char **p = attr;
+                for (p ; *p != 0 ; p+=2)
+                {   
+                    split_name(*p,ns,ns_s,nm,nm_s);
+                    Attribute(std::string(ns,ns_s),std::string(nm,nm_s),std::string(*(p+1)));
+                }
+            }
+            void Document::endElement(const XML_Char *name)
+            {
+                const char *ns;
+                const char *nm;
+                size_t ns_s,nm_s;
+                split_name(name,ns,ns_s,nm,nm_s);
+                if (--m_depth > 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 (file)
index 0000000..878ee2e
--- /dev/null
@@ -0,0 +1,111 @@
+#ifndef  REQIF_PARSER_DOC_H 
+#define  REQIF_PARSER_DOC_H
+#include <iostream>
+
+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
index b3042e7f7814eee28633f7a7dfe20d99071e7862..b1accc58e72e682506fb51d4b1e5b4a5eab4231d 100644 (file)
@@ -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 <iostream>
+
 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
index 1ca3cf738b9f5d6a22998dc1c10c285712cd0fbe..edd6145f17fbc8b43b6a0ff6916c94a7315a240e 100644 (file)
@@ -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)
index 2be682157a2b1bdabf8e766ba23e47196d3a2017..d70438f910e29441de77e1ef70fa88041a0a2bc9 100644 (file)
@@ -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) {} ;
             /**
index 12f1b0b56cfecc717ed09601f779f7e0051e94d2..ea0d852422f712b69f4726cb51e2b98b21e8533d 100644 (file)
@@ -4,7 +4,7 @@
 #include <os/path.h>
 #include <os/file.h>
 #include <location.h>
-#include <parser_base.h>
+#include "xml/reqif/parser_base.h"
 #include <logger.h>
 
 //#include <xml/element.h>
 
 
 //#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<TargetParser>(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<CoreContentParser>(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<DescriptionParser>(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<DescriptionParser>(new DescriptionParser(m_Project
-                           , reqif::ElementFactory::get().orderElement(name.c_str())
+                           , ::reqif::ElementFactory::get().orderElement(name.c_str())
                  ));
     }
     else
     {
       s.m_parser = SHARED_PTR<DescriptionParser>(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<DatatypesParser>(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<TypeParser>(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<DatatypeParser>(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<TypeParser>(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<SpecAttributesParser>(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<TypeParser>(new TypeParser(m_Project
-                   , reqif::ElementFactory::get().orderElement("TYPE")
+                   , ::reqif::ElementFactory::get().orderElement("TYPE")
                  ));
       return true;
     }
index c81c44a75aa6a2cf3023fc2f8797afdb562af082..5783b7670edd083a38bf7151abe11c5d980f46e0 100644 (file)
@@ -6,20 +6,20 @@
 
 #include <stdlib.h>
 
-namespace reqif 
+namespace xml
 {
     class project;
-    namespace parser
+    namespace reqif
     {
         template <typename T>
         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_str<<std::endl;
                 }
             };
-            virtual reqif::Element *post() { return m_CurrentElement; };
+           virtual ::reqif::Element *post() { return m_CurrentElement; };
             //virtual void post(xsd::decimal &v) {v = atoi(m_str.c_str());};
 
            //
@@ -87,7 +87,7 @@ namespace reqif
             protected:
             /** Characters in element */
             std::string        m_str;
-           reqif::Element     *m_CurrentElement;
+           ::reqif::Element     *m_CurrentElement;
         };
 
         /**
@@ -101,7 +101,7 @@ namespace reqif
         class SimpleElement : public EmptyElement
         {
             public:
-            SimpleElement(reqif::Element *_elt=NULL)
+            SimpleElement(::reqif::Element *_elt=NULL)
                    : EmptyElement(_elt) {};
             virtual ~SimpleElement() { };
             private:
@@ -123,7 +123,7 @@ namespace reqif
          * \param
          *
          */
-        class ComplexElement : public ::reqif::parser::EmptyElement
+        class ComplexElement : public xml::reqif::EmptyElement
         {
             protected:
                 ComplexElement(const ComplexElement &c);
@@ -137,7 +137,7 @@ namespace reqif
              */
             virtual void postImpl();
             public:
-            ComplexElement(reqif::Element *_elt ) ;
+            ComplexElement(::reqif::Element *_elt ) ;
             virtual ~ComplexElement() {};
                 
             
@@ -158,8 +158,8 @@ namespace reqif
                     virtual ~State();
                     bool                       m_any;
                     int                        m_depth; /* I need to  find another name for this*/
-                    SHARED_PTR<reqif::parser::ParserBase> m_parser;
-                    reqif::Element         *m_data;  /* To solve recurse issue ....*/
+                    SHARED_PTR<xml::reqif::ParserBase> m_parser;
+                    ::reqif::Element         *m_data;  /* To solve recurse issue ....*/
                 };
                 std::vector<State> 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<reqif::parser::ParserBase> m_parser;
-                    reqif::Element            *m_data;  /* To solve recurse issue ....*/
+                    SHARED_PTR<xml::reqif::ParserBase> m_parser;
+                    ::reqif::Element            *m_data;  /* To solve recurse issue ....*/
                 };
                 std::vector<State> m_context;
         };
@@ -221,7 +221,7 @@ namespace reqif
 #define ROOT_PARSER(nm,cls) class cls;
 #define SIMPLE_PARSER(nm,cls) class cls;
         
-#include <xml/parser/parsers.h.inc>
+#include <xml/reqif/parsers.h.inc>
 #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 <xml/reqif/parsers.h.inc>
 #undef COMPLEX_PARSER
index 1b2f8f0297d8bd4f5c368ad2b57a93ead65dcdf3..1c00babe1bdad3f2c25a74f736df128baec653dd 100644 (file)
@@ -4,7 +4,7 @@
 #include <os/path.h>
 #include <os/file.h>
 #include <location.h>
-#include <parser_base.h>
+#include <xml/reqif/parser_base.h>
 #include <logger.h>
 #include "reqif/reqif_element.h"
 #include "reqif/reqif_elements_parser.h"
@@ -13,8 +13,8 @@
 //#include <project.h>
 //#include <projectComponent.h>
 
-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