mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-26 18:42:41 +01:00
overload operator<< and add for vector of strings / hmget
This commit is contained in:
@@ -58,6 +58,11 @@ public:
|
||||
}
|
||||
|
||||
Array& operator<<(const char* s);
|
||||
/// Special implementation for const char*
|
||||
|
||||
Array& operator<<(const std::vector<std::string>& strings);
|
||||
/// Special implementation for a vector with strings
|
||||
/// All strings will be added as a BulkString.
|
||||
|
||||
Array& add();
|
||||
/// Adds an Null BulkString
|
||||
@@ -76,6 +81,11 @@ public:
|
||||
}
|
||||
|
||||
Array& add(const char* s);
|
||||
/// Special implementation for const char*
|
||||
|
||||
Array& add(const std::vector<std::string>& strings);
|
||||
/// Special implementation for a vector with strings
|
||||
/// All strings will be added as a BulkString.
|
||||
|
||||
Array& addRedisType(RedisType::Ptr value);
|
||||
/// Adds a Redis element.
|
||||
@@ -143,6 +153,11 @@ inline Array& Array::operator<<(const char* s)
|
||||
return add(value);
|
||||
}
|
||||
|
||||
inline Array& Array::operator<<(const std::vector<std::string>& strings)
|
||||
{
|
||||
return add(strings);
|
||||
}
|
||||
|
||||
inline Array& Array::add()
|
||||
{
|
||||
BulkString value;
|
||||
@@ -162,6 +177,15 @@ inline Array& Array::add(const char* s)
|
||||
return add(value);
|
||||
}
|
||||
|
||||
inline Array& Array::add(const std::vector<std::string>& strings)
|
||||
{
|
||||
for(std::vector<std::string>::const_iterator it = strings.begin(); it != strings.end(); ++it)
|
||||
{
|
||||
add(*it);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Array& Array::addSimpleString(const std::string& value)
|
||||
{
|
||||
return addRedisType(new Type<std::string>(value));
|
||||
|
||||
@@ -96,6 +96,9 @@ public:
|
||||
static Command hlen(const std::string& hash);
|
||||
/// Returns an HLEN command
|
||||
|
||||
static Command hmget(const std::string& hash, const StringVec& fields);
|
||||
/// Returns an HMGET command
|
||||
|
||||
static Command hset(const std::string& hash, const std::string& field, const std::string& value, bool create = true);
|
||||
/// Returns an HSET or HSETNX (when create is false) command
|
||||
|
||||
|
||||
Reference in New Issue
Block a user