]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/configuration/sgconfig/parser.h
Better error reporting in netunit.cpp.
[stg.git] / projects / stargazer / plugins / configuration / sgconfig / parser.h
index 0cda75b63f6aec9a43906408314a62f7b72c712b..4e4b94173c2beb8f4d61a522550390532b487245 100644 (file)
@@ -22,6 +22,7 @@
 #define PARSER_H
 
 #include <string>
+#include <map>
 
 class ADMIN;
 
@@ -30,13 +31,15 @@ class BASE_PARSER
     public:
         struct FACTORY
         {
-            virtual BASE_PARSER * create() = 0;
+            virtual BASE_PARSER * create(const ADMIN & admin) = 0;
         };
+        typedef std::map<std::string, FACTORY *> REGISTRY;
 
         BASE_PARSER(const ADMIN & admin, const std::string & t)
             : m_currAdmin(admin),
               m_depth(0),
-              m_tag(t)
+              m_tag(t),
+              m_done(false)
         {}
         virtual ~BASE_PARSER() {}
         virtual int Start(void * data, const char * el, const char ** attr);
@@ -47,6 +50,8 @@ class BASE_PARSER
         std::string GetOpenTag() const { return "<" + m_tag + ">"; }
         std::string GetCloseTag() const { return "</" + m_tag + ">"; }
 
+        bool IsDone() const { return m_done; }
+
     protected:
         BASE_PARSER(const BASE_PARSER & rvalue);
         BASE_PARSER & operator=(const BASE_PARSER & rvalue);
@@ -55,6 +60,7 @@ class BASE_PARSER
         size_t        m_depth;
         std::string   m_answer;
         std::string   m_tag;
+        bool          m_done;
 
     private:
         virtual void CreateAnswer() = 0;