]> git.stg.codes - stg.git/blobdiff - libs/srvconf/parsers/get_corp.h
Public interfaces: part 1
[stg.git] / libs / srvconf / parsers / get_corp.h
index b9d879833dad252cedcc8176fbd78dd32dbe949d..c756b0f8b6519bdf4025bd45b0fb1f87808b1b34 100644 (file)
@@ -18,8 +18,7 @@
  *    Author : Maxim Mamontov <faust@stargazer.dp.ua>
  */
 
-#ifndef __STG_STGLIBS_SRVCONF_PARSER_GET_CORP_H__
-#define __STG_STGLIBS_SRVCONF_PARSER_GET_CORP_H__
+#pragma once
 
 #include "base.h"
 #include "property.h"
 
 namespace STG
 {
-namespace GET_CORP
+namespace GetCorp
 {
 
-class PARSER: public STG::PARSER
+class Parser: public STG::Parser
 {
-public:
-    typedef GET_CORP::INFO INFO;
-
-    PARSER(CALLBACK f, void * data, const std::string & encoding);
-    virtual ~PARSER();
-    int  ParseStart(const char * el, const char ** attr);
-    void ParseEnd(const char * el);
-    void Failure(const std::string & reason) { callback(false, reason, info, data); }
-
-private:
-    PROPERTY_PARSERS propertyParsers;
-    CALLBACK callback;
-    void * data;
-    INFO info;
-    std::string encoding;
-    int depth;
-    bool parsingAnswer;
-    std::string error;
-
-    void ParseCorp(const char * el, const char ** attr);
-    void ParseCorpParams(const char * el, const char ** attr);
+    public:
+        using Info = GetCorp::Info;
+
+        Parser(Callback f, void* data, const std::string& encoding);
+
+        ~Parser() override;
+        int  ParseStart(const char* el, const char** attr) override;
+        void ParseEnd(const char* el) override;
+        void Failure(const std::string& reason) override { callback(false, reason, info, data); }
+
+    private:
+        PropertyParsers propertyParsers;
+        Callback callback;
+        void* data;
+        Info info;
+        std::string encoding;
+        int depth;
+        bool parsingAnswer;
+        std::string error;
+
+        void ParseCorp(const char* el, const char** attr);
+        void ParseCorpParams(const char* el, const char** attr);
 };
 
-} // namespace GET_CORP
+} // namespace GetCorp
 } // namespace STG
-
-#endif