An array can contain other arrays ... it can even contain an error ...

This commit is contained in:
fbraem
2015-10-23 22:00:50 +02:00
parent 901751f800
commit f77642a77a
2 changed files with 11 additions and 4 deletions

View File

@@ -23,12 +23,14 @@
#include "Poco/Redis/Redis.h" #include "Poco/Redis/Redis.h"
#include "Poco/Redis/Type.h" #include "Poco/Redis/Type.h"
#include "Poco/Redis/Error.h"
#include "Poco/Redis/Exception.h" #include "Poco/Redis/Exception.h"
namespace Poco { namespace Poco {
namespace Redis { namespace Redis {
class Redis_API Array class Redis_API Array
/// Represents a Redis Array.
{ {
public: public:
Array(); Array();
@@ -123,13 +125,19 @@ void Type<Array>::read(RedisSocket& socket)
switch(elementType) switch(elementType)
{ {
case ElementTraits<Int64>::marker : case ElementTraits<Int64>::marker :
element = new Type<Int64>(); element = new Type<Int64>();
break; break;
case ElementTraits<std::string>::marker : case ElementTraits<std::string>::marker :
element = new Type<std::string>(); element = new Type<std::string>();
break; break;
case ElementTraits<BulkString>::marker : case ElementTraits<BulkString>::marker :
element = new Type<BulkString>(); element = new Type<BulkString>();
break;
case ElementTraits<Array>::marker :
element = new Type<Array>();
break;
case ElementTraits<Error>::marker :
element = new Type<Error>();
break; break;
} }

View File

@@ -51,8 +51,6 @@ class Redis_API Client
/// { /// {
/// // We have a Null value /// // We have a Null value
/// } /// }
///
/// An Array can't contain another Array.
{ {
public: public:
typedef Poco::SharedPtr<Client> Ptr; typedef Poco::SharedPtr<Client> Ptr;
@@ -152,6 +150,7 @@ private:
/// $ : a bulk string (BulkString) /// $ : a bulk string (BulkString)
/// * : an array (Array) /// * : an array (Array)
/// : : a signed 64 bit integer (Int64) /// : : a signed 64 bit integer (Int64)
friend class Array;
}; };