From 53706e811b1cb3b57552a1f19612f16032bcb3d7 Mon Sep 17 00:00:00 2001 From: Christophe Le Roy Date: Sun, 9 Oct 2016 00:27:31 +0200 Subject: [PATCH] DBRedis: add replyTypeStr Maps Redis response constants to strings --- db-redis.cpp | 20 ++++++++++++++++++++ db-redis.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/db-redis.cpp b/db-redis.cpp index c6f6564..75a918b 100644 --- a/db-redis.cpp +++ b/db-redis.cpp @@ -71,6 +71,26 @@ std::vector DBRedis::getBlockPos() } +std::string DBRedis::replyTypeStr(int type) { + switch(type) { + case REDIS_REPLY_STATUS: + return "REDIS_REPLY_STATUS"; + case REDIS_REPLY_ERROR: + return "REDIS_REPLY_ERROR"; + case REDIS_REPLY_INTEGER: + return "REDIS_REPLY_INTEGER"; + case REDIS_REPLY_NIL: + return "REDIS_REPLY_NIL"; + case REDIS_REPLY_STRING: + return "REDIS_REPLY_STRING"; + case REDIS_REPLY_ARRAY: + return "REDIS_REPLY_ARRAY"; + default: + return "UNKNOWN_REPLY_TYPE"; + } +} + + void DBRedis::loadPosCache() { redisReply *reply; diff --git a/db-redis.h b/db-redis.h index 0c05824..bbb2dcb 100644 --- a/db-redis.h +++ b/db-redis.h @@ -11,6 +11,8 @@ public: virtual void getBlocksOnZ(std::map &blocks, int16_t zPos); virtual ~DBRedis(); private: + static std::string replyTypeStr(int type); + void loadPosCache(); std::vector posCache;