/usr/include/Poco/Redis/RedisStream.h is in libpoco-dev 1.8.0.1-1ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | //
// RedisStream.h
//
// Library: Redis
// Package: Redis
// Module: RedisStream
//
// Definition of the RedisStream class.
//
// Copyright (c) 2015, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Redis_RedisStream_INCLUDED
#define Redis_RedisStream_INCLUDED
#include "Poco/Redis/Redis.h"
#include "Poco/BufferedStreamBuf.h"
#include "Poco/Net/StreamSocket.h"
#include <istream>
#include <ostream>
namespace Poco {
namespace Redis {
class RedisStreamBuf: public BufferedStreamBuf
/// BufferedStreamBuf for Redis.
{
public:
RedisStreamBuf(Net::StreamSocket& redis);
/// Constructor
~RedisStreamBuf();
/// Destructor
std::string readLine();
/// Reads a line from Redis (until \r\n is encountered).
protected:
int readFromDevice(char* buffer, std::streamsize length);
int writeToDevice(const char* buffer, std::streamsize length);
private:
enum
{
STREAM_BUFFER_SIZE = 1024
};
Net::StreamSocket& _redis;
};
class RedisIOS: public virtual std::ios
{
public:
RedisIOS(Net::StreamSocket& redis);
/// Creates the RedisIOS with the given socket.
~RedisIOS();
/// Destroys the RedisIOS.
///
/// Flushes the buffer, but does not close the socket.
RedisStreamBuf* rdbuf();
/// Returns a pointer to the internal RedisStreamBuf.
void close();
/// Flushes the stream.
protected:
RedisStreamBuf _buf;
};
class Redis_API RedisOutputStream: public RedisIOS, public std::ostream
/// An output stream for writing to a Redis server.
{
public:
RedisOutputStream(Net::StreamSocket& redis);
/// Creates the RedisOutputStream with the given socket.
~RedisOutputStream();
/// Destroys the RedisOutputStream.
///
/// Flushes the buffer.
};
class Redis_API RedisInputStream: public RedisIOS, public std::istream
/// An input stream for reading from a Redis server.
{
public:
RedisInputStream(Net::StreamSocket& redis);
/// Creates the RedisInputStream with the given socket.
~RedisInputStream();
/// Destroys the RedisInputStream.
std::string getline();
/// Redis uses \r\n as delimiter. This getline version removes
/// the \r from the result.
};
} } // namespace Poco::Redis
#endif // Redis_RedisStream_INCLUDED
|