diff options
Diffstat (limited to 'include/qpdf/QPDFObjectHandle.hh')
-rw-r--r-- | include/qpdf/QPDFObjectHandle.hh | 49 |
1 files changed, 49 insertions, 0 deletions
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 <set> #include <map> +#include <qpdf/DLL.hh> + #include <qpdf/PointerHolder.hh> #include <qpdf/Buffer.hh> @@ -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<QPDFObjectHandle> const& items); + DLL_EXPORT static QPDFObjectHandle newDictionary( std::map<std::string, QPDFObjectHandle> 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<std::string> 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<Buffer> 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<std::string, QPDFObjectHandle> 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<QPDFObjectHandle> getPageContents(); // Initializers for objects. This Factory class gives the QPDF |