X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/1631088d558bc27b4f94869ddedec4580e7f30fa..c3b507d1eb8a82f9eda3a5e7f7b2dd2f2e9bb4c0:/stglibs/srvconf.lib/include/stg/parser_get_user.h diff --git a/stglibs/srvconf.lib/include/stg/parser_get_user.h b/stglibs/srvconf.lib/include/stg/parser_get_user.h index 3f09ca5e..7f6faaad 100644 --- a/stglibs/srvconf.lib/include/stg/parser_get_user.h +++ b/stglibs/srvconf.lib/include/stg/parser_get_user.h @@ -22,35 +22,17 @@ #ifndef __STG_STGLIBS_SRVCONF_PARSER_GET_USER_H__ #define __STG_STGLIBS_SRVCONF_PARSER_GET_USER_H__ -#include "stg/parser.h" +#include "parser.h" + +#include "property_parsers.h" #include "stg/os_int.h" +#include "stg/const.h" #include -#include #include -class BASE_PROPERTY_PARSER -{ - public: - virtual bool Parse(const char ** attr) = 0; -}; - -template -class PROPERTY_PARSER -{ - public: - typedef T (* FUNC)(const char **); - PROPERTY_PARSER(T & v, FUNC f) : value(v), func(f) {} - virtual void Parse(const char ** attr) { value = func(attr); } - private: - T & value; - FUNC func; -}; - -typedef std::map PROPERTY_PARSERS; - class PARSER_GET_USER: public PARSER { public: @@ -90,7 +72,7 @@ public: std::string userData[USERDATA_NUM]; }; - typedef void (* CALLBACK)(const INFO & info, void * data); + typedef void (* CALLBACK)(bool result, const std::string & reason, const INFO & info, void * data); PARSER_GET_USER(); virtual ~PARSER_GET_USER(); @@ -103,6 +85,8 @@ private: void * data; INFO info; int depth; + bool parsingAnswer; + std::string error; void ParseUser(const char *el, const char **attr); void ParseUserParams(const char *el, const char **attr);