mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-26 00:40:05 +01:00
added Redis library
This commit is contained in:
69
Redis/src/Array.cpp
Normal file
69
Redis/src/Array.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// Array.h
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Library: Redis
|
||||
// Package: Redis
|
||||
// Module: Array
|
||||
//
|
||||
// Implementation of the Array class.
|
||||
//
|
||||
// Copyright (c) 2015, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Redis/Array.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Redis {
|
||||
|
||||
|
||||
Array::Array()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Array::Array(const Array& copy):
|
||||
_elements(copy._elements)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Array::~Array()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Array& Array::addRedisType(RedisType::Ptr value)
|
||||
{
|
||||
checkNull();
|
||||
|
||||
_elements.value().push_back(value);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
int Array::getType(size_t pos) const
|
||||
{
|
||||
if (_elements.isNull()) throw NullValueException();
|
||||
|
||||
if (pos >= _elements.value().size()) throw InvalidArgumentException();
|
||||
|
||||
RedisType::Ptr element = _elements.value().at(pos);
|
||||
return element->type();
|
||||
}
|
||||
|
||||
|
||||
std::string Array::toString() const
|
||||
{
|
||||
return RedisTypeTraits<Array>::toString(*this);
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Redis
|
||||
Reference in New Issue
Block a user