From 1e74c03acd39c000103b843d5acd3c0313da443a Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 6 Aug 2009 19:00:25 +0000 Subject: stick DLL_EXPORT in front of every public method of every public class git-svn-id: svn+q:///qpdf/trunk@688 71b93d88-0707-0410-a8cf-f5a4172ac649 --- include/qpdf/Buffer.hh | 10 ++++++++ include/qpdf/Pipeline.hh | 8 +++++++ include/qpdf/Pl_Count.hh | 6 +++++ include/qpdf/Pl_Discard.hh | 4 ++++ include/qpdf/Pl_Flate.hh | 6 +++++ include/qpdf/Pl_StdioFile.hh | 6 +++++ include/qpdf/QEXC.hh | 16 +++++++++++++ include/qpdf/QPDF.hh | 34 ++++++++++++++++++++++++++++ include/qpdf/QPDFExc.hh | 3 +++ include/qpdf/QPDFObject.hh | 4 ++++ include/qpdf/QPDFObjectHandle.hh | 49 ++++++++++++++++++++++++++++++++++++++++ include/qpdf/QPDFTokenizer.hh | 16 +++++++++++++ include/qpdf/QPDFWriter.hh | 15 ++++++++++++ include/qpdf/QPDFXRefEntry.hh | 8 +++++++ include/qpdf/QTC.hh | 3 +++ include/qpdf/QUtil.hh | 11 +++++++++ 16 files changed, 199 insertions(+) (limited to 'include') diff --git a/include/qpdf/Buffer.hh b/include/qpdf/Buffer.hh index a7a7ceae..c4f03768 100644 --- a/include/qpdf/Buffer.hh +++ b/include/qpdf/Buffer.hh @@ -8,16 +8,26 @@ #ifndef __BUFFER_HH__ #define __BUFFER_HH__ +#include + class Buffer { public: + DLL_EXPORT Buffer(); + DLL_EXPORT Buffer(unsigned long size); + DLL_EXPORT Buffer(Buffer const&); + DLL_EXPORT Buffer& operator=(Buffer const&); + DLL_EXPORT ~Buffer(); + DLL_EXPORT unsigned long getSize() const; + DLL_EXPORT unsigned char const* getBuffer() const; + DLL_EXPORT unsigned char* getBuffer(); private: diff --git a/include/qpdf/Pipeline.hh b/include/qpdf/Pipeline.hh index d925d9c6..358bcb03 100644 --- a/include/qpdf/Pipeline.hh +++ b/include/qpdf/Pipeline.hh @@ -30,6 +30,8 @@ #ifndef __PIPELINE_HH__ #define __PIPELINE_HH__ +#include + #include class Pipeline @@ -38,24 +40,30 @@ class Pipeline class Exception: public QEXC::General { public: + DLL_EXPORT Exception(std::string const& message) : QEXC::General(message) { } + DLL_EXPORT virtual ~Exception() throw() { } }; + DLL_EXPORT Pipeline(char const* identifier, Pipeline* next); + DLL_EXPORT virtual ~Pipeline(); // Subclasses should implement write and finish to do their jobs // and then, if they are not end-of-line pipelines, call // getNext()->write or getNext()->finish. + DLL_EXPORT virtual void write(unsigned char* data, int len) = 0; + DLL_EXPORT virtual void finish() = 0; protected: diff --git a/include/qpdf/Pl_Count.hh b/include/qpdf/Pl_Count.hh index 952447e9..1fd4c94a 100644 --- a/include/qpdf/Pl_Count.hh +++ b/include/qpdf/Pl_Count.hh @@ -16,14 +16,20 @@ class Pl_Count: public Pipeline { public: + DLL_EXPORT Pl_Count(char const* identifier, Pipeline* next); + DLL_EXPORT virtual ~Pl_Count(); + DLL_EXPORT virtual void write(unsigned char*, int); + DLL_EXPORT virtual void finish(); // Returns the number of bytes written + DLL_EXPORT int getCount() const; // Returns the last character written, or '\0' if no characters // have been written (in which case getCount() returns 0) + DLL_EXPORT unsigned char getLastChar() const; private: diff --git a/include/qpdf/Pl_Discard.hh b/include/qpdf/Pl_Discard.hh index 57bc491c..f99112b2 100644 --- a/include/qpdf/Pl_Discard.hh +++ b/include/qpdf/Pl_Discard.hh @@ -19,9 +19,13 @@ class Pl_Discard: public Pipeline { public: + DLL_EXPORT Pl_Discard(); + DLL_EXPORT virtual ~Pl_Discard(); + DLL_EXPORT virtual void write(unsigned char*, int); + DLL_EXPORT virtual void finish(); }; diff --git a/include/qpdf/Pl_Flate.hh b/include/qpdf/Pl_Flate.hh index f9181319..60b3fd8a 100644 --- a/include/qpdf/Pl_Flate.hh +++ b/include/qpdf/Pl_Flate.hh @@ -18,11 +18,13 @@ class Pl_Flate: public Pipeline class Exception: public Pipeline::Exception { public: + DLL_EXPORT Exception(std::string const& message) : Pipeline::Exception(message) { } + DLL_EXPORT virtual ~Exception() throw () { } @@ -32,11 +34,15 @@ class Pl_Flate: public Pipeline enum action_e { a_inflate, a_deflate }; + DLL_EXPORT Pl_Flate(char const* identifier, Pipeline* next, action_e action, int out_bufsize = def_bufsize); + DLL_EXPORT virtual ~Pl_Flate(); + DLL_EXPORT virtual void write(unsigned char* data, int len); + DLL_EXPORT virtual void finish(); private: diff --git a/include/qpdf/Pl_StdioFile.hh b/include/qpdf/Pl_StdioFile.hh index 04e5d7d1..84324d54 100644 --- a/include/qpdf/Pl_StdioFile.hh +++ b/include/qpdf/Pl_StdioFile.hh @@ -24,11 +24,13 @@ class Pl_StdioFile: public Pipeline class Exception: public Pipeline::Exception { public: + DLL_EXPORT Exception(std::string const& message) : Pipeline::Exception(message) { } + DLL_EXPORT virtual ~Exception() throw () { } @@ -36,10 +38,14 @@ class Pl_StdioFile: public Pipeline // f is externally maintained; this class just writes to and // flushes it. It does not close it. + DLL_EXPORT Pl_StdioFile(char const* identifier, FILE* f); + DLL_EXPORT virtual ~Pl_StdioFile(); + DLL_EXPORT virtual void write(unsigned char* buf, int len); + DLL_EXPORT virtual void finish(); private: diff --git a/include/qpdf/QEXC.hh b/include/qpdf/QEXC.hh index 314b084b..49be72a8 100644 --- a/include/qpdf/QEXC.hh +++ b/include/qpdf/QEXC.hh @@ -8,6 +8,8 @@ #ifndef __QEXC_HH__ #define __QEXC_HH__ +#include + #include #include #include @@ -69,13 +71,19 @@ namespace QEXC // Application/library code should not generally catch this // directly. See above for caveats. public: + DLL_EXPORT Base(); + DLL_EXPORT Base(std::string const& message); + DLL_EXPORT virtual ~Base() throw() {} + DLL_EXPORT virtual std::string const& unparse() const; + DLL_EXPORT virtual const char* what() const throw(); protected: + DLL_EXPORT void setMessage(std::string const& message); private: @@ -87,8 +95,11 @@ namespace QEXC // This is the base class for normal user/library-defined // error conditions. public: + DLL_EXPORT General(); + DLL_EXPORT General(std::string const& message); + DLL_EXPORT virtual ~General() throw() {}; }; @@ -100,15 +111,20 @@ namespace QEXC class Internal: public Base { public: + DLL_EXPORT Internal(std::string const& message); + DLL_EXPORT virtual ~Internal() throw() {}; }; class System: public General { public: + DLL_EXPORT System(std::string const& prefix, int sys_errno); + DLL_EXPORT virtual ~System() throw() {}; + DLL_EXPORT int getErrno() const; private: diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index 5868268b..400328d7 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -13,6 +13,8 @@ #include #include +#include + #include #include #include @@ -26,7 +28,9 @@ class QPDFExc; class QPDF { public: + DLL_EXPORT QPDF(); + DLL_EXPORT ~QPDF(); // Associate a file with a QPDF object and do initial parsing of @@ -36,6 +40,7 @@ class QPDF // potentially ask for information about the PDF file are called. // Prior to calling this, the only methods that are allowed are // those that set parameters. + DLL_EXPORT void processFile(char const* filename, char const* password = ""); // Parameter settings @@ -44,18 +49,21 @@ class QPDF // (one that contains both cross-reference streams and // cross-reference tables). This can be useful for testing to // ensure that a hybrid file would work with an older reader. + DLL_EXPORT void setIgnoreXRefStreams(bool); // By default, any warnings are issued to stderr as they are // encountered. If this is called with a true value, reporting of // warnings is suppressed. You may still retrieve warnings by // calling getWarnings. + DLL_EXPORT void setSuppressWarnings(bool); // By default, QPDF will try to recover if it finds certain types // of errors in PDF files. If turned off, it will throw an // exception on the first such problem it finds without attempting // recovery. + DLL_EXPORT void setAttemptRecovery(bool); // Other public methods @@ -65,19 +73,26 @@ class QPDF // throws an exception. Note that if setSuppressWarnings was not // called or was called with a false value, any warnings retrieved // here will have already been issued to stderr. + DLL_EXPORT std::vector getWarnings(); + DLL_EXPORT std::string getFilename() const; + DLL_EXPORT std::string getPDFVersion() const; + DLL_EXPORT QPDFObjectHandle getTrailer(); + DLL_EXPORT QPDFObjectHandle getRoot(); // Install this object handle as an indirect object and return an // indirect reference to it. + DLL_EXPORT QPDFObjectHandle makeIndirectObject(QPDFObjectHandle); // Retrieve an object by object ID and generation. Returns an // indirect reference to it. + DLL_EXPORT QPDFObjectHandle getObjectByID(int objid, int generation); // Encryption support @@ -85,6 +100,7 @@ class QPDF struct EncryptionData { // This class holds data read from the encryption dictionary. + DLL_EXPORT EncryptionData(int V, int R, int Length_bytes, int P, std::string const& O, std::string const& U, std::string const& id1) : @@ -107,28 +123,35 @@ class QPDF std::string id1; }; + DLL_EXPORT static void trim_user_password(std::string& user_password); + DLL_EXPORT static std::string compute_data_key( std::string const& encryption_key, int objid, int generation); + DLL_EXPORT static std::string compute_encryption_key( std::string const& password, EncryptionData const& data); + DLL_EXPORT static void compute_encryption_O_U( char const* user_password, char const* owner_password, int V, int R, int key_len, int P, std::string const& id1, std::string& O, std::string& U); + DLL_EXPORT std::string const& getUserPassword() const; // Linearization support // Returns true iff the file starts with a linearization parameter // dictionary. Does no additional validation. + DLL_EXPORT bool isLinearized(); // Performs various sanity checks on a linearized file. Return // true if no errors or warnings. Otherwise, return false and // output errors and warnings to stdout. + DLL_EXPORT bool checkLinearization(); // Calls checkLinearization() and, if possible, prints normalized @@ -136,9 +159,11 @@ class QPDF // includes adding min values to delta values and adjusting // offsets based on the location and size of the primary hint // stream. + DLL_EXPORT void showLinearizationData(); // Shows the contents of the cross-reference table + DLL_EXPORT void showXRefTable(); // Optimization support -- see doc/optimization. Implemented in @@ -152,26 +177,31 @@ class QPDF // This is available so that the test suite can make sure that a // linearized file is already optimized. When called in this way, // optimize() still populates the object <-> user maps + DLL_EXPORT void optimize(std::map const& object_stream_data, bool allow_changes = true); // Replace all references to indirect objects that are "scalars" // (i.e., things that don't have children: not arrays, streams, or // dictionaries) with direct objects. + DLL_EXPORT void flattenScalarReferences(); // Decode all streams, discarding the output. Used to check // correctness of stream encoding. + DLL_EXPORT void decodeStreams(); // For QPDFWriter: // Remove /ID, /Encrypt, and /Prev keys from the trailer // dictionary since these are regenerated during write. + DLL_EXPORT void trimTrailerForWrite(); // Get lists of all objects in order according to the part of a // linearized file that they belong to. + DLL_EXPORT void getLinearizedParts( std::map const& object_stream_data, std::vector& part4, @@ -180,6 +210,7 @@ class QPDF std::vector& part8, std::vector& part9); + DLL_EXPORT void generateHintStream(std::map const& xref, std::map const& lengths, std::map const& obj_renumber, @@ -187,15 +218,18 @@ class QPDF int& S, int& O); // Map object to object stream that contains it + DLL_EXPORT void getObjectStreamData(std::map&); // Get a list of objects that would be permitted in an object // stream + DLL_EXPORT std::vector getCompressibleObjects(); // Convenience routines for common functions. See also // QPDFObjectHandle.hh for additional convenience routines. // Traverse page tree return all /Page objects. + DLL_EXPORT std::vector const& getAllPages(); // Resolver class is restricted to QPDFObjectHandle so that only diff --git a/include/qpdf/QPDFExc.hh b/include/qpdf/QPDFExc.hh index 262a6a69..81e62cfd 100644 --- a/include/qpdf/QPDFExc.hh +++ b/include/qpdf/QPDFExc.hh @@ -13,9 +13,12 @@ class QPDFExc: public QEXC::General { public: + DLL_EXPORT QPDFExc(std::string const& message); + DLL_EXPORT QPDFExc(std::string const& filename, int offset, std::string const& message); + DLL_EXPORT virtual ~QPDFExc() throw (); }; diff --git a/include/qpdf/QPDFObject.hh b/include/qpdf/QPDFObject.hh index e6c78017..22c400a5 100644 --- a/include/qpdf/QPDFObject.hh +++ b/include/qpdf/QPDFObject.hh @@ -8,12 +8,16 @@ #ifndef __QPDFOBJECT_HH__ #define __QPDFOBJECT_HH__ +#include + #include class QPDFObject { public: + DLL_EXPORT virtual ~QPDFObject() {} + DLL_EXPORT virtual std::string unparse() = 0; }; diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index f6889925..b9aeaf59 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -13,6 +13,8 @@ #include #include +#include + #include #include @@ -24,37 +26,58 @@ class QPDF; class QPDFObjectHandle { public: + DLL_EXPORT QPDFObjectHandle(); + DLL_EXPORT bool isInitialized() const; // Exactly one of these will return true for any object. + DLL_EXPORT bool isBool(); + DLL_EXPORT bool isNull(); + DLL_EXPORT bool isInteger(); + DLL_EXPORT bool isReal(); + DLL_EXPORT bool isName(); + DLL_EXPORT bool isString(); + DLL_EXPORT bool isArray(); + DLL_EXPORT bool isDictionary(); + DLL_EXPORT bool isStream(); // This returns true in addition to the query for the specific // type for indirect objects. + DLL_EXPORT bool isIndirect(); // True for everything except array, dictionary, and stream + DLL_EXPORT bool isScalar(); // Public factory methods + DLL_EXPORT static QPDFObjectHandle newNull(); + DLL_EXPORT static QPDFObjectHandle newBool(bool value); + DLL_EXPORT static QPDFObjectHandle newInteger(int value); + DLL_EXPORT static QPDFObjectHandle newReal(std::string const& value); + DLL_EXPORT static QPDFObjectHandle newName(std::string const& name); + DLL_EXPORT static QPDFObjectHandle newString(std::string const& str); + DLL_EXPORT static QPDFObjectHandle newArray( std::vector const& items); + DLL_EXPORT static QPDFObjectHandle newDictionary( std::map const& items); @@ -63,55 +86,74 @@ class QPDFObjectHandle // type, an exception is thrown. // Methods for bool objects + DLL_EXPORT bool getBoolValue(); // Methods for integer objects + DLL_EXPORT int getIntValue(); // Methods for real objects + DLL_EXPORT std::string getRealValue(); // Methods that work for both integer and real objects + DLL_EXPORT bool isNumber(); + DLL_EXPORT double getNumericValue(); // Methods for name objects + DLL_EXPORT std::string getName(); // Methods for string objects + DLL_EXPORT std::string getStringValue(); + DLL_EXPORT std::string getUTF8Value(); // Methods for array objects + DLL_EXPORT int getArrayNItems(); + DLL_EXPORT QPDFObjectHandle getArrayItem(int n); // Methods for dictionary objects + DLL_EXPORT bool hasKey(std::string const&); + DLL_EXPORT QPDFObjectHandle getKey(std::string const&); + DLL_EXPORT std::set getKeys(); // Mutator methods. Use with caution. // Recursively copy this object, making it direct. Throws an // exception if a loop is detected or any sub-object is a stream. + DLL_EXPORT void makeDirect(); // Mutator methods for array objects + DLL_EXPORT void setArrayItem(int, QPDFObjectHandle const&); // Mutator methods for dictionary objects // Replace value of key, adding it if it does not exist + DLL_EXPORT void replaceKey(std::string const& key, QPDFObjectHandle const&); // Remove key, doing nothing if key does not exist + DLL_EXPORT void removeKey(std::string const& key); // Methods for stream objects + DLL_EXPORT QPDFObjectHandle getDict(); // Returns filtered (uncompressed) stream data. Throws an // exception if the stream is filtered and we can't decode it. + DLL_EXPORT PointerHolder getStreamData(); // Write stream data through the given pipeline. A null pipeline @@ -131,14 +173,19 @@ class QPDFObjectHandle // value of this function to determine whether or not the /Filter // and /DecodeParms keys in the stream dictionary should be // replaced if writing a new stream object. + DLL_EXPORT bool pipeStreamData(Pipeline*, bool filter, bool normalize, bool compress); // return 0 for direct objects + DLL_EXPORT int getObjectID() const; + DLL_EXPORT int getGeneration() const; + DLL_EXPORT std::string unparse(); + DLL_EXPORT std::string unparseResolved(); // Convenience routines for commonly performed functions @@ -148,6 +195,7 @@ class QPDFObjectHandle // function does not presently support inherited resources. See // comment in the source for details. Return value is a map from // XObject name to the image object, which is always a stream. + DLL_EXPORT std::map getPageImages(); // Throws an exception if this is not a Page object. Returns a @@ -155,6 +203,7 @@ class QPDFObjectHandle // the given page. This routine allows the caller to not care // whether there are one or more than one content streams for a // page. + DLL_EXPORT std::vector getPageContents(); // Initializers for objects. This Factory class gives the QPDF diff --git a/include/qpdf/QPDFTokenizer.hh b/include/qpdf/QPDFTokenizer.hh index ec2a971f..17885469 100644 --- a/include/qpdf/QPDFTokenizer.hh +++ b/include/qpdf/QPDFTokenizer.hh @@ -8,6 +8,8 @@ #ifndef __QPDFTOKENIZER_HH__ #define __QPDFTOKENIZER_HH__ +#include + #include #include @@ -35,14 +37,17 @@ class QPDFTokenizer class Token { public: + DLL_EXPORT Token() : type(tt_bad) {} + DLL_EXPORT Token(token_type_e type, std::string const& value) : type(type), value(value) { } + DLL_EXPORT Token(token_type_e type, std::string const& value, std::string raw_value, std::string error_message) : type(type), @@ -51,22 +56,27 @@ class QPDFTokenizer error_message(error_message) { } + DLL_EXPORT token_type_e getType() const { return this->type; } + DLL_EXPORT std::string const& getValue() const { return this->value; } + DLL_EXPORT std::string const& getRawValue() const { return this->raw_value; } + DLL_EXPORT std::string const& getErrorMessage() const { return this->error_message; } + DLL_EXPORT bool operator==(Token const& rhs) { // Ignore fields other than type and value @@ -82,6 +92,7 @@ class QPDFTokenizer std::string error_message; }; + DLL_EXPORT QPDFTokenizer(); // PDF files with version < 1.2 allowed the pound character @@ -89,6 +100,7 @@ class QPDFTokenizer // character was allowed only when followed by two hexadecimal // digits. This method should be called when parsing a PDF file // whose version is older than 1.2. + DLL_EXPORT void allowPoundAnywhereInName(); // Mode of operation: @@ -99,19 +111,23 @@ class QPDFTokenizer // It these are called when a token is available, an exception // will be thrown. + DLL_EXPORT void presentCharacter(char ch); + DLL_EXPORT void presentEOF(); // If a token is available, return true and initialize token with // the token, unread_char with whether or not we have to unread // the last character, and if unread_char, ch with the character // to unread. + DLL_EXPORT bool getToken(Token& token, bool& unread_char, char& ch); // This function returns true of the current character is between // tokens (i.e., white space that is not part of a string) or is // part of a comment. A tokenizing filter can call this to // determine whether to output the character. + DLL_EXPORT bool betweenTokens(); private: diff --git a/include/qpdf/QPDFWriter.hh b/include/qpdf/QPDFWriter.hh index c354ec30..7d62e476 100644 --- a/include/qpdf/QPDFWriter.hh +++ b/include/qpdf/QPDFWriter.hh @@ -19,6 +19,8 @@ #include #include +#include + #include #include @@ -33,7 +35,9 @@ class QPDFWriter { public: // Passing null as filename means write to stdout + DLL_EXPORT QPDFWriter(QPDF& pdf, char const* filename); + DLL_EXPORT ~QPDFWriter(); // Set the value of object stream mode. In disable mode, we never @@ -44,6 +48,7 @@ class QPDFWriter // object streams and a cross-reference stream if there are object // streams. The default is o_preserve. enum object_stream_e { o_disable, o_preserve, o_generate }; + DLL_EXPORT void setObjectStreamMode(object_stream_e); // Set value of stream data mode. In uncompress mode, we attempt @@ -52,6 +57,7 @@ class QPDFWriter // if we can apply all filters and the stream is not already // optimally compressed, recompress the stream. enum stream_data_e { s_uncompress, s_preserve, s_compress }; + DLL_EXPORT void setStreamDataMode(stream_data_e); // Set value of content stream normalization. The default is @@ -61,6 +67,7 @@ class QPDFWriter // damage the content stream. This flag should be used only for // debugging and experimenting with PDF content streams. Never // use it for production files. + DLL_EXPORT void setContentNormalization(bool); // Set QDF mode. QDF mode causes special "pretty printing" of @@ -68,22 +75,26 @@ class QPDFWriter // Resulting PDF files can be edited in a text editor and then run // through fix-qdf to update cross reference tables and stream // lengths. + DLL_EXPORT void setQDFMode(bool); // Cause a static /ID value to be generated. Use only in test // suites. + DLL_EXPORT void setStaticID(bool); // Suppress inclusion of comments indicating original object IDs // when writing QDF files. This can also be useful for testing, // particularly when using comparison of two qdf files to // determine whether two PDF files have identical content. + DLL_EXPORT void setSuppressOriginalObjectIDs(bool); // Preserve encryption. The default is true unless prefilering, // content normalization, or qdf mode has been selected in which // case encryption is never preserved. Encryption is also not // preserved if we explicitly set encryption parameters. + DLL_EXPORT void setPreserveEncryption(bool); // Set up for encrypted output. Disables stream prefiltering and @@ -91,6 +102,7 @@ class QPDFWriter // parameters sets the PDF version to at least 1.3, and setting R3 // encryption parameters pushes the PDF version number to at least // 1.4. + DLL_EXPORT void setR2EncryptionParameters( char const* user_password, char const* owner_password, bool allow_print, bool allow_modify, @@ -109,6 +121,7 @@ class QPDFWriter r3m_assembly, // allow only document assembly r3m_none // allow no modification }; + DLL_EXPORT void setR3EncryptionParameters( char const* user_password, char const* owner_password, bool allow_accessibility, bool allow_extract, @@ -116,8 +129,10 @@ class QPDFWriter // Create linearized output. Disables qdf mode, content // normalization, and stream prefiltering. + DLL_EXPORT void setLinearization(bool); + DLL_EXPORT void write(); private: diff --git a/include/qpdf/QPDFXRefEntry.hh b/include/qpdf/QPDFXRefEntry.hh index 83d44770..26a047b2 100644 --- a/include/qpdf/QPDFXRefEntry.hh +++ b/include/qpdf/QPDFXRefEntry.hh @@ -8,6 +8,8 @@ #ifndef __QPDFXREFENTRY_HH__ #define __QPDFXREFENTRY_HH__ +#include + class QPDFXRefEntry { public: @@ -17,12 +19,18 @@ class QPDFXRefEntry // 1 = "uncompressed"; field 1 = offset // 2 = "compressed"; field 1 = object stream number, field 2 = index + DLL_EXPORT QPDFXRefEntry(); + DLL_EXPORT QPDFXRefEntry(int type, int field1, int field2); + DLL_EXPORT int getType() const; + DLL_EXPORT int getOffset() const; // only for type 1 + DLL_EXPORT int getObjStreamNumber() const; // only for type 2 + DLL_EXPORT int getObjStreamIndex() const; // only for type 2 private: diff --git a/include/qpdf/QTC.hh b/include/qpdf/QTC.hh index b9ed7f93..6e7e4a90 100644 --- a/include/qpdf/QTC.hh +++ b/include/qpdf/QTC.hh @@ -8,8 +8,11 @@ #ifndef __QTC_HH__ #define __QTC_HH__ +#include + namespace QTC { + DLL_EXPORT void TC(char const* const scope, char const* const ccase, int n = 0); }; diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh index a70db0bd..1d2b2b1b 100644 --- a/include/qpdf/QUtil.hh +++ b/include/qpdf/QUtil.hh @@ -19,35 +19,46 @@ namespace QUtil { // This is a collection of useful utility functions that don't // really go anywhere else. + DLL_EXPORT std::string int_to_string(int, int length = 0); + DLL_EXPORT std::string double_to_string(double, int decimal_places = 0); // If status is -1, convert the current value of errno to a // QEXC::System exception. Otherwise, return status. + DLL_EXPORT int os_wrapper(std::string const& description, int status) throw (QEXC::System); + DLL_EXPORT FILE* fopen_wrapper(std::string const&, FILE*) throw (QEXC::System); + DLL_EXPORT char* copy_string(std::string const&); // Set stdin, stdout to binary mode + DLL_EXPORT void binary_stdout(); + DLL_EXPORT void binary_stdin(); // May modify argv0 + DLL_EXPORT char* getWhoami(char* argv0); // Get the value of an environment variable in a portable fashion. // Returns true iff the variable is defined. If `value' is // non-null, initializes it with the value of the variable. + DLL_EXPORT bool get_env(std::string const& var, std::string* value = 0); + DLL_EXPORT time_t get_current_time(); // Return a string containing the byte representation of the UTF-8 // encoding for the unicode value passed in. + DLL_EXPORT std::string toUTF8(unsigned long uval); }; -- cgit v1.2.3-54-g00ecf