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
*
* 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
* it under the terms of the GNU General Public License as published by
......@@ -36,7 +37,7 @@ public:
BaseStream *copy() override;
Stream *makeSubStream(Goffset start, bool limited,
Goffset lengthA, Object &&dictA) override;
StreamKind getKind() override { return strWeird; }
StreamKind getKind() const override { return strWeird; }
void reset() override;
void close() override;
int getChar() override
......
......@@ -8,7 +8,7 @@
//
// Copyright 2009 Stefan Thomas <thomas@eload24.com>
// 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:
CachedFile(const CachedFile &) = delete;
CachedFile& operator=(const CachedFile &) = delete;
unsigned int getLength() { return length; }
unsigned int getLength() const { return length; }
long int tell();
int seek(long int offset, int origin);
size_t read(void * ptr, size_t unitsize, size_t count);
......
......@@ -6,7 +6,7 @@
//
// Copyright 2005 Jeff Muizelaar <jeff@infidigm.net>
// 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 2011 Daiki Ueno <ueno@unixuser.org>
// Copyright 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
......@@ -57,7 +57,7 @@ public:
DCTStream(Stream *strA, int colorXformA, Dict *dict, int recursion);
~DCTStream();
StreamKind getKind() override { return strDCT; }
StreamKind getKind() const override { return strDCT; }
void reset() override;
int getChar() override;
int lookChar() override;
......
......@@ -101,7 +101,7 @@ public:
BaseCryptStream(Stream *strA, const unsigned char *fileKey, CryptAlgorithm algoA,
int keyLength, Ref ref);
~BaseCryptStream();
StreamKind getKind() override { return strCrypt; }
StreamKind getKind() const override { return strCrypt; }
void reset() override;
int getChar() override;
int lookChar() override = 0;
......
......@@ -3,7 +3,7 @@
// FlateEncoder.h
//
// 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
//
......@@ -42,7 +42,7 @@ public:
FlateEncoder(Stream *strA);
~FlateEncoder();
StreamKind getKind() override { return strWeird; }
StreamKind getKind() const override { return strWeird; }
void reset() override;
int getChar() override
{ return (outBufPtr >= outBufEnd && !fillBuf()) ? EOF : (*outBufPtr++ & 0xff); }
......
......@@ -3,7 +3,7 @@
// FlateStream.h
//
// 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
//
......@@ -37,7 +37,7 @@ public:
FlateStream(Stream *strA, int predictor, int columns, int colors, int bits);
virtual ~FlateStream();
virtual StreamKind getKind() override { return strFlate; }
virtual StreamKind getKind() const override { return strFlate; }
virtual void reset() override;
virtual int getChar() override;
virtual int lookChar() override;
......
......@@ -18,6 +18,7 @@
// Copyright (C) 2015 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
// Copyright (C) 2019 Oliver Sander <oliver.sander@tu-dresden.de>
// 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
// came with your tarball or type make ChangeLog if you are building from git
......@@ -45,7 +46,7 @@ public:
JBIG2Stream(Stream *strA, Object &&globalsStreamA, Object *globalsStreamRefA);
~JBIG2Stream();
StreamKind getKind() override { return strJBIG2; }
StreamKind getKind() const override { return strJBIG2; }
void reset() override;
void close() override;
Goffset getPos() override;
......
......@@ -4,7 +4,7 @@
//
// 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 2013, 2014 Adrian Johnson <ajohnson@redneon.com>
// Copyright 2015 Adam Reichold <adam.reichold@t-online.de>
......@@ -28,7 +28,7 @@ public:
JPXStream(Stream *strA);
~JPXStream();
StreamKind getKind() override { return strJPX; }
StreamKind getKind() const override { return strJPX; }
void reset() override;
void close() override;
Goffset getPos() override;
......
......@@ -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
#define JPXSTREAM_H
......@@ -257,7 +271,7 @@ public:
JPXStream(Stream *strA);
virtual ~JPXStream();
virtual StreamKind getKind() override { return strJPX; }
virtual StreamKind getKind() const override { return strJPX; }
virtual void reset() override;
virtual void close() override;
virtual int getChar() override;
......
......@@ -990,7 +990,7 @@ public:
DeviceNRecoder(Stream *strA, int widthA, int heightA,
GfxImageColorMap *colorMapA);
~DeviceNRecoder();
StreamKind getKind() override { return strWeird; }
StreamKind getKind() const override { return strWeird; }
void reset() override;
int getChar() override
{ return (bufIdx >= bufSize && !fillBuf()) ? EOF : buf[bufIdx++]; }
......
......@@ -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(); }
int getChar() override { return str->getBaseStream()->getChar(); }
int lookChar() override { return str->getBaseStream()->lookChar(); }
......
......@@ -106,7 +106,7 @@ public:
Stream& operator=(const Stream &other) = delete;
// Get kind of stream.
virtual StreamKind getKind() = 0;
virtual StreamKind getKind() const = 0;
// Reset stream to beginning.
virtual void reset() = 0;
......@@ -456,7 +456,7 @@ public:
BaseStream *copy() override;
Stream *makeSubStream(Goffset startA, bool limitedA,
Goffset lengthA, Object &&dictA) override;
StreamKind getKind() override { return strFile; }
StreamKind getKind() const override { return strFile; }
void reset() override;
void close() override;
int getChar() override
......@@ -531,7 +531,7 @@ public:
BaseStream *copy() override;
Stream *makeSubStream(Goffset startA, bool limitedA,
Goffset lengthA, Object &&dictA) override;
StreamKind getKind() override { return strCachedFile; }
StreamKind getKind() const override { return strCachedFile; }
void reset() override;
void close() override;
int getChar() override
......@@ -593,7 +593,7 @@ public:
return new BaseMemStream(buf, startA, newLength, std::move(dictA));
}
StreamKind getKind() override { return strWeird; }
StreamKind getKind() const override { return strWeird; }
void reset() override {
bufPtr = buf + start;
......@@ -703,7 +703,7 @@ public:
BaseStream *copy() override;
Stream *makeSubStream(Goffset start, bool limitedA,
Goffset lengthA, Object &&dictA) override;
StreamKind getKind() override { return str->getKind(); }
StreamKind getKind() const override { return str->getKind(); }
void reset() override {}
int getChar() override;
int lookChar() override;
......@@ -744,7 +744,7 @@ public:
ASCIIHexStream(Stream *strA);
~ASCIIHexStream();
StreamKind getKind() override { return strASCIIHex; }
StreamKind getKind() const override { return strASCIIHex; }
void reset() override;
int getChar() override
{ int c = lookChar(); buf = EOF; return c; }
......@@ -767,7 +767,7 @@ public:
ASCII85Stream(Stream *strA);
~ASCII85Stream();
StreamKind getKind() override { return strASCII85; }
StreamKind getKind() const override { return strASCII85; }
void reset() override;
int getChar() override
{ int ch = lookChar(); ++index; return ch; }
......@@ -793,7 +793,7 @@ public:
LZWStream(Stream *strA, int predictor, int columns, int colors,
int bits, int earlyA);
~LZWStream();
StreamKind getKind() override { return strLZW; }
StreamKind getKind() const override { return strLZW; }
void reset() override;
int getChar() override;
int lookChar() override;
......@@ -852,7 +852,7 @@ public:
RunLengthStream(Stream *strA);
~RunLengthStream();
StreamKind getKind() override { return strRunLength; }
StreamKind getKind() const override { return strRunLength; }
void reset() override;
int getChar() override
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
......@@ -887,7 +887,7 @@ public:
bool byteAlignA, int columnsA, int rowsA,
bool endOfBlockA, bool blackA, int damagedRowsBeforeErrorA);
~CCITTFaxStream();
StreamKind getKind() override { return strCCITTFax; }
StreamKind getKind() const override { return strCCITTFax; }
void reset() override;
int getChar() override
{ int c = lookChar(); buf = EOF; return c; }
......@@ -973,7 +973,7 @@ public:
DCTStream(Stream *strA, int colorXformA, Dict *dict, int recursion);
virtual ~DCTStream();
StreamKind getKind() override { return strDCT; }
StreamKind getKind() const override { return strDCT; }
void reset() override;
void close() override;
int getChar() override;
......@@ -1081,7 +1081,7 @@ public:
FlateStream(Stream *strA, int predictor, int columns,
int colors, int bits);
~FlateStream();
StreamKind getKind() override { return strFlate; }
StreamKind getKind() const override { return strFlate; }
void reset() override;
int getChar() override;
int lookChar() override;
......@@ -1155,7 +1155,7 @@ public:
EOFStream(Stream *strA);
~EOFStream();
StreamKind getKind() override { return strWeird; }
StreamKind getKind() const override { return strWeird; }
void reset() override {}
int getChar() override { return EOF; }
int lookChar() override { return EOF; }
......@@ -1172,7 +1172,7 @@ public:
BufStream(Stream *strA, int bufSizeA);
~BufStream();
StreamKind getKind() override { return strWeird; }
StreamKind getKind() const override { return strWeird; }
void reset() override;
int getChar() override;
int lookChar() override;
......@@ -1197,7 +1197,7 @@ public:
FixedLengthEncoder(Stream *strA, int lengthA);
~FixedLengthEncoder();
StreamKind getKind() override { return strWeird; }
StreamKind getKind() const override { return strWeird; }
void reset() override;
int getChar() override;
int lookChar() override;
......@@ -1220,7 +1220,7 @@ public:
ASCIIHexEncoder(Stream *strA);
~ASCIIHexEncoder();
StreamKind getKind() override { return strWeird; }
StreamKind getKind() const override { return strWeird; }
void reset() override;
int getChar() override
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
......@@ -1250,7 +1250,7 @@ public:
ASCII85Encoder(Stream *strA);
~ASCII85Encoder();
StreamKind getKind() override { return strWeird; }
StreamKind getKind() const override { return strWeird; }
void reset() override;
int getChar() override
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
......@@ -1280,7 +1280,7 @@ public:
RunLengthEncoder(Stream *strA);
~RunLengthEncoder();
StreamKind getKind() override { return strWeird; }
StreamKind getKind() const override { return strWeird; }
void reset() override;
int getChar() override
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
......@@ -1316,7 +1316,7 @@ public:
LZWEncoder(Stream *strA);
~LZWEncoder();
StreamKind getKind() override { return strWeird; }
StreamKind getKind() const override { return strWeird; }
void reset() override;
int getChar() override;
int lookChar() override;
......@@ -1348,7 +1348,7 @@ public:
CMYKGrayEncoder(Stream *strA);
~CMYKGrayEncoder();
StreamKind getKind() override { return strWeird; }
StreamKind getKind() const override { return strWeird; }
void reset() override;
int getChar() override
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
......@@ -1377,7 +1377,7 @@ public:
RGBGrayEncoder(Stream *strA);
~RGBGrayEncoder();
StreamKind getKind() override { return strWeird; }
StreamKind getKind() const override { return strWeird; }
void reset() override;
int getChar() override
{ 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