6 #include <c++utilities/io/catchiofailure.h> 7 #include <c++utilities/io/copy.h> 27 StreamDataBlock::StreamDataBlock() :
47 auto currentPos = s.tellg();
48 s.seekg(startOffset, startDir);
50 s.seekg(endOffset, endDir);
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() <<
"\"";
123 if(!mimeType().empty()) {
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();
164 m_mimeType = mimeType;
167 m_isDataFromFile =
true;
Contains utility classes helping to read and write streams.