2018-08-12 18:07:22 +00:00
|
|
|
#ifndef QPDF_STREAM_HH
|
|
|
|
#define QPDF_STREAM_HH
|
2008-04-29 12:55:25 +00:00
|
|
|
|
2012-06-21 17:47:41 +00:00
|
|
|
#include <qpdf/Types.h>
|
2008-04-29 12:55:25 +00:00
|
|
|
|
2012-06-21 17:47:41 +00:00
|
|
|
#include <qpdf/QPDFObject.hh>
|
2008-04-29 12:55:25 +00:00
|
|
|
#include <qpdf/QPDFObjectHandle.hh>
|
|
|
|
|
|
|
|
class Pipeline;
|
|
|
|
class QPDF;
|
|
|
|
|
|
|
|
class QPDF_Stream: public QPDFObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
QPDF_Stream(QPDF*, int objid, int generation,
|
|
|
|
QPDFObjectHandle stream_dict,
|
2012-06-21 23:32:21 +00:00
|
|
|
qpdf_offset_t offset, size_t length);
|
2008-04-29 12:55:25 +00:00
|
|
|
virtual ~QPDF_Stream();
|
|
|
|
virtual std::string unparse();
|
2013-01-22 14:57:07 +00:00
|
|
|
virtual QPDFObject::object_type_e getTypeCode() const;
|
|
|
|
virtual char const* getTypeName() const;
|
2018-02-16 22:25:27 +00:00
|
|
|
virtual void setDescription(QPDF*, std::string const&);
|
2008-04-29 12:55:25 +00:00
|
|
|
QPDFObjectHandle getDict() const;
|
2018-02-02 23:21:34 +00:00
|
|
|
bool isDataModified() const;
|
2008-04-29 12:55:25 +00:00
|
|
|
|
2010-08-02 22:17:01 +00:00
|
|
|
// See comments in QPDFObjectHandle.hh for these methods.
|
2017-08-19 13:18:14 +00:00
|
|
|
bool pipeStreamData(Pipeline*,
|
|
|
|
unsigned long encode_flags,
|
|
|
|
qpdf_stream_decode_level_e decode_level,
|
2017-09-12 19:48:08 +00:00
|
|
|
bool suppress_warnings, bool will_retry);
|
2017-08-19 13:18:14 +00:00
|
|
|
PointerHolder<Buffer> getStreamData(qpdf_stream_decode_level_e);
|
2010-08-09 23:33:40 +00:00
|
|
|
PointerHolder<Buffer> getRawStreamData();
|
2010-08-02 22:17:01 +00:00
|
|
|
void replaceStreamData(PointerHolder<Buffer> data,
|
2010-08-05 19:04:22 +00:00
|
|
|
QPDFObjectHandle const& filter,
|
|
|
|
QPDFObjectHandle const& decode_parms);
|
|
|
|
void replaceStreamData(
|
|
|
|
PointerHolder<QPDFObjectHandle::StreamDataProvider> provider,
|
|
|
|
QPDFObjectHandle const& filter,
|
2012-07-07 21:33:45 +00:00
|
|
|
QPDFObjectHandle const& decode_parms);
|
2018-02-02 23:21:34 +00:00
|
|
|
void addTokenFilter(
|
|
|
|
PointerHolder<QPDFObjectHandle::TokenFilter> token_filter);
|
2008-04-29 12:55:25 +00:00
|
|
|
|
2012-07-21 13:00:06 +00:00
|
|
|
void replaceDict(QPDFObjectHandle new_dict);
|
|
|
|
|
2010-08-05 20:20:52 +00:00
|
|
|
// Replace object ID and generation. This may only be called if
|
|
|
|
// object ID and generation are 0. It is used by QPDFObjectHandle
|
|
|
|
// when adding streams to files.
|
|
|
|
void setObjGen(int objid, int generation);
|
|
|
|
|
2017-08-28 21:05:34 +00:00
|
|
|
protected:
|
|
|
|
virtual void releaseResolved();
|
|
|
|
|
2008-04-29 12:55:25 +00:00
|
|
|
private:
|
2010-09-05 15:00:44 +00:00
|
|
|
static std::map<std::string, std::string> filter_abbreviations;
|
|
|
|
|
2010-08-05 19:04:22 +00:00
|
|
|
void replaceFilterData(QPDFObjectHandle const& filter,
|
|
|
|
QPDFObjectHandle const& decode_parms,
|
|
|
|
size_t length);
|
2012-12-30 00:00:05 +00:00
|
|
|
bool understandDecodeParams(
|
|
|
|
std::string const& filter, QPDFObjectHandle decode_params,
|
2017-12-25 00:18:52 +00:00
|
|
|
int& predictor, int& columns,
|
|
|
|
int& colors, int& bits_per_component,
|
|
|
|
bool& early_code_change);
|
2008-04-29 12:55:25 +00:00
|
|
|
bool filterable(std::vector<std::string>& filters,
|
2017-08-19 13:18:14 +00:00
|
|
|
bool& specialized_compression, bool& lossy_compression,
|
2017-12-25 00:18:52 +00:00
|
|
|
int& predictor, int& columns,
|
|
|
|
int& colors, int& bits_per_component,
|
|
|
|
bool& early_code_change);
|
2017-07-27 22:18:18 +00:00
|
|
|
void warn(QPDFExc const& e);
|
2018-02-16 22:25:27 +00:00
|
|
|
void setDictDescription();
|
|
|
|
void setStreamDescription();
|
2008-04-29 12:55:25 +00:00
|
|
|
|
|
|
|
QPDF* qpdf;
|
|
|
|
int objid;
|
|
|
|
int generation;
|
|
|
|
QPDFObjectHandle stream_dict;
|
2012-06-21 23:32:21 +00:00
|
|
|
qpdf_offset_t offset;
|
2012-06-20 15:20:57 +00:00
|
|
|
size_t length;
|
2010-08-02 22:17:01 +00:00
|
|
|
PointerHolder<Buffer> stream_data;
|
2010-08-05 19:04:22 +00:00
|
|
|
PointerHolder<QPDFObjectHandle::StreamDataProvider> stream_provider;
|
2018-02-02 23:21:34 +00:00
|
|
|
std::vector<
|
|
|
|
PointerHolder<QPDFObjectHandle::TokenFilter> > token_filters;
|
2008-04-29 12:55:25 +00:00
|
|
|
};
|
|
|
|
|
2018-08-12 18:07:22 +00:00
|
|
|
#endif // QPDF_STREAM_HH
|