Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-10 10:23:49

0001 //========================================================================
0002 //
0003 // Parser.h
0004 //
0005 // Copyright 1996-2003 Glyph & Cog, LLC
0006 //
0007 //========================================================================
0008 
0009 //========================================================================
0010 //
0011 // Modified under the Poppler project - http://poppler.freedesktop.org
0012 //
0013 // All changes made under the Poppler project to this file are licensed
0014 // under GPL version 2 or later
0015 //
0016 // Copyright (C) 2006, 2010, 2013, 2017, 2018, 2020 Albert Astals Cid <aacid@kde.org>
0017 // Copyright (C) 2012 Hib Eris <hib@hiberis.nl>
0018 // Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com>
0019 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
0020 // Copyright (C) 2019 Adam Reichold <adam.reichold@t-online.de>
0021 //
0022 // To see a description of the changes please see the Changelog file that
0023 // came with your tarball or type make ChangeLog if you are building from git
0024 //
0025 //========================================================================
0026 
0027 #ifndef PARSER_H
0028 #define PARSER_H
0029 
0030 #include "Lexer.h"
0031 
0032 //------------------------------------------------------------------------
0033 // Parser
0034 //------------------------------------------------------------------------
0035 
0036 class POPPLER_PRIVATE_EXPORT Parser
0037 {
0038 public:
0039     // Constructor.
0040     Parser(XRef *xrefA, Stream *streamA, bool allowStreamsA);
0041     Parser(XRef *xrefA, Object *objectA, bool allowStreamsA);
0042 
0043     // Destructor.
0044     ~Parser();
0045 
0046     Parser(const Parser &) = delete;
0047     Parser &operator=(const Parser &) = delete;
0048 
0049     // Get the next object from the input stream.  If <simpleOnly> is
0050     // true, do not parse compound objects (arrays, dictionaries, or
0051     // streams).
0052     Object getObj(bool simpleOnly = false, const unsigned char *fileKey = nullptr, CryptAlgorithm encAlgorithm = cryptRC4, int keyLength = 0, int objNum = 0, int objGen = 0, int recursion = 0, bool strict = false,
0053                   bool decryptString = true);
0054 
0055     Object getObj(int recursion);
0056     template<typename T>
0057     Object getObj(T) = delete;
0058 
0059     // Get stream.
0060     Stream *getStream() { return lexer.getStream(); }
0061 
0062     // Get current position in file.
0063     Goffset getPos() { return lexer.getPos(); }
0064 
0065 private:
0066     Lexer lexer; // input stream
0067     bool allowStreams; // parse stream objects?
0068     Object buf1, buf2; // next two tokens
0069     int inlineImg; // set when inline image data is encountered
0070 
0071     Stream *makeStream(Object &&dict, const unsigned char *fileKey, CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen, int recursion, bool strict);
0072     void shift(int objNum = -1);
0073     void shift(const char *cmdA, int objNum);
0074 };
0075 
0076 #endif