//
// XRef.h
//
-// Copyright 1996-2002 Glyph & Cog, LLC
+// Copyright 1996-2003 Glyph & Cog, LLC
//
//========================================================================
#ifndef XREF_H
#define XREF_H
-#ifdef __GNUC__
+#include <aconf.h>
+
+#ifdef USE_GCC_PRAGMAS
#pragma interface
#endif
class Dict;
class Stream;
+class Parser;
+class ObjectStream;
//------------------------------------------------------------------------
// XRef
//------------------------------------------------------------------------
+enum XRefEntryType {
+ xrefEntryFree,
+ xrefEntryUncompressed,
+ xrefEntryCompressed
+};
+
struct XRefEntry {
Guint offset;
int gen;
- GBool used;
+ XRefEntryType type;
};
class XRef {
// Returns false if unknown or file is not damaged.
GBool getStreamEnd(Guint streamStart, Guint *streamEnd);
+ // Direct access.
+ int getSize() { return size; }
+ XRefEntry *getEntry(int i) { return &entries[i]; }
+ Object *getTrailerDict() { return &trailerDict; }
+
private:
BaseStream *str; // input stream
Guint *streamEnds; // 'endstream' positions - only used in
// damaged files
int streamEndsLen; // number of valid entries in streamEnds
+ ObjectStream *objStr; // cached object stream
#ifndef NO_DECRYPTION
GBool encrypted; // true if file is encrypted
int encVersion; // encryption algorithm
GBool ownerPasswordOk; // true if owner password is correct
#endif
- Guint readTrailer();
+ Guint getStartXref();
GBool readXRef(Guint *pos);
+ GBool readXRefTable(Parser *parser, Guint *pos);
+ GBool readXRefStreamSection(Stream *xrefStr, int *w, int first, int n);
+ GBool readXRefStream(Stream *xrefStr, Guint *pos);
GBool constructXRef();
GBool checkEncrypted(GString *ownerPassword, GString *userPassword);
Guint strToUnsigned(char *s);