PageRenderTime 25ms CodeModel.GetById 19ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/mordor/streams/cat.h

http://github.com/mozy/mordor
C Header | 37 lines | 26 code | 10 blank | 1 comment | 1 complexity | 42602f7d44af4696689770e25b7a9a3f MD5 | raw file
 1#ifndef __MORDOR_CAT_STREAM__
 2#define __MORDOR_CAT_STREAM__
 3// Copyright (c) 2009 - Mozy, Inc.
 4
 5#include <vector>
 6
 7#include "stream.h"
 8
 9namespace Mordor {
10
11class CatStream : public Stream
12{
13public:
14    CatStream(const std::vector<Stream::ptr> &streams);
15
16    bool supportsRead() { return true; }
17    bool supportsSeek() { return m_seekable; }
18    bool supportsTell() { return true; }
19    bool supportsSize() { return m_size != -1ll; }
20
21    using Stream::read;
22    size_t read(Buffer &buffer, size_t length);
23
24    long long seek(long long offset, Anchor anchor = BEGIN);
25    long long size();
26
27private:
28    std::vector<Stream::ptr> m_streams;
29    std::vector<Stream::ptr>::iterator m_it;
30    bool m_seekable;
31    long long m_size;
32    long long m_pos;
33};
34
35};
36
37#endif