Commit a0fbc4c7 authored by Albert Astals Cid's avatar Albert Astals Cid Committed by Albert Astals Cid

Make Stream::getKind const

parent db2faed9
/* poppler-input-stream.h: glib interface to poppler /* poppler-input-stream.h: glib interface to poppler
* *
* Copyright (C) 2012 Carlos Garcia Campos <carlosgc@gnome.org> * Copyright (C) 2012 Carlos Garcia Campos <carlosgc@gnome.org>
* Copyright (C) 2019 Albert Astals Cid <aacid@kde.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -36,7 +37,7 @@ public: ...@@ -36,7 +37,7 @@ public:
BaseStream *copy() override; BaseStream *copy() override;
Stream *makeSubStream(Goffset start, bool limited, Stream *makeSubStream(Goffset start, bool limited,
Goffset lengthA, Object &&dictA) override; Goffset lengthA, Object &&dictA) override;
StreamKind getKind() override { return strWeird; } StreamKind getKind() const override { return strWeird; }
void reset() override; void reset() override;
void close() override; void close() override;
int getChar() override int getChar() override
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
// //
// Copyright 2009 Stefan Thomas <thomas@eload24.com> // Copyright 2009 Stefan Thomas <thomas@eload24.com>
// Copyright 2010 Hib Eris <hib@hiberis.nl> // Copyright 2010 Hib Eris <hib@hiberis.nl>
// Copyright 2010, 2018 Albert Astals Cid <aacid@kde.org> // Copyright 2010, 2018, 2019 Albert Astals Cid <aacid@kde.org>
// //
//======================================================================== //========================================================================
...@@ -49,7 +49,7 @@ public: ...@@ -49,7 +49,7 @@ public:
CachedFile(const CachedFile &) = delete; CachedFile(const CachedFile &) = delete;
CachedFile& operator=(const CachedFile &) = delete; CachedFile& operator=(const CachedFile &) = delete;
unsigned int getLength() { return length; } unsigned int getLength() const { return length; }
long int tell(); long int tell();
int seek(long int offset, int origin); int seek(long int offset, int origin);
size_t read(void * ptr, size_t unitsize, size_t count); size_t read(void * ptr, size_t unitsize, size_t count);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// //
// Copyright 2005 Jeff Muizelaar <jeff@infidigm.net> // Copyright 2005 Jeff Muizelaar <jeff@infidigm.net>
// Copyright 2005 Martin Kretzschmar <martink@gnome.org> // Copyright 2005 Martin Kretzschmar <martink@gnome.org>
// Copyright 2005-2007, 2009-2011, 2017 Albert Astals Cid <aacid@kde.org> // Copyright 2005-2007, 2009-2011, 2017, 2019 Albert Astals Cid <aacid@kde.org>
// Copyright 2010 Carlos Garcia Campos <carlosgc@gnome.org> // Copyright 2010 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright 2011 Daiki Ueno <ueno@unixuser.org> // Copyright 2011 Daiki Ueno <ueno@unixuser.org>
// Copyright 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
...@@ -57,7 +57,7 @@ public: ...@@ -57,7 +57,7 @@ public:
DCTStream(Stream *strA, int colorXformA, Dict *dict, int recursion); DCTStream(Stream *strA, int colorXformA, Dict *dict, int recursion);
~DCTStream(); ~DCTStream();
StreamKind getKind() override { return strDCT; } StreamKind getKind() const override { return strDCT; }
void reset() override; void reset() override;
int getChar() override; int getChar() override;
int lookChar() override; int lookChar() override;
......
...@@ -101,7 +101,7 @@ public: ...@@ -101,7 +101,7 @@ public:
BaseCryptStream(Stream *strA, const unsigned char *fileKey, CryptAlgorithm algoA, BaseCryptStream(Stream *strA, const unsigned char *fileKey, CryptAlgorithm algoA,
int keyLength, Ref ref); int keyLength, Ref ref);
~BaseCryptStream(); ~BaseCryptStream();
StreamKind getKind() override { return strCrypt; } StreamKind getKind() const override { return strCrypt; }
void reset() override; void reset() override;
int getChar() override; int getChar() override;
int lookChar() override = 0; int lookChar() override = 0;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// FlateEncoder.h // FlateEncoder.h
// //
// Copyright (C) 2016, William Bader <williambader@hotmail.com> // Copyright (C) 2016, William Bader <williambader@hotmail.com>
// Copyright (C) 2018 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2018, 2019 Albert Astals Cid <aacid@kde.org>
// //
// This file is under the GPLv2 or later license // This file is under the GPLv2 or later license
// //
...@@ -42,7 +42,7 @@ public: ...@@ -42,7 +42,7 @@ public:
FlateEncoder(Stream *strA); FlateEncoder(Stream *strA);
~FlateEncoder(); ~FlateEncoder();
StreamKind getKind() override { return strWeird; } StreamKind getKind() const override { return strWeird; }
void reset() override; void reset() override;
int getChar() override int getChar() override
{ return (outBufPtr >= outBufEnd && !fillBuf()) ? EOF : (*outBufPtr++ & 0xff); } { return (outBufPtr >= outBufEnd && !fillBuf()) ? EOF : (*outBufPtr++ & 0xff); }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// FlateStream.h // FlateStream.h
// //
// Copyright (C) 2005, Jeff Muizelaar <jeff@infidigm.net> // Copyright (C) 2005, Jeff Muizelaar <jeff@infidigm.net>
// Copyright (C) 2010, 2011, Albert Astals Cid <aacid@kde.org> // Copyright (C) 2010, 2011, 2019, Albert Astals Cid <aacid@kde.org>
// //
// This file is under the GPLv2 or later license // This file is under the GPLv2 or later license
// //
...@@ -37,7 +37,7 @@ public: ...@@ -37,7 +37,7 @@ public:
FlateStream(Stream *strA, int predictor, int columns, int colors, int bits); FlateStream(Stream *strA, int predictor, int columns, int colors, int bits);
virtual ~FlateStream(); virtual ~FlateStream();
virtual StreamKind getKind() override { return strFlate; } virtual StreamKind getKind() const override { return strFlate; }
virtual void reset() override; virtual void reset() override;
virtual int getChar() override; virtual int getChar() override;
virtual int lookChar() override; virtual int lookChar() override;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
// Copyright (C) 2015 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp> // Copyright (C) 2015 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
// Copyright (C) 2019 Oliver Sander <oliver.sander@tu-dresden.de> // Copyright (C) 2019 Oliver Sander <oliver.sander@tu-dresden.de>
// Copyright (C) 2019 Volker Krause <vkrause@kde.org> // Copyright (C) 2019 Volker Krause <vkrause@kde.org>
// Copyright (C) 2019 Albert Astals Cid <aacid@kde.org>
// //
// To see a description of the changes please see the Changelog file that // To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git // came with your tarball or type make ChangeLog if you are building from git
...@@ -45,7 +46,7 @@ public: ...@@ -45,7 +46,7 @@ public:
JBIG2Stream(Stream *strA, Object &&globalsStreamA, Object *globalsStreamRefA); JBIG2Stream(Stream *strA, Object &&globalsStreamA, Object *globalsStreamRefA);
~JBIG2Stream(); ~JBIG2Stream();
StreamKind getKind() override { return strJBIG2; } StreamKind getKind() const override { return strJBIG2; }
void reset() override; void reset() override;
void close() override; void close() override;
Goffset getPos() override; Goffset getPos() override;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// //
// A JPX stream decoder using OpenJPEG // A JPX stream decoder using OpenJPEG
// //
// Copyright 2008, 2010 Albert Astals Cid <aacid@kde.org> // Copyright 2008, 2010, 2019 Albert Astals Cid <aacid@kde.org>
// Copyright 2011 Daniel Glöckner <daniel-gl@gmx.net> // Copyright 2011 Daniel Glöckner <daniel-gl@gmx.net>
// Copyright 2013, 2014 Adrian Johnson <ajohnson@redneon.com> // Copyright 2013, 2014 Adrian Johnson <ajohnson@redneon.com>
// Copyright 2015 Adam Reichold <adam.reichold@t-online.de> // Copyright 2015 Adam Reichold <adam.reichold@t-online.de>
...@@ -28,7 +28,7 @@ public: ...@@ -28,7 +28,7 @@ public:
JPXStream(Stream *strA); JPXStream(Stream *strA);
~JPXStream(); ~JPXStream();
StreamKind getKind() override { return strJPX; } StreamKind getKind() const override { return strJPX; }
void reset() override; void reset() override;
void close() override; void close() override;
Goffset getPos() override; Goffset getPos() override;
......
...@@ -6,6 +6,20 @@ ...@@ -6,6 +6,20 @@
// //
//======================================================================== //========================================================================
//========================================================================
//
// Modified under the Poppler project - http://poppler.freedesktop.org
//
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
// Copyright (C) 2019 Albert Astals Cid <aacid@kde.org>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
//
//========================================================================
#ifndef JPXSTREAM_H #ifndef JPXSTREAM_H
#define JPXSTREAM_H #define JPXSTREAM_H
...@@ -257,7 +271,7 @@ public: ...@@ -257,7 +271,7 @@ public:
JPXStream(Stream *strA); JPXStream(Stream *strA);
virtual ~JPXStream(); virtual ~JPXStream();
virtual StreamKind getKind() override { return strJPX; } virtual StreamKind getKind() const override { return strJPX; }
virtual void reset() override; virtual void reset() override;
virtual void close() override; virtual void close() override;
virtual int getChar() override; virtual int getChar() override;
......
...@@ -990,7 +990,7 @@ public: ...@@ -990,7 +990,7 @@ public:
DeviceNRecoder(Stream *strA, int widthA, int heightA, DeviceNRecoder(Stream *strA, int widthA, int heightA,
GfxImageColorMap *colorMapA); GfxImageColorMap *colorMapA);
~DeviceNRecoder(); ~DeviceNRecoder();
StreamKind getKind() override { return strWeird; } StreamKind getKind() const override { return strWeird; }
void reset() override; void reset() override;
int getChar() override int getChar() override
{ return (bufIdx >= bufSize && !fillBuf()) ? EOF : buf[bufIdx++]; } { return (bufIdx >= bufSize && !fillBuf()) ? EOF : buf[bufIdx++]; }
......
...@@ -182,7 +182,7 @@ public: ...@@ -182,7 +182,7 @@ public:
{ {
} }
StreamKind getKind() override { return str->getBaseStream()->getKind(); } StreamKind getKind() const override { return str->getBaseStream()->getKind(); }
void reset() override { str->getBaseStream()->reset(); } void reset() override { str->getBaseStream()->reset(); }
int getChar() override { return str->getBaseStream()->getChar(); } int getChar() override { return str->getBaseStream()->getChar(); }
int lookChar() override { return str->getBaseStream()->lookChar(); } int lookChar() override { return str->getBaseStream()->lookChar(); }
......
...@@ -106,7 +106,7 @@ public: ...@@ -106,7 +106,7 @@ public:
Stream& operator=(const Stream &other) = delete; Stream& operator=(const Stream &other) = delete;
// Get kind of stream. // Get kind of stream.
virtual StreamKind getKind() = 0; virtual StreamKind getKind() const = 0;
// Reset stream to beginning. // Reset stream to beginning.
virtual void reset() = 0; virtual void reset() = 0;
...@@ -456,7 +456,7 @@ public: ...@@ -456,7 +456,7 @@ public:
BaseStream *copy() override; BaseStream *copy() override;
Stream *makeSubStream(Goffset startA, bool limitedA, Stream *makeSubStream(Goffset startA, bool limitedA,
Goffset lengthA, Object &&dictA) override; Goffset lengthA, Object &&dictA) override;
StreamKind getKind() override { return strFile; } StreamKind getKind() const override { return strFile; }
void reset() override; void reset() override;
void close() override; void close() override;
int getChar() override int getChar() override
...@@ -531,7 +531,7 @@ public: ...@@ -531,7 +531,7 @@ public:
BaseStream *copy() override; BaseStream *copy() override;
Stream *makeSubStream(Goffset startA, bool limitedA, Stream *makeSubStream(Goffset startA, bool limitedA,
Goffset lengthA, Object &&dictA) override; Goffset lengthA, Object &&dictA) override;
StreamKind getKind() override { return strCachedFile; } StreamKind getKind() const override { return strCachedFile; }
void reset() override; void reset() override;
void close() override; void close() override;
int getChar() override int getChar() override
...@@ -593,7 +593,7 @@ public: ...@@ -593,7 +593,7 @@ public:
return new BaseMemStream(buf, startA, newLength, std::move(dictA)); return new BaseMemStream(buf, startA, newLength, std::move(dictA));
} }
StreamKind getKind() override { return strWeird; } StreamKind getKind() const override { return strWeird; }
void reset() override { void reset() override {
bufPtr = buf + start; bufPtr = buf + start;
...@@ -703,7 +703,7 @@ public: ...@@ -703,7 +703,7 @@ public:
BaseStream *copy() override; BaseStream *copy() override;
Stream *makeSubStream(Goffset start, bool limitedA, Stream *makeSubStream(Goffset start, bool limitedA,
Goffset lengthA, Object &&dictA) override; Goffset lengthA, Object &&dictA) override;
StreamKind getKind() override { return str->getKind(); } StreamKind getKind() const override { return str->getKind(); }
void reset() override {} void reset() override {}
int getChar() override; int getChar() override;
int lookChar() override; int lookChar() override;
...@@ -744,7 +744,7 @@ public: ...@@ -744,7 +744,7 @@ public:
ASCIIHexStream(Stream *strA); ASCIIHexStream(Stream *strA);
~ASCIIHexStream(); ~ASCIIHexStream();
StreamKind getKind() override { return strASCIIHex; } StreamKind getKind() const override { return strASCIIHex; }
void reset() override; void reset() override;
int getChar() override int getChar() override
{ int c = lookChar(); buf = EOF; return c; } { int c = lookChar(); buf = EOF; return c; }
...@@ -767,7 +767,7 @@ public: ...@@ -767,7 +767,7 @@ public:
ASCII85Stream(Stream *strA); ASCII85Stream(Stream *strA);
~ASCII85Stream(); ~ASCII85Stream();
StreamKind getKind() override { return strASCII85; } StreamKind getKind() const override { return strASCII85; }
void reset() override; void reset() override;
int getChar() override int getChar() override
{ int ch = lookChar(); ++index; return ch; } { int ch = lookChar(); ++index; return ch; }
...@@ -793,7 +793,7 @@ public: ...@@ -793,7 +793,7 @@ public:
LZWStream(Stream *strA, int predictor, int columns, int colors, LZWStream(Stream *strA, int predictor, int columns, int colors,
int bits, int earlyA); int bits, int earlyA);
~LZWStream(); ~LZWStream();
StreamKind getKind() override { return strLZW; } StreamKind getKind() const override { return strLZW; }
void reset() override; void reset() override;
int getChar() override; int getChar() override;
int lookChar() override; int lookChar() override;
...@@ -852,7 +852,7 @@ public: ...@@ -852,7 +852,7 @@ public:
RunLengthStream(Stream *strA); RunLengthStream(Stream *strA);
~RunLengthStream(); ~RunLengthStream();
StreamKind getKind() override { return strRunLength; } StreamKind getKind() const override { return strRunLength; }
void reset() override; void reset() override;
int getChar() override int getChar() override
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); } { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
...@@ -887,7 +887,7 @@ public: ...@@ -887,7 +887,7 @@ public:
bool byteAlignA, int columnsA, int rowsA, bool byteAlignA, int columnsA, int rowsA,
bool endOfBlockA, bool blackA, int damagedRowsBeforeErrorA); bool endOfBlockA, bool blackA, int damagedRowsBeforeErrorA);
~CCITTFaxStream(); ~CCITTFaxStream();
StreamKind getKind() override { return strCCITTFax; } StreamKind getKind() const override { return strCCITTFax; }
void reset() override; void reset() override;
int getChar() override int getChar() override
{ int c = lookChar(); buf = EOF; return c; } { int c = lookChar(); buf = EOF; return c; }
...@@ -973,7 +973,7 @@ public: ...@@ -973,7 +973,7 @@ public:
DCTStream(Stream *strA, int colorXformA, Dict *dict, int recursion); DCTStream(Stream *strA, int colorXformA, Dict *dict, int recursion);
virtual ~DCTStream(); virtual ~DCTStream();
StreamKind getKind() override { return strDCT; } StreamKind getKind() const override { return strDCT; }
void reset() override; void reset() override;
void close() override; void close() override;
int getChar() override; int getChar() override;
...@@ -1081,7 +1081,7 @@ public: ...@@ -1081,7 +1081,7 @@ public:
FlateStream(Stream *strA, int predictor, int columns, FlateStream(Stream *strA, int predictor, int columns,
int colors, int bits); int colors, int bits);
~FlateStream(); ~FlateStream();
StreamKind getKind() override { return strFlate; } StreamKind getKind() const override { return strFlate; }
void reset() override; void reset() override;
int getChar() override; int getChar() override;
int lookChar() override; int lookChar() override;
...@@ -1155,7 +1155,7 @@ public: ...@@ -1155,7 +1155,7 @@ public:
EOFStream(Stream *strA); EOFStream(Stream *strA);
~EOFStream(); ~EOFStream();
StreamKind getKind() override { return strWeird; } StreamKind getKind() const override { return strWeird; }
void reset() override {} void reset() override {}
int getChar() override { return EOF; } int getChar() override { return EOF; }
int lookChar() override { return EOF; } int lookChar() override { return EOF; }
...@@ -1172,7 +1172,7 @@ public: ...@@ -1172,7 +1172,7 @@ public:
BufStream(Stream *strA, int bufSizeA); BufStream(Stream *strA, int bufSizeA);
~BufStream(); ~BufStream();
StreamKind getKind() override { return strWeird; } StreamKind getKind() const override { return strWeird; }
void reset() override; void reset() override;
int getChar() override; int getChar() override;
int lookChar() override; int lookChar() override;
...@@ -1197,7 +1197,7 @@ public: ...@@ -1197,7 +1197,7 @@ public:
FixedLengthEncoder(Stream *strA, int lengthA); FixedLengthEncoder(Stream *strA, int lengthA);
~FixedLengthEncoder(); ~FixedLengthEncoder();
StreamKind getKind() override { return strWeird; } StreamKind getKind() const override { return strWeird; }
void reset() override; void reset() override;
int getChar() override; int getChar() override;
int lookChar() override; int lookChar() override;
...@@ -1220,7 +1220,7 @@ public: ...@@ -1220,7 +1220,7 @@ public:
ASCIIHexEncoder(Stream *strA); ASCIIHexEncoder(Stream *strA);
~ASCIIHexEncoder(); ~ASCIIHexEncoder();
StreamKind getKind() override { return strWeird; } StreamKind getKind() const override { return strWeird; }
void reset() override; void reset() override;
int getChar() override int getChar() override
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); } { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
...@@ -1250,7 +1250,7 @@ public: ...@@ -1250,7 +1250,7 @@ public:
ASCII85Encoder(Stream *strA); ASCII85Encoder(Stream *strA);
~ASCII85Encoder(); ~ASCII85Encoder();
StreamKind getKind() override { return strWeird; } StreamKind getKind() const override { return strWeird; }
void reset() override; void reset() override;
int getChar() override int getChar() override
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); } { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
...@@ -1280,7 +1280,7 @@ public: ...@@ -1280,7 +1280,7 @@ public:
RunLengthEncoder(Stream *strA); RunLengthEncoder(Stream *strA);
~RunLengthEncoder(); ~RunLengthEncoder();
StreamKind getKind() override { return strWeird; } StreamKind getKind() const override { return strWeird; }
void reset() override; void reset() override;
int getChar() override int getChar() override
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); } { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
...@@ -1316,7 +1316,7 @@ public: ...@@ -1316,7 +1316,7 @@ public:
LZWEncoder(Stream *strA); LZWEncoder(Stream *strA);
~LZWEncoder(); ~LZWEncoder();
StreamKind getKind() override { return strWeird; } StreamKind getKind() const override { return strWeird; }
void reset() override; void reset() override;
int getChar() override; int getChar() override;
int lookChar() override; int lookChar() override;
...@@ -1348,7 +1348,7 @@ public: ...@@ -1348,7 +1348,7 @@ public:
CMYKGrayEncoder(Stream *strA); CMYKGrayEncoder(Stream *strA);
~CMYKGrayEncoder(); ~CMYKGrayEncoder();
StreamKind getKind() override { return strWeird; } StreamKind getKind() const override { return strWeird; }
void reset() override; void reset() override;
int getChar() override int getChar() override
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); } { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
...@@ -1377,7 +1377,7 @@ public: ...@@ -1377,7 +1377,7 @@ public:
RGBGrayEncoder(Stream *strA); RGBGrayEncoder(Stream *strA);
~RGBGrayEncoder(); ~RGBGrayEncoder();
StreamKind getKind() override { return strWeird; } StreamKind getKind() const override { return strWeird; }
void reset() override; void reset() override;
int getChar() override int getChar() override
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); } { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment