/strigi-0.7.7/libstreams/lib/signatureinputstream.h
C Header | 70 lines | 19 code | 5 blank | 46 comment | 0 complexity | 94c54a1c9b12e15c1cfd8f1cce6e2645 MD5 | raw file
Possible License(s): LGPL-2.0
1/* This file is part of Strigi Desktop Search
2 *
3 * Copyright (C) 2009 Jos van den Oever <jos@vandenoever.info>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20#ifndef STRIGI_SIGNATUREINPUTSTREAM
21#define STRIGI_SIGNATUREINPUTSTREAM
22
23#include <strigi/strigiconfig.h>
24#include "streambase.h"
25
26namespace Strigi {
27
28/**
29 * @brief Reads a stream and remembers the signature.
30 *
31 * This class stops reading data when either the end of the
32 * underlying stream is reacher, or a given terminator is encountered
33 * in the the stream.
34 */
35class SignatureInputStream : public InputStream {
36private:
37 class Private;
38 Private* const p;
39public:
40 /**
41 * @brief Create a stream from an InputStream.
42 *
43 * @param i the underlying InputStream to read the data from
44 * @param terminator the terminator indicating the end of this substream
45 */
46 SignatureInputStream(InputStream* i, int32_t signaturesize);
47 ~SignatureInputStream();
48 /**
49 * @brief inherited from StreamBase
50 **/
51 int32_t read(const char*& start, int32_t min=0, int32_t max=0);
52 /**
53 * @brief inherited from StreamBase
54 **/
55 int64_t reset(int64_t pos);
56 /**
57 * @brief inherited from StreamBase
58 **/
59 int64_t skip(int64_t ntoskip);
60 /**
61 * @brief Return the signature of this stream.
62 * The signature is only available once the end of the stream has been
63 * reached. The signature can up up to @p signaturesize bytes long.
64 **/
65 std::string signature() const;
66};
67
68} //end namespace Strigi
69
70#endif