Class Poco::Redis::RedisType
Author: Applied Informatics Software Engineering GmbH and Contributors

# Poco::Redis

# class RedisType

Library: Redis
Package: Redis
Header: Poco/Redis/Type.h

## Description

Base class for all Redis types. This class makes it possible to store element with different types in Array.

## Inheritance

Known Derived Classes: Type

## Member Summary

Member Functions: createRedisType, isArray, isBulkString, isError, isInteger, isSimpleString, read, toString, type

## Types

### Ptr

typedef SharedPtr < RedisType > Ptr;

## Enumerations

### Types

REDIS_INTEGER

Redis Integer

REDIS_SIMPLE_STRING

Redis Simple String

REDIS_BULK_STRING

Redis Bulkstring

REDIS_ARRAY

Redis Array

REDIS_ERROR

Redis Error

## Constructors

### RedisType

RedisType();

Creates the RedisType.

## Destructor

### ~RedisType

virtual ~RedisType();

Destroys the RedisType.

## Member Functions

### createRedisType

static RedisType::Ptr createRedisType(
char marker
);

Create a Redis type based on the marker:

- '+': a simple string (std::string)
- '-': an error (Error)
- '$': a bulk string (BulkString)
- '*': an array (Array)
- ':': a signed 64 bit integer (Int64)

### isArray

bool isArray() const;

Returns true when the value is a Redis array.

### isBulkString

bool isBulkString() const;

Returns true when the value is a Redis bulkstring.

### isError

bool isError() const;

Returns true when the value is a Redis error.

### isInteger

bool isInteger() const;

Returns true when the value is a Redis integer (64 bit integer).

### isSimpleString

bool isSimpleString() const;

Returns true when the value is a simple string.

### read

virtual void read(
RedisInputStream & input
) = 0;

Reads the value from the stream.

### toString

virtual std::string toString() const = 0;

Converts the value to a RESP (REdis Serialization Protocol) string.

### type

virtual int type() const = 0;

Returns the type of the value.