/usr/include/strigi/substreamprovider.h is in libstreams-dev 0.7.7-1.1ubuntu3.
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 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | /* This file is part of Strigi Desktop Search
*
* Copyright (C) 2006 Jos van den Oever <jos@vandenoever.info>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef STRIGI_SUBSTREAMPROVIDER
#define STRIGI_SUBSTREAMPROVIDER
#include <string>
#include <map>
#include "streambase.h"
namespace Strigi {
/**
* @brief Provides information about the current substream
*/
struct STREAMS_EXPORT EntryInfo {
/**
* @brief Name of the substream
*
* This will be a file name in almost all cases
*/
std::string filename;
/**
* @brief Extendable property map
**/
std::map<std::string, std::string> properties;
/** The size of the substream */
int64_t size;
/** The last modification time of the substream */
time_t mtime;
/** Represents the type of the substream */
enum Type {
Unknown=0 /**< Indicates that the type of the substream is unknown */,
Dir=1 /**< Indicates that the substream represents a directory */,
File=2 /**< Indicates that the substream represents a file */
};
/** The type of the substream */
Type type;
/** Initialises the elements to sane defaults */
EntryInfo() :size(-1), mtime(0), type(Unknown) {}
};
/**
* @brief Extracts substreams from an InputStream
*
* This class extracts substreams, such as files and directories,
* from an InputStream. For example, it may extract files
* and directories from a tar archive, or uncompressed data from
* a gzipped data stream.
*/
class STREAMS_EXPORT SubStreamProvider {
protected:
/** The status of the SubStreamProvider */
StreamStatus m_status;
/**
* @brief String representation of the last error, or
* an empty string otherwise
*/
std::string m_error;
/** The input stream to extract the substreams from */
InputStream *m_input;
/** The current substream */
InputStream *m_entrystream;
/** Information about the current substream */
EntryInfo m_entryinfo;
public:
/**
* @brief Initialize the SubStreamProvider
*
* This just sets the members to sane defaults, and assigns
* @p input to @p m_input
*
* @param input the inputstream that will be split into substreams
*/
SubStreamProvider(InputStream *input)
: m_status(Ok)
, m_input(input)
, m_entrystream(0)
{}
/**
* @brief Releases the memory used by entrystream, if there is one
*
* NB: does not delete input
*/
virtual ~SubStreamProvider()
{
if (m_entrystream) {
delete m_entrystream;
}
}
/**
* @brief Return the status of the stream.
**/
StreamStatus status() const
{
return m_status;
}
/**
* Get the next substream
*
* This function should return a stream representing the next
* substream that can be read from the input stream, or 0 if
* there are no more substreams.
*
* For example, if the input stream were a tar archive, it would
* return a stream representing the next file or directory in the
* archive.
*
* It should also load the substream (the same one that was returned)
* into entrystream, and set entryinfo to an EntryInfo giving
* information about the substream.
*
* If there may be more substreams, but an error occurred, 0 should
* be returned, the status should be set to Error and an error message
* should be set.
*
* @return the next substream, or 0 if there are no more substreams
* or an error occurred
*/
virtual InputStream* nextEntry() = 0;
/**
* @brief get the current substream
*/
InputStream* currentEntry()
{
return m_entrystream;
}
/**
* @brief get information about the current substream
*/
const EntryInfo &entryInfo() const
{
return m_entryinfo;
}
/**
* @brief Return a string representation of the last error.
* If no error has occurred, an empty string is returned.
**/
const char* error() const
{
return m_error.c_str();
}
};
} // end namespace Strigi
#endif
|