]> git.stg.codes - stg.git/blobdiff - stglibs/srvconf.lib/parsers/server_info.cpp
Implemented transcoders for some getters.
[stg.git] / stglibs / srvconf.lib / parsers / server_info.cpp
index da6b85e0c0521614c39836b80749523e7d6a9955..50dbb2ccc7e4ad0a63a4be2d067b1f6ebadb00cc 100644 (file)
@@ -38,9 +38,10 @@ const size_t DIRNAME_LEN  = 16;
 
 }
 
-SERVER_INFO::PARSER::PARSER(CALLBACK f, void * d)
+SERVER_INFO::PARSER::PARSER(CALLBACK f, void * d, const std::string & e)
     : callback(f),
       data(d),
+      encoding(e),
       depth(0),
       parsingAnswer(false)
 {
@@ -52,19 +53,23 @@ SERVER_INFO::PARSER::PARSER(CALLBACK f, void * d)
     AddParser(propertyParsers, "tariff_num", info.tariffNum);
 
     for (size_t i = 0; i < DIR_NUM; i++)
-        AddParser(propertyParsers, "dir_name_" + x2str(i), info.dirName[i], GetEncodedValue);
+        AddParser(propertyParsers, "dir_name_" + unsigned2str(i), info.dirName[i], GetEncodedValue);
 }
 //-----------------------------------------------------------------------------
 int SERVER_INFO::PARSER::ParseStart(const char *el, const char **attr)
 {
 depth++;
 if (depth == 1)
+    {
     if (strcasecmp(el, "ServerInfo") == 0)
         parsingAnswer = true;
+    }
 else
+    {
     if (depth == 2 && parsingAnswer)
-        if (!TryParse(propertyParsers, ToLower(el), attr))
+        if (!TryParse(propertyParsers, ToLower(el), attr, encoding))
             error = "Invalid parameter.";
+    }
 return 0;
 }
 //-----------------------------------------------------------------------------