From 44cbd3d4b477f855d46259f7fbc743c0b96c7678 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Mon, 12 Oct 2009 01:15:55 +0000 Subject: do DLL_EXPORT only in header files and only at the class or top-level function level git-svn-id: svn+q:///qpdf/trunk@796 71b93d88-0707-0410-a8cf-f5a4172ac649 --- include/qpdf/Buffer.hh | 9 +------- include/qpdf/Pipeline.hh | 5 +---- include/qpdf/Pl_Buffer.hh | 6 +---- include/qpdf/Pl_Count.hh | 7 +----- include/qpdf/Pl_Discard.hh | 5 +---- include/qpdf/Pl_Flate.hh | 5 +---- include/qpdf/Pl_StdioFile.hh | 5 +---- include/qpdf/QPDF.hh | 44 +----------------------------------- include/qpdf/QPDFExc.hh | 4 +--- include/qpdf/QPDFObject.hh | 2 +- include/qpdf/QPDFObjectHandle.hh | 48 +--------------------------------------- include/qpdf/QPDFTokenizer.hh | 7 +----- include/qpdf/QPDFWriter.hh | 16 +------------- include/qpdf/QPDFXRefEntry.hh | 7 +----- 14 files changed, 14 insertions(+), 156 deletions(-) (limited to 'include') diff --git a/include/qpdf/Buffer.hh b/include/qpdf/Buffer.hh index c4f03768..084da8e3 100644 --- a/include/qpdf/Buffer.hh +++ b/include/qpdf/Buffer.hh @@ -10,24 +10,17 @@ #include +DLL_EXPORT 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 8bdbfcac..a8b8b794 100644 --- a/include/qpdf/Pipeline.hh +++ b/include/qpdf/Pipeline.hh @@ -33,21 +33,18 @@ #include #include +DLL_EXPORT class Pipeline { public: - 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_Buffer.hh b/include/qpdf/Pl_Buffer.hh index 1e0bd8ac..4d5ced70 100644 --- a/include/qpdf/Pl_Buffer.hh +++ b/include/qpdf/Pl_Buffer.hh @@ -24,22 +24,18 @@ #include #include +DLL_EXPORT class Pl_Buffer: public Pipeline { public: - DLL_EXPORT Pl_Buffer(char const* identifier, Pipeline* next = 0); - DLL_EXPORT virtual ~Pl_Buffer(); - DLL_EXPORT virtual void write(unsigned char*, int); - DLL_EXPORT 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 Buffer* getBuffer(); private: diff --git a/include/qpdf/Pl_Count.hh b/include/qpdf/Pl_Count.hh index 1fd4c94a..66bc69a4 100644 --- a/include/qpdf/Pl_Count.hh +++ b/include/qpdf/Pl_Count.hh @@ -13,23 +13,18 @@ #include +DLL_EXPORT 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 f99112b2..59e8a0d3 100644 --- a/include/qpdf/Pl_Discard.hh +++ b/include/qpdf/Pl_Discard.hh @@ -16,16 +16,13 @@ #include +DLL_EXPORT 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 286d80e8..5fdab63d 100644 --- a/include/qpdf/Pl_Flate.hh +++ b/include/qpdf/Pl_Flate.hh @@ -12,6 +12,7 @@ #include +DLL_EXPORT class Pl_Flate: public Pipeline { public: @@ -19,15 +20,11 @@ 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 3bb9f257..026bc41b 100644 --- a/include/qpdf/Pl_StdioFile.hh +++ b/include/qpdf/Pl_StdioFile.hh @@ -18,19 +18,16 @@ // This pipeline is reusable. // +DLL_EXPORT 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 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/QPDF.hh b/include/qpdf/QPDF.hh index af5e33b3..0b9cee2f 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -25,12 +25,11 @@ class BitStream; class BitWriter; class QPDFExc; +DLL_EXPORT class QPDF { public: - DLL_EXPORT QPDF(); - DLL_EXPORT ~QPDF(); // Associate a file with a QPDF object and do initial parsing of @@ -43,7 +42,6 @@ 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 void processFile(char const* filename, char const* password = 0); // Parameter settings @@ -52,21 +50,18 @@ 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 @@ -76,26 +71,19 @@ 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 @@ -125,45 +113,30 @@ class QPDF std::string id1; }; - DLL_EXPORT bool isEncrypted() const; - DLL_EXPORT bool isEncrypted(int& R, int& P); // Encryption permissions -- not enforced by QPDF - DLL_EXPORT bool allowAccessibility(); - DLL_EXPORT bool allowExtractAll(); - DLL_EXPORT bool allowPrintLowRes(); - DLL_EXPORT bool allowPrintHighRes(); - DLL_EXPORT bool allowModifyAssembly(); - DLL_EXPORT bool allowModifyForm(); - DLL_EXPORT bool allowModifyAnnotation(); - DLL_EXPORT bool allowModifyOther(); - DLL_EXPORT 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 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, @@ -172,23 +145,19 @@ 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 std::string const& getPaddedUserPassword() const; // Return human-readable form of user password. - DLL_EXPORT std::string getTrimmedUserPassword() 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 @@ -196,11 +165,9 @@ 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 @@ -214,31 +181,26 @@ 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, @@ -247,7 +209,6 @@ 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, @@ -255,18 +216,15 @@ 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 ebfa870b..1c3794a5 100644 --- a/include/qpdf/QPDFExc.hh +++ b/include/qpdf/QPDFExc.hh @@ -11,15 +11,13 @@ #include #include +DLL_EXPORT class QPDFExc: public std::runtime_error { 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 df8ea42a..eae75682 100644 --- a/include/qpdf/QPDFObject.hh +++ b/include/qpdf/QPDFObject.hh @@ -12,11 +12,11 @@ #include +DLL_EXPORT class QPDFObject { public: virtual ~QPDFObject() {} - DLL_EXPORT virtual std::string unparse() = 0; }; diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index b9aeaf59..fd8a8a81 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -23,61 +23,41 @@ class Pipeline; class QPDF; +DLL_EXPORT 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); @@ -86,74 +66,55 @@ 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 @@ -173,19 +134,14 @@ 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 @@ -195,7 +151,6 @@ 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 @@ -203,7 +158,6 @@ 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 de740e66..cafa9e52 100644 --- a/include/qpdf/QPDFTokenizer.hh +++ b/include/qpdf/QPDFTokenizer.hh @@ -13,6 +13,7 @@ #include #include +DLL_EXPORT class QPDFTokenizer { public: @@ -84,7 +85,6 @@ class QPDFTokenizer std::string error_message; }; - DLL_EXPORT QPDFTokenizer(); // PDF files with version < 1.2 allowed the pound character @@ -92,7 +92,6 @@ 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: @@ -103,23 +102,19 @@ 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 b5f23457..91747543 100644 --- a/include/qpdf/QPDFWriter.hh +++ b/include/qpdf/QPDFWriter.hh @@ -31,6 +31,7 @@ class QPDF; class QPDFObjectHandle; class Pl_Count; +DLL_EXPORT class QPDFWriter { public: @@ -41,9 +42,7 @@ 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 QPDFWriter(QPDF& pdf, char const* filename); - DLL_EXPORT ~QPDFWriter(); // Set the value of object stream mode. In disable mode, we never @@ -54,7 +53,6 @@ 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 @@ -63,7 +61,6 @@ 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 @@ -73,7 +70,6 @@ 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 @@ -81,7 +77,6 @@ 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); // Set the minimum PDF version. If the PDF version of the input @@ -93,7 +88,6 @@ 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 void setMinimumPDFVersion(std::string const&); // Force the PDF version of the output file to be a given version. @@ -105,26 +99,22 @@ class QPDFWriter // you are sure the PDF file in question has no features of newer // versions of PDF or if you are willing to create files that old // viewers may try to open but not be able to properly interpret. - DLL_EXPORT void forcePDFVersion(std::string const&); // 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 @@ -132,7 +122,6 @@ 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, @@ -151,7 +140,6 @@ 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, @@ -159,10 +147,8 @@ 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 26a047b2..aac2e5cb 100644 --- a/include/qpdf/QPDFXRefEntry.hh +++ b/include/qpdf/QPDFXRefEntry.hh @@ -10,6 +10,7 @@ #include +DLL_EXPORT class QPDFXRefEntry { public: @@ -19,18 +20,12 @@ 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: -- cgit v1.2.3-54-g00ecf