From 27ee889c0e74e84035c2c208c856729a16d866c7 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Wed, 21 Oct 2009 01:45:13 +0000 Subject: tweak dll stuff again git-svn-id: svn+q:///qpdf/trunk@851 71b93d88-0707-0410-a8cf-f5a4172ac649 --- include/qpdf/Buffer.hh | 16 +++---- include/qpdf/DLL.h | 6 +-- include/qpdf/Pipeline.hh | 9 ++-- include/qpdf/Pl_Buffer.hh | 10 ++--- include/qpdf/Pl_Count.hh | 12 ++--- include/qpdf/Pl_Discard.hh | 8 ++-- include/qpdf/Pl_Flate.hh | 8 ++-- include/qpdf/Pl_StdioFile.hh | 8 ++-- include/qpdf/QPDF.hh | 86 +++++++++++++++++------------------ include/qpdf/QPDFExc.hh | 14 +++--- include/qpdf/QPDFObjectHandle.hh | 96 ++++++++++++++++++++-------------------- include/qpdf/QPDFTokenizer.hh | 12 ++--- include/qpdf/QPDFWriter.hh | 37 +++++++--------- include/qpdf/QPDFXRefEntry.hh | 12 ++--- include/qpdf/QTC.hh | 2 +- include/qpdf/QUtil.hh | 24 +++++----- include/qpdf/qpdf-c.h | 86 +++++++++++++++++------------------ 17 files changed, 221 insertions(+), 225 deletions(-) (limited to 'include') diff --git a/include/qpdf/Buffer.hh b/include/qpdf/Buffer.hh index bcc210c4..2777f18d 100644 --- a/include/qpdf/Buffer.hh +++ b/include/qpdf/Buffer.hh @@ -13,21 +13,21 @@ class Buffer { public: - DLL_EXPORT + QPDF_DLL Buffer(); - DLL_EXPORT + QPDF_DLL Buffer(unsigned long size); - DLL_EXPORT + QPDF_DLL Buffer(Buffer const&); - DLL_EXPORT + QPDF_DLL Buffer& operator=(Buffer const&); - DLL_EXPORT + QPDF_DLL ~Buffer(); - DLL_EXPORT + QPDF_DLL unsigned long getSize() const; - DLL_EXPORT + QPDF_DLL unsigned char const* getBuffer() const; - DLL_EXPORT + QPDF_DLL unsigned char* getBuffer(); private: diff --git a/include/qpdf/DLL.h b/include/qpdf/DLL.h index b0c465a3..9e900d55 100644 --- a/include/qpdf/DLL.h +++ b/include/qpdf/DLL.h @@ -1,10 +1,10 @@ #ifndef __QPDF_DLL_HH__ #define __QPDF_DLL_HH__ -#ifdef _WIN32 -# define DLL_EXPORT __declspec(dllexport) +#if defined(_WIN32) && defined(DLL_EXPORT) +# define QPDF_DLL __declspec(dllexport) #else -# define DLL_EXPORT +# define QPDF_DLL #endif #endif /* __QPDF_DLL_HH__ */ diff --git a/include/qpdf/Pipeline.hh b/include/qpdf/Pipeline.hh index 7e248c1c..6f933f0b 100644 --- a/include/qpdf/Pipeline.hh +++ b/include/qpdf/Pipeline.hh @@ -36,22 +36,21 @@ class Pipeline { public: - DLL_EXPORT + QPDF_DLL Pipeline(char const* identifier, Pipeline* next); - DLL_EXPORT + QPDF_DLL 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 + QPDF_DLL virtual void write(unsigned char* data, int len) = 0; - DLL_EXPORT + QPDF_DLL virtual void finish() = 0; protected: - DLL_EXPORT Pipeline* getNext(bool allow_null = false); std::string identifier; diff --git a/include/qpdf/Pl_Buffer.hh b/include/qpdf/Pl_Buffer.hh index 1e0bd8ac..3b3973e4 100644 --- a/include/qpdf/Pl_Buffer.hh +++ b/include/qpdf/Pl_Buffer.hh @@ -27,19 +27,19 @@ class Pl_Buffer: public Pipeline { public: - DLL_EXPORT + QPDF_DLL Pl_Buffer(char const* identifier, Pipeline* next = 0); - DLL_EXPORT + QPDF_DLL virtual ~Pl_Buffer(); - DLL_EXPORT + QPDF_DLL virtual void write(unsigned char*, int); - DLL_EXPORT + QPDF_DLL virtual void finish(); // Each call to getBuffer() resets this object -- see notes above. // The caller is responsible for deleting the returned Buffer // object. - DLL_EXPORT + QPDF_DLL Buffer* getBuffer(); private: diff --git a/include/qpdf/Pl_Count.hh b/include/qpdf/Pl_Count.hh index 1fd4c94a..a50cc5bc 100644 --- a/include/qpdf/Pl_Count.hh +++ b/include/qpdf/Pl_Count.hh @@ -16,20 +16,20 @@ class Pl_Count: public Pipeline { public: - DLL_EXPORT + QPDF_DLL Pl_Count(char const* identifier, Pipeline* next); - DLL_EXPORT + QPDF_DLL virtual ~Pl_Count(); - DLL_EXPORT + QPDF_DLL virtual void write(unsigned char*, int); - DLL_EXPORT + QPDF_DLL virtual void finish(); // Returns the number of bytes written - DLL_EXPORT + QPDF_DLL int getCount() const; // Returns the last character written, or '\0' if no characters // have been written (in which case getCount() returns 0) - DLL_EXPORT + QPDF_DLL unsigned char getLastChar() const; private: diff --git a/include/qpdf/Pl_Discard.hh b/include/qpdf/Pl_Discard.hh index f99112b2..389d0300 100644 --- a/include/qpdf/Pl_Discard.hh +++ b/include/qpdf/Pl_Discard.hh @@ -19,13 +19,13 @@ class Pl_Discard: public Pipeline { public: - DLL_EXPORT + QPDF_DLL Pl_Discard(); - DLL_EXPORT + QPDF_DLL virtual ~Pl_Discard(); - DLL_EXPORT + QPDF_DLL virtual void write(unsigned char*, int); - DLL_EXPORT + QPDF_DLL virtual void finish(); }; diff --git a/include/qpdf/Pl_Flate.hh b/include/qpdf/Pl_Flate.hh index 286d80e8..8d4e7bd6 100644 --- a/include/qpdf/Pl_Flate.hh +++ b/include/qpdf/Pl_Flate.hh @@ -19,15 +19,15 @@ class Pl_Flate: public Pipeline enum action_e { a_inflate, a_deflate }; - DLL_EXPORT + QPDF_DLL Pl_Flate(char const* identifier, Pipeline* next, action_e action, int out_bufsize = def_bufsize); - DLL_EXPORT + QPDF_DLL virtual ~Pl_Flate(); - DLL_EXPORT + QPDF_DLL virtual void write(unsigned char* data, int len); - DLL_EXPORT + QPDF_DLL virtual void finish(); private: diff --git a/include/qpdf/Pl_StdioFile.hh b/include/qpdf/Pl_StdioFile.hh index 3bb9f257..f3fc0dfc 100644 --- a/include/qpdf/Pl_StdioFile.hh +++ b/include/qpdf/Pl_StdioFile.hh @@ -23,14 +23,14 @@ class Pl_StdioFile: public Pipeline public: // f is externally maintained; this class just writes to and // flushes it. It does not close it. - DLL_EXPORT + QPDF_DLL Pl_StdioFile(char const* identifier, FILE* f); - DLL_EXPORT + QPDF_DLL virtual ~Pl_StdioFile(); - DLL_EXPORT + QPDF_DLL virtual void write(unsigned char* buf, int len); - DLL_EXPORT + QPDF_DLL virtual void finish(); private: diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index 5cbbe652..44e1a11f 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -28,9 +28,9 @@ class QPDFExc; class QPDF { public: - DLL_EXPORT + QPDF_DLL QPDF(); - DLL_EXPORT + QPDF_DLL ~QPDF(); // Associate a file with a QPDF object and do initial parsing of @@ -43,7 +43,7 @@ class QPDF // encrypted,either a null password or an empty password can be // used. If the file is encrypted, either the user password or // the owner password may be supplied. - DLL_EXPORT + QPDF_DLL void processFile(char const* filename, char const* password = 0); // Parameter settings @@ -52,21 +52,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 + QPDF_DLL 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 + QPDF_DLL 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 + QPDF_DLL void setAttemptRecovery(bool); // Other public methods @@ -76,26 +76,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 + QPDF_DLL std::vector getWarnings(); - DLL_EXPORT + QPDF_DLL std::string getFilename() const; - DLL_EXPORT + QPDF_DLL std::string getPDFVersion() const; - DLL_EXPORT + QPDF_DLL QPDFObjectHandle getTrailer(); - DLL_EXPORT + QPDF_DLL QPDFObjectHandle getRoot(); // Install this object handle as an indirect object and return an // indirect reference to it. - DLL_EXPORT + QPDF_DLL QPDFObjectHandle makeIndirectObject(QPDFObjectHandle); // Retrieve an object by object ID and generation. Returns an // indirect reference to it. - DLL_EXPORT + QPDF_DLL QPDFObjectHandle getObjectByID(int objid, int generation); // Encryption support @@ -128,46 +128,46 @@ class QPDF bool encrypt_metadata; }; - DLL_EXPORT + QPDF_DLL bool isEncrypted() const; - DLL_EXPORT + QPDF_DLL bool isEncrypted(int& R, int& P); // Encryption permissions -- not enforced by QPDF - DLL_EXPORT + QPDF_DLL bool allowAccessibility(); - DLL_EXPORT + QPDF_DLL bool allowExtractAll(); - DLL_EXPORT + QPDF_DLL bool allowPrintLowRes(); - DLL_EXPORT + QPDF_DLL bool allowPrintHighRes(); - DLL_EXPORT + QPDF_DLL bool allowModifyAssembly(); - DLL_EXPORT + QPDF_DLL bool allowModifyForm(); - DLL_EXPORT + QPDF_DLL bool allowModifyAnnotation(); - DLL_EXPORT + QPDF_DLL bool allowModifyOther(); - DLL_EXPORT + QPDF_DLL bool allowModifyAll(); // Helper function to trim padding from user password. Calling // trim_user_password on the result of getPaddedUserPassword gives // getTrimmedUserPassword's result. - DLL_EXPORT + QPDF_DLL static void trim_user_password(std::string& user_password); - DLL_EXPORT + QPDF_DLL static std::string compute_data_key( std::string const& encryption_key, int objid, int generation, bool use_aes); - DLL_EXPORT + QPDF_DLL static std::string compute_encryption_key( std::string const& password, EncryptionData const& data); - DLL_EXPORT + QPDF_DLL static void compute_encryption_O_U( char const* user_password, char const* owner_password, int V, int R, int key_len, int P, bool encrypt_metadata, @@ -176,23 +176,23 @@ class QPDF // Return the full user password as stored in the PDF file. If // you are attempting to recover the user password in a // user-presentable form, call getTrimmedUserPassword() instead. - DLL_EXPORT + QPDF_DLL std::string const& getPaddedUserPassword() const; // Return human-readable form of user password. - DLL_EXPORT + QPDF_DLL std::string getTrimmedUserPassword() const; // Linearization support // Returns true iff the file starts with a linearization parameter // dictionary. Does no additional validation. - DLL_EXPORT + QPDF_DLL 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 + QPDF_DLL bool checkLinearization(); // Calls checkLinearization() and, if possible, prints normalized @@ -200,11 +200,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 + QPDF_DLL void showLinearizationData(); // Shows the contents of the cross-reference table - DLL_EXPORT + QPDF_DLL void showXRefTable(); // Optimization support -- see doc/optimization. Implemented in @@ -218,31 +218,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 + QPDF_DLL 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 + QPDF_DLL void flattenScalarReferences(); // Decode all streams, discarding the output. Used to check // correctness of stream encoding. - DLL_EXPORT + QPDF_DLL void decodeStreams(); // For QPDFWriter: // Remove /ID, /Encrypt, and /Prev keys from the trailer // dictionary since these are regenerated during write. - DLL_EXPORT + QPDF_DLL void trimTrailerForWrite(); // Get lists of all objects in order according to the part of a // linearized file that they belong to. - DLL_EXPORT + QPDF_DLL void getLinearizedParts( std::map const& object_stream_data, std::vector& part4, @@ -251,7 +251,7 @@ class QPDF std::vector& part8, std::vector& part9); - DLL_EXPORT + QPDF_DLL void generateHintStream(std::map const& xref, std::map const& lengths, std::map const& obj_renumber, @@ -259,18 +259,18 @@ class QPDF int& S, int& O); // Map object to object stream that contains it - DLL_EXPORT + QPDF_DLL void getObjectStreamData(std::map&); // Get a list of objects that would be permitted in an object // stream - DLL_EXPORT + QPDF_DLL 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 + QPDF_DLL 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 8fa7fedc..d2230469 100644 --- a/include/qpdf/QPDFExc.hh +++ b/include/qpdf/QPDFExc.hh @@ -15,13 +15,13 @@ class QPDFExc: public std::runtime_error { public: - DLL_EXPORT + QPDF_DLL QPDFExc(qpdf_error_code_e error_code, std::string const& filename, std::string const& object, off_t offset, std::string const& message); - DLL_EXPORT + QPDF_DLL virtual ~QPDFExc() throw (); // To get a complete error string, call what(), provided by @@ -34,15 +34,15 @@ class QPDFExc: public std::runtime_error // the underlying issue, but it is more programmer-friendly than // trying to parse a string that is subject to change. - DLL_EXPORT + QPDF_DLL qpdf_error_code_e getErrorCode() const; - DLL_EXPORT + QPDF_DLL std::string const& getFilename() const; - DLL_EXPORT + QPDF_DLL std::string const& getObject() const; - DLL_EXPORT + QPDF_DLL off_t getFilePosition() const; - DLL_EXPORT + QPDF_DLL std::string const& getMessageDetail() const; private: diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index 6fc9e5aa..ad28b36e 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -26,58 +26,58 @@ class QPDF; class QPDFObjectHandle { public: - DLL_EXPORT + QPDF_DLL QPDFObjectHandle(); - DLL_EXPORT + QPDF_DLL bool isInitialized() const; // Exactly one of these will return true for any object. - DLL_EXPORT + QPDF_DLL bool isBool(); - DLL_EXPORT + QPDF_DLL bool isNull(); - DLL_EXPORT + QPDF_DLL bool isInteger(); - DLL_EXPORT + QPDF_DLL bool isReal(); - DLL_EXPORT + QPDF_DLL bool isName(); - DLL_EXPORT + QPDF_DLL bool isString(); - DLL_EXPORT + QPDF_DLL bool isArray(); - DLL_EXPORT + QPDF_DLL bool isDictionary(); - DLL_EXPORT + QPDF_DLL bool isStream(); // This returns true in addition to the query for the specific // type for indirect objects. - DLL_EXPORT + QPDF_DLL bool isIndirect(); // True for everything except array, dictionary, and stream - DLL_EXPORT + QPDF_DLL bool isScalar(); // Public factory methods - DLL_EXPORT + QPDF_DLL static QPDFObjectHandle newNull(); - DLL_EXPORT + QPDF_DLL static QPDFObjectHandle newBool(bool value); - DLL_EXPORT + QPDF_DLL static QPDFObjectHandle newInteger(int value); - DLL_EXPORT + QPDF_DLL static QPDFObjectHandle newReal(std::string const& value); - DLL_EXPORT + QPDF_DLL static QPDFObjectHandle newName(std::string const& name); - DLL_EXPORT + QPDF_DLL static QPDFObjectHandle newString(std::string const& str); - DLL_EXPORT + QPDF_DLL static QPDFObjectHandle newArray( std::vector const& items); - DLL_EXPORT + QPDF_DLL static QPDFObjectHandle newDictionary( std::map const& items); @@ -86,78 +86,78 @@ class QPDFObjectHandle // type, an exception is thrown. // Methods for bool objects - DLL_EXPORT + QPDF_DLL bool getBoolValue(); // Methods for integer objects - DLL_EXPORT + QPDF_DLL int getIntValue(); // Methods for real objects - DLL_EXPORT + QPDF_DLL std::string getRealValue(); // Methods that work for both integer and real objects - DLL_EXPORT + QPDF_DLL bool isNumber(); - DLL_EXPORT + QPDF_DLL double getNumericValue(); // Methods for name objects; see also name and array objects - DLL_EXPORT + QPDF_DLL std::string getName(); // Methods for string objects - DLL_EXPORT + QPDF_DLL std::string getStringValue(); - DLL_EXPORT + QPDF_DLL std::string getUTF8Value(); // Methods for array objects; see also name and array objects - DLL_EXPORT + QPDF_DLL int getArrayNItems(); - DLL_EXPORT + QPDF_DLL QPDFObjectHandle getArrayItem(int n); // Methods for dictionary objects - DLL_EXPORT + QPDF_DLL bool hasKey(std::string const&); - DLL_EXPORT + QPDF_DLL QPDFObjectHandle getKey(std::string const&); - DLL_EXPORT + QPDF_DLL std::set getKeys(); // Methods for name and array objects - DLL_EXPORT + QPDF_DLL bool isOrHasName(std::string const&); // 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 + QPDF_DLL void makeDirect(); // Mutator methods for array objects - DLL_EXPORT + QPDF_DLL void setArrayItem(int, QPDFObjectHandle const&); // Mutator methods for dictionary objects // Replace value of key, adding it if it does not exist - DLL_EXPORT + QPDF_DLL void replaceKey(std::string const& key, QPDFObjectHandle const&); // Remove key, doing nothing if key does not exist - DLL_EXPORT + QPDF_DLL void removeKey(std::string const& key); // Methods for stream objects - DLL_EXPORT + QPDF_DLL QPDFObjectHandle getDict(); // Returns filtered (uncompressed) stream data. Throws an // exception if the stream is filtered and we can't decode it. - DLL_EXPORT + QPDF_DLL PointerHolder getStreamData(); // Write stream data through the given pipeline. A null pipeline @@ -177,19 +177,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 + QPDF_DLL bool pipeStreamData(Pipeline*, bool filter, bool normalize, bool compress); // return 0 for direct objects - DLL_EXPORT + QPDF_DLL int getObjectID() const; - DLL_EXPORT + QPDF_DLL int getGeneration() const; - DLL_EXPORT + QPDF_DLL std::string unparse(); - DLL_EXPORT + QPDF_DLL std::string unparseResolved(); // Convenience routines for commonly performed functions @@ -199,7 +199,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 + QPDF_DLL std::map getPageImages(); // Throws an exception if this is not a Page object. Returns a @@ -207,7 +207,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 + QPDF_DLL 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 b93df068..c3514aed 100644 --- a/include/qpdf/QPDFTokenizer.hh +++ b/include/qpdf/QPDFTokenizer.hh @@ -84,7 +84,7 @@ class QPDFTokenizer std::string error_message; }; - DLL_EXPORT + QPDF_DLL QPDFTokenizer(); // PDF files with version < 1.2 allowed the pound character @@ -92,7 +92,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 + QPDF_DLL void allowPoundAnywhereInName(); // Mode of operation: @@ -103,23 +103,23 @@ class QPDFTokenizer // It these are called when a token is available, an exception // will be thrown. - DLL_EXPORT + QPDF_DLL void presentCharacter(char ch); - DLL_EXPORT + QPDF_DLL 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 + QPDF_DLL 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 + QPDF_DLL bool betweenTokens(); private: diff --git a/include/qpdf/QPDFWriter.hh b/include/qpdf/QPDFWriter.hh index 651c8f61..4e138f8f 100644 --- a/include/qpdf/QPDFWriter.hh +++ b/include/qpdf/QPDFWriter.hh @@ -42,9 +42,9 @@ class QPDFWriter // useful for tracking down problems. If your application doesn't // want the partially written file to be left behind, you should // delete it the eventual call to write fails. - DLL_EXPORT + QPDF_DLL QPDFWriter(QPDF& pdf, char const* filename); - DLL_EXPORT + QPDF_DLL ~QPDFWriter(); // Set the value of object stream mode. In disable mode, we never @@ -54,7 +54,7 @@ class QPDFWriter // generate a conventional cross-reference table if there are no // object streams and a cross-reference stream if there are object // streams. The default is o_preserve. - DLL_EXPORT + QPDF_DLL void setObjectStreamMode(qpdf_object_stream_e); // Set value of stream data mode. In uncompress mode, we attempt @@ -62,7 +62,7 @@ class QPDFWriter // preserve any filtering applied to streams. In compress mode, // if we can apply all filters and the stream is not already // optimally compressed, recompress the stream. - DLL_EXPORT + QPDF_DLL void setStreamDataMode(qpdf_stream_data_e); // Set value of content stream normalization. The default is @@ -72,7 +72,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 + QPDF_DLL void setContentNormalization(bool); // Set QDF mode. QDF mode causes special "pretty printing" of @@ -80,7 +80,7 @@ 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 + QPDF_DLL void setQDFMode(bool); // Set the minimum PDF version. If the PDF version of the input @@ -92,7 +92,7 @@ class QPDFWriter // QPDFWriter automatically sets the minimum version to 1.4 when // R3 encryption parameters are used, and to 1.5 when object // streams are used. - DLL_EXPORT + QPDF_DLL void setMinimumPDFVersion(std::string const&); // Force the PDF version of the output file to be a given version. @@ -110,32 +110,32 @@ class QPDFWriter // that type of encryption will explicitly disable decryption. // Additionally, forcing to a version below 1.5 will disable // object streams. - DLL_EXPORT + QPDF_DLL void forcePDFVersion(std::string const&); // Cause a static /ID value to be generated. Use only in test // suites. - DLL_EXPORT + QPDF_DLL void setStaticID(bool); // Use a fixed initialization vector for AES-CBC encryption. This // is not secure. It should be used only in test suites for // creating predictable encrypted output. - DLL_EXPORT + QPDF_DLL void setStaticAesIV(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 + QPDF_DLL 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 + QPDF_DLL void setPreserveEncryption(bool); // Set up for encrypted output. Disables stream prefiltering and @@ -144,17 +144,17 @@ class QPDFWriter // encryption parameters pushes the PDF version number to at least // 1.4, and setting R4 parameters pushes the version to at least // 1.5, or if AES is used, 1.6. - DLL_EXPORT + QPDF_DLL void setR2EncryptionParameters( char const* user_password, char const* owner_password, bool allow_print, bool allow_modify, bool allow_extract, bool allow_annotate); - DLL_EXPORT + QPDF_DLL void setR3EncryptionParameters( char const* user_password, char const* owner_password, bool allow_accessibility, bool allow_extract, qpdf_r3_print_e print, qpdf_r3_modify_e modify); - DLL_EXPORT + QPDF_DLL void setR4EncryptionParameters( char const* user_password, char const* owner_password, bool allow_accessibility, bool allow_extract, @@ -163,16 +163,13 @@ class QPDFWriter // Create linearized output. Disables qdf mode, content // normalization, and stream prefiltering. - DLL_EXPORT + QPDF_DLL void setLinearization(bool); - DLL_EXPORT + QPDF_DLL void write(); private: - QPDFWriter(QPDFWriter const&); - QPDFWriter& operator=(QPDFWriter const&); - // flags used by unparseObject static int const f_stream = 1 << 0; static int const f_filtered = 1 << 1; diff --git a/include/qpdf/QPDFXRefEntry.hh b/include/qpdf/QPDFXRefEntry.hh index 679bae5f..52477ece 100644 --- a/include/qpdf/QPDFXRefEntry.hh +++ b/include/qpdf/QPDFXRefEntry.hh @@ -19,18 +19,18 @@ class QPDFXRefEntry // 1 = "uncompressed"; field 1 = offset // 2 = "compressed"; field 1 = object stream number, field 2 = index - DLL_EXPORT + QPDF_DLL QPDFXRefEntry(); - DLL_EXPORT + QPDF_DLL QPDFXRefEntry(int type, int field1, int field2); - DLL_EXPORT + QPDF_DLL int getType() const; - DLL_EXPORT + QPDF_DLL int getOffset() const; // only for type 1 - DLL_EXPORT + QPDF_DLL int getObjStreamNumber() const; // only for type 2 - DLL_EXPORT + QPDF_DLL int getObjStreamIndex() const; // only for type 2 private: diff --git a/include/qpdf/QTC.hh b/include/qpdf/QTC.hh index d91fa6a5..f0cd4707 100644 --- a/include/qpdf/QTC.hh +++ b/include/qpdf/QTC.hh @@ -12,7 +12,7 @@ namespace QTC { - DLL_EXPORT + QPDF_DLL 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 de3d3a39..45dc9c5b 100644 --- a/include/qpdf/QUtil.hh +++ b/include/qpdf/QUtil.hh @@ -19,15 +19,15 @@ namespace QUtil { // This is a collection of useful utility functions that don't // really go anywhere else. - DLL_EXPORT + QPDF_DLL std::string int_to_string(int, int length = 0); - DLL_EXPORT + QPDF_DLL std::string double_to_string(double, int decimal_places = 0); // Throw std::runtime_error with a string formed by appending to // "description: " the standard string corresponding to the // current value of errno. - DLL_EXPORT + QPDF_DLL void throw_system_error(std::string const& description); // The status argument is assumed to be the return value of a @@ -35,40 +35,40 @@ namespace QUtil // is -1, convert the current value of errno to a // std::runtime_error that includes the standard error string. // Otherwise, return status. - DLL_EXPORT + QPDF_DLL int os_wrapper(std::string const& description, int status); // The FILE* argument is assumed to be the return of fopen. If // null, throw std::runtime_error. Otherwise, return the FILE* // argument. - DLL_EXPORT + QPDF_DLL FILE* fopen_wrapper(std::string const&, FILE*); - DLL_EXPORT + QPDF_DLL char* copy_string(std::string const&); // Set stdin, stdout to binary mode - DLL_EXPORT + QPDF_DLL void binary_stdout(); - DLL_EXPORT + QPDF_DLL void binary_stdin(); // May modify argv0 - DLL_EXPORT + QPDF_DLL 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 + QPDF_DLL bool get_env(std::string const& var, std::string* value = 0); - DLL_EXPORT + QPDF_DLL 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 + QPDF_DLL std::string toUTF8(unsigned long uval); }; diff --git a/include/qpdf/qpdf-c.h b/include/qpdf/qpdf-c.h index d1193a78..072ad91b 100644 --- a/include/qpdf/qpdf-c.h +++ b/include/qpdf/qpdf-c.h @@ -87,13 +87,13 @@ extern "C" { /* Returns dynamically allocated qpdf_data pointer; must be freed * by calling qpdf_cleanup. */ - DLL_EXPORT + QPDF_DLL qpdf_data qpdf_init(); /* Pass a pointer to the qpdf_data pointer created by qpdf_init to * clean up resources. */ - DLL_EXPORT + QPDF_DLL void qpdf_cleanup(qpdf_data* qpdf); /* ERROR REPORTING */ @@ -102,37 +102,37 @@ extern "C" { * pointer to data that will become invalid the next time an error * occurs or after this function is called gain. */ - DLL_EXPORT + QPDF_DLL qpdf_error qpdf_get_error(qpdf_data qpdf); /* Returns 1 if there are any unretrieved warnings, and zero * otherwise. */ - DLL_EXPORT + QPDF_DLL QPDF_BOOL qpdf_more_warnings(qpdf_data qpdf); /* If there are any warnings, returns a pointer to the next * warning. Otherwise returns a null pointer. */ - DLL_EXPORT + QPDF_DLL qpdf_error qpdf_next_warning(qpdf_data qpdf); /* Extract fields of the error. */ /* Use this function to get a full error message suitable for * showing to the user. */ - DLL_EXPORT + QPDF_DLL char const* qpdf_get_error_full_text(qpdf_data q, qpdf_error e); /* Use these functions to extract individual fields from the * error; see QPDFExc.hh for details. */ - DLL_EXPORT + QPDF_DLL enum qpdf_error_code_e qpdf_get_error_code(qpdf_data q, qpdf_error e); - DLL_EXPORT + QPDF_DLL char const* qpdf_get_error_filename(qpdf_data q, qpdf_error e); - DLL_EXPORT + QPDF_DLL unsigned long qpdf_get_error_file_position(qpdf_data q, qpdf_error e); - DLL_EXPORT + QPDF_DLL char const* qpdf_get_error_message_detail(qpdf_data q, qpdf_error e); /* By default, warnings are written to stderr. Passing true to @@ -140,17 +140,17 @@ extern "C" { * stderr. They will still be available by calls to * qpdf_next_warning. */ - DLL_EXPORT + QPDF_DLL void qpdf_set_suppress_warnings(qpdf_data qpdf, QPDF_BOOL value); /* READ FUNCTIONS */ /* READ PARAMETER FUNCTIONS -- must be called before qpdf_read */ - DLL_EXPORT + QPDF_DLL void qpdf_set_ignore_xref_streams(qpdf_data qpdf, QPDF_BOOL value); - DLL_EXPORT + QPDF_DLL void qpdf_set_attempt_recovery(qpdf_data qpdf, QPDF_BOOL value); /* Calling qpdf_read causes processFile to be called in the C++ @@ -158,14 +158,14 @@ extern "C" { * only read as needed. For files without passwords, pass a null * pointer as the password. */ - DLL_EXPORT + QPDF_DLL QPDF_ERROR_CODE qpdf_read(qpdf_data qpdf, char const* filename, char const* password); /* Read functions below must be called after qpdf_read. */ /* Return the version of the PDF file. */ - DLL_EXPORT + QPDF_DLL char const* qpdf_get_pdf_version(qpdf_data qpdf); /* Return the user password. If the file is opened using the @@ -173,34 +173,34 @@ extern "C" { * function. If the file is opened using the user password, this * function will return that user password. */ - DLL_EXPORT + QPDF_DLL char const* qpdf_get_user_password(qpdf_data qpdf); /* Indicate whether the input file is linearized. */ - DLL_EXPORT + QPDF_DLL QPDF_BOOL qpdf_is_linearized(qpdf_data qpdf); /* Indicate whether the input file is encrypted. */ - DLL_EXPORT + QPDF_DLL QPDF_BOOL qpdf_is_encrypted(qpdf_data qpdf); - DLL_EXPORT + QPDF_DLL QPDF_BOOL qpdf_allow_accessibility(qpdf_data qpdf); - DLL_EXPORT + QPDF_DLL QPDF_BOOL qpdf_allow_extract_all(qpdf_data qpdf); - DLL_EXPORT + QPDF_DLL QPDF_BOOL qpdf_allow_print_low_res(qpdf_data qpdf); - DLL_EXPORT + QPDF_DLL QPDF_BOOL qpdf_allow_print_high_res(qpdf_data qpdf); - DLL_EXPORT + QPDF_DLL QPDF_BOOL qpdf_allow_modify_assembly(qpdf_data qpdf); - DLL_EXPORT + QPDF_DLL QPDF_BOOL qpdf_allow_modify_form(qpdf_data qpdf); - DLL_EXPORT + QPDF_DLL QPDF_BOOL qpdf_allow_modify_annotation(qpdf_data qpdf); - DLL_EXPORT + QPDF_DLL QPDF_BOOL qpdf_allow_modify_other(qpdf_data qpdf); - DLL_EXPORT + QPDF_DLL QPDF_BOOL qpdf_allow_modify_all(qpdf_data qpdf); /* WRITE FUNCTIONS */ @@ -219,72 +219,72 @@ extern "C" { * etc.) is lost, so any write parameter functions must be called * again. */ - DLL_EXPORT + QPDF_DLL QPDF_ERROR_CODE qpdf_init_write(qpdf_data qpdf, char const* filename); - DLL_EXPORT + QPDF_DLL void qpdf_set_object_stream_mode(qpdf_data qpdf, enum qpdf_object_stream_e mode); - DLL_EXPORT + QPDF_DLL void qpdf_set_stream_data_mode(qpdf_data qpdf, enum qpdf_stream_data_e mode); - DLL_EXPORT + QPDF_DLL void qpdf_set_content_normalization(qpdf_data qpdf, QPDF_BOOL value); - DLL_EXPORT + QPDF_DLL void qpdf_set_qdf_mode(qpdf_data qpdf, QPDF_BOOL value); /* Never use qpdf_set_static_ID except in test suites to suppress * generation of a random /ID. */ - DLL_EXPORT + QPDF_DLL void qpdf_set_static_ID(qpdf_data qpdf, QPDF_BOOL value); /* Never use qpdf_set_static_aes_IV except in test suites to * create predictable AES encrypted output. */ - DLL_EXPORT + QPDF_DLL void qpdf_set_static_aes_IV(qpdf_data qpdf, QPDF_BOOL value); - DLL_EXPORT + QPDF_DLL void qpdf_set_suppress_original_object_IDs( qpdf_data qpdf, QPDF_BOOL value); - DLL_EXPORT + QPDF_DLL void qpdf_set_preserve_encryption(qpdf_data qpdf, QPDF_BOOL value); - DLL_EXPORT + QPDF_DLL void qpdf_set_r2_encryption_parameters( qpdf_data qpdf, char const* user_password, char const* owner_password, QPDF_BOOL allow_print, QPDF_BOOL allow_modify, QPDF_BOOL allow_extract, QPDF_BOOL allow_annotate); - DLL_EXPORT + QPDF_DLL void qpdf_set_r3_encryption_parameters( qpdf_data qpdf, char const* user_password, char const* owner_password, QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract, enum qpdf_r3_print_e print, enum qpdf_r3_modify_e modify); - DLL_EXPORT + QPDF_DLL void qpdf_set_r4_encryption_parameters( qpdf_data qpdf, char const* user_password, char const* owner_password, QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract, enum qpdf_r3_print_e print, enum qpdf_r3_modify_e modify, QPDF_BOOL encrypt_metadata, QPDF_BOOL use_aes); - DLL_EXPORT + QPDF_DLL void qpdf_set_linearization(qpdf_data qpdf, QPDF_BOOL value); - DLL_EXPORT + QPDF_DLL void qpdf_set_minimum_pdf_version(qpdf_data qpdf, char const* version); - DLL_EXPORT + QPDF_DLL void qpdf_force_pdf_version(qpdf_data qpdf, char const* version); /* Do actual write operation. */ - DLL_EXPORT + QPDF_DLL QPDF_ERROR_CODE qpdf_write(qpdf_data qpdf); #ifdef __cplusplus -- cgit v1.2.3-54-g00ecf