X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/7e142f5d0a61138473602352e38c6f5a5e4bba61..0093be0eb4dbe201a7d63da1de47f98c68987b1d:/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 7b6032e0..7f6faaad 100644 --- a/stglibs/srvconf.lib/include/stg/parser_get_user.h +++ b/stglibs/srvconf.lib/include/stg/parser_get_user.h @@ -24,35 +24,15 @@ #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 ~BASE_PROPERTY_PARSER() {} - virtual void Parse(const char ** attr) = 0; -}; - -template -class PROPERTY_PARSER : public BASE_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: @@ -92,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(); @@ -105,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);