Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-11 10:26:09

0001 //========================================================================
0002 //
0003 // FoFiBase.h
0004 //
0005 // Copyright 1999-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) 2018, 2022 Albert Astals Cid <aacid@kde.org>
0017 // Copyright (C) 2022 Oliver Sander <oliver.sander@tu-dresden.de>
0018 //
0019 // To see a description of the changes please see the Changelog file that
0020 // came with your tarball or type make ChangeLog if you are building from git
0021 //
0022 //========================================================================
0023 
0024 #ifndef FOFIBASE_H
0025 #define FOFIBASE_H
0026 
0027 //------------------------------------------------------------------------
0028 
0029 using FoFiOutputFunc = void (*)(void *stream, const char *data, size_t len);
0030 
0031 //------------------------------------------------------------------------
0032 // FoFiBase
0033 //------------------------------------------------------------------------
0034 
0035 class POPPLER_PRIVATE_EXPORT FoFiBase
0036 {
0037 public:
0038     FoFiBase(const FoFiBase &) = delete;
0039     FoFiBase &operator=(const FoFiBase &other) = delete;
0040 
0041     virtual ~FoFiBase();
0042 
0043 protected:
0044     FoFiBase(const unsigned char *fileA, int lenA, bool freeFileDataA);
0045     static char *readFile(const char *fileName, int *fileLen);
0046 
0047     // S = signed / U = unsigned
0048     // 8/16/32/Var = word length, in bytes
0049     // BE = big endian
0050     int getS8(int pos, bool *ok) const;
0051     int getU8(int pos, bool *ok) const;
0052     int getS16BE(int pos, bool *ok) const;
0053     int getU16BE(int pos, bool *ok) const;
0054     int getS32BE(int pos, bool *ok) const;
0055     unsigned int getU32BE(int pos, bool *ok) const;
0056     unsigned int getU32LE(int pos, bool *ok) const;
0057     unsigned int getUVarBE(int pos, int size, bool *ok) const;
0058 
0059     bool checkRegion(int pos, int size) const;
0060 
0061     const unsigned char *file;
0062     int len;
0063     bool freeFileData;
0064 };
0065 
0066 #endif