]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/configuration/sgconfig/parser.cpp
Ticket 37. 'Allow equal', 'Allow cheaper' and 'Allow expensive' comments changed to
[stg.git] / projects / stargazer / plugins / configuration / sgconfig / parser.cpp
index 52c0ea9ba114018e4dae5d594d0835761bd0a6c4..0371798197d287aaf4d8e5f778b0efdbcf4e1944 100644 (file)
 
 #include "parser.h"
 
-#include "stg/tariffs.h"
-#include "stg/admin.h"
-#include "stg/users.h"
-#include "stg/user_property.h"
-#include "stg/settings.h"
-#include "stg/logger.h"
-#include "stg/version.h"
-#include "stg/store.h"
-
 #include <cstring>
-#include <cstdio> // sprintf
 
 //-----------------------------------------------------------------------------
 //  BASE PARSER
 //-----------------------------------------------------------------------------
-int BASE_PARSER::Start(void *, const char *el, const char **)
+int BASE_PARSER::Start(void *, const char * el, const char **)
 {
-if (strcasecmp(el, tag.c_str()) == 0)
-    return 0;
+    if (strcasecmp(el, m_tag.c_str()) == 0)
+        return 0;
 
-return -1;
+    return -1;
 }
 //-----------------------------------------------------------------------------
-int BASE_PARSER::End(void *, const char *el)
+int BASE_PARSER::End(void *, const char * el)
 {
-if (strcasecmp(el, tag.c_str()) == 0)
+    if (m_depth < 2)
     {
-    CreateAnswer();
-    return 0;
+        if (strcasecmp(el, m_tag.c_str()) != 0)
+            return -1;
+        CreateAnswer();
     }
 
-return -1;
+    --m_depth;
+    return 0;
 }