StreamUtils.h
// StreamUtils.h
//
// Author David Barrett-Lennard
// (C)opyright Cedanet Pty Ltd 2004
#pragma once
#ifndef Ceda_cxUtils_StreamUtils_H
#define Ceda_cxUtils_StreamUtils_H
#include "StreamInterfaces.h"
namespace ceda
{
struct NullOutputStream : public IOutputStream
{
virtual void WriteStream(const void* buffer, ssize_t numBytes)
{
}
virtual void FlushStream() {}
};
class StreamLengthCounter : public IOutputStream
{
public:
StreamLengthCounter() : m_length(0) {}
// Implementation of IOutputStream
virtual void WriteStream(const void* buffer, ssize_t numBytes)
{
m_length += numBytes;
}
virtual void FlushStream() {}
int64 GetLength() const { return m_length; }
private:
int64 m_length;
};
} // namespace ceda
#endif // include guard