6 #include <c++utilities/io/catchiofailure.h> 7 #include <c++utilities/io/copy.h> 27 StreamDataBlock::StreamDataBlock() :
43 StreamDataBlock::StreamDataBlock(
const std::function<std::istream & ()> &stream, std::istream::off_type startOffset, std::ios_base::seekdir startDir, std::istream::off_type endOffset, std::ios_base::seekdir endDir) :
47 auto currentPos = s.tellg();
54 IoUtilities::throwIoFailure(
"End offset is less than start offset.");
98 m_fileInfo->setPath(path);
99 m_fileInfo->open(
true);
100 m_fileInfo->parseContainerFormat();
103 m_stream = [
this] () -> std::istream & {
104 return this->m_fileInfo->stream();
119 ss <<
"ID: " <<
id();
120 if(!
name().empty()) {
121 ss <<
", name: \"" <<
name() <<
"\"";
124 ss <<
", mime-type: \"" <<
mimeType() <<
"\"";
134 m_description.clear();
157 auto file = make_unique<FileDataBlock>(path);
158 const auto fileName = file->fileInfo()->fileName();
159 if(!fileName.empty()) {
162 const char *
mimeType = file->fileInfo()->mimeType();
167 m_isDataFromFile =
true;
Contains utility classes helping to read and write streams.