summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2009-10-19 22:17:14 +0200
committerJay Berkenbilt <ejb@ql.org>2009-10-19 22:17:14 +0200
commitb67a3c15e768ed88ea3cdf7525c1ddc649aec2fe (patch)
tree91b6f93a22e394f54dac6a0f7e2e03e582ac3a88 /include
parent734ac1e1d2b3ce10a2da1a7e736a30bdf0bc5cf8 (diff)
downloadqpdf-b67a3c15e768ed88ea3cdf7525c1ddc649aec2fe.tar.zst
DLL.hh -> DLL.h, move public enumerated types into Constants.h and use them both for C and C++ interfaces
git-svn-id: svn+q:///qpdf/trunk@828 71b93d88-0707-0410-a8cf-f5a4172ac649
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/Buffer.hh2
-rw-r--r--include/qpdf/Constants.h52
-rw-r--r--include/qpdf/DLL.h (renamed from include/qpdf/DLL.hh)2
-rw-r--r--include/qpdf/Pipeline.hh2
-rw-r--r--include/qpdf/QPDF.hh2
-rw-r--r--include/qpdf/QPDFExc.hh2
-rw-r--r--include/qpdf/QPDFObject.hh2
-rw-r--r--include/qpdf/QPDFObjectHandle.hh2
-rw-r--r--include/qpdf/QPDFTokenizer.hh2
-rw-r--r--include/qpdf/QPDFWriter.hh33
-rw-r--r--include/qpdf/QPDFXRefEntry.hh2
-rw-r--r--include/qpdf/QTC.hh2
-rw-r--r--include/qpdf/QUtil.hh2
-rw-r--r--include/qpdf/qpdf-c.h35
14 files changed, 80 insertions, 62 deletions
diff --git a/include/qpdf/Buffer.hh b/include/qpdf/Buffer.hh
index 8da972ca..36f673ce 100644
--- a/include/qpdf/Buffer.hh
+++ b/include/qpdf/Buffer.hh
@@ -8,7 +8,7 @@
#ifndef __BUFFER_HH__
#define __BUFFER_HH__
-#include <qpdf/DLL.hh>
+#include <qpdf/DLL.h>
class DLL_EXPORT Buffer
{
diff --git a/include/qpdf/Constants.h b/include/qpdf/Constants.h
new file mode 100644
index 00000000..31cefd54
--- /dev/null
+++ b/include/qpdf/Constants.h
@@ -0,0 +1,52 @@
+#ifndef __QPDFCONSTANTS_H__
+#define __QPDFCONSTANTS_H__
+
+/* Keep this file 'C' compatible so it can be used from the C and C++
+ * interfaces.
+ */
+
+/* Error Codes */
+
+enum qpdf_error_code_e
+{
+ qpdf_e_success = 0,
+ qpdf_e_internal, /* logic/programming error -- indicates bug */
+ qpdf_e_system, /* I/O error, memory error, etc. */
+ qpdf_e_unsupported, /* PDF feature not (yet) supported by qpdf */
+ qpdf_e_password, /* incorrect password for encrypted file */
+ qpdf_e_damaged_pdf /* syntax errors or other damage in PDF */
+};
+
+/* Write Parameters */
+
+enum qpdf_object_stream_e
+{
+ qpdf_o_disable = 0, /* disable object streams */
+ qpdf_o_preserve, /* preserve object streams */
+ qpdf_o_generate /* generate object streams */
+};
+enum qpdf_stream_data_e
+{
+ qpdf_s_uncompress = 0, /* uncompress stream data */
+ qpdf_s_preserve, /* preserve stream data compression */
+ qpdf_s_compress /* compress stream data */
+};
+
+/* R3 Encryption Parameters */
+
+enum qpdf_r3_print_e
+{
+ qpdf_r3p_full = 0, /* allow all printing */
+ qpdf_r3p_low, /* allow only low-resolution printing */
+ qpdf_r3p_none /* allow no printing */
+};
+enum qpdf_r3_modify_e
+{
+ qpdf_r3m_all = 0, /* allow all modification */
+ qpdf_r3m_annotate, /* allow comment authoring and form operations */
+ qpdf_r3m_form, /* allow form field fill-in or signing */
+ qpdf_r3m_assembly, /* allow only document assembly */
+ qpdf_r3m_none /* allow no modification */
+};
+
+#endif /* __QPDFCONSTANTS_H__ */
diff --git a/include/qpdf/DLL.hh b/include/qpdf/DLL.h
index 0b72ff0a..b0c465a3 100644
--- a/include/qpdf/DLL.hh
+++ b/include/qpdf/DLL.h
@@ -7,4 +7,4 @@
# define DLL_EXPORT
#endif
-#endif // __QPDF_DLL_HH__
+#endif /* __QPDF_DLL_HH__ */
diff --git a/include/qpdf/Pipeline.hh b/include/qpdf/Pipeline.hh
index 8b589e20..aefb1b0b 100644
--- a/include/qpdf/Pipeline.hh
+++ b/include/qpdf/Pipeline.hh
@@ -30,7 +30,7 @@
#ifndef __PIPELINE_HH__
#define __PIPELINE_HH__
-#include <qpdf/DLL.hh>
+#include <qpdf/DLL.h>
#include <string>
class DLL_EXPORT Pipeline
diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh
index 44d069f4..9770f46d 100644
--- a/include/qpdf/QPDF.hh
+++ b/include/qpdf/QPDF.hh
@@ -13,7 +13,7 @@
#include <map>
#include <list>
-#include <qpdf/DLL.hh>
+#include <qpdf/DLL.h>
#include <qpdf/QPDFXRefEntry.hh>
#include <qpdf/QPDFObjectHandle.hh>
diff --git a/include/qpdf/QPDFExc.hh b/include/qpdf/QPDFExc.hh
index 341b5f0b..d9a61bf3 100644
--- a/include/qpdf/QPDFExc.hh
+++ b/include/qpdf/QPDFExc.hh
@@ -8,7 +8,7 @@
#ifndef __QPDFEXC_HH__
#define __QPDFEXC_HH__
-#include <qpdf/DLL.hh>
+#include <qpdf/DLL.h>
#include <stdexcept>
class DLL_EXPORT QPDFExc: public std::runtime_error
diff --git a/include/qpdf/QPDFObject.hh b/include/qpdf/QPDFObject.hh
index 99d56542..ff31f9a9 100644
--- a/include/qpdf/QPDFObject.hh
+++ b/include/qpdf/QPDFObject.hh
@@ -8,7 +8,7 @@
#ifndef __QPDFOBJECT_HH__
#define __QPDFOBJECT_HH__
-#include <qpdf/DLL.hh>
+#include <qpdf/DLL.h>
#include <string>
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh
index 0a277384..0948fefe 100644
--- a/include/qpdf/QPDFObjectHandle.hh
+++ b/include/qpdf/QPDFObjectHandle.hh
@@ -13,7 +13,7 @@
#include <set>
#include <map>
-#include <qpdf/DLL.hh>
+#include <qpdf/DLL.h>
#include <qpdf/PointerHolder.hh>
#include <qpdf/Buffer.hh>
diff --git a/include/qpdf/QPDFTokenizer.hh b/include/qpdf/QPDFTokenizer.hh
index 705155a2..a48a78d6 100644
--- a/include/qpdf/QPDFTokenizer.hh
+++ b/include/qpdf/QPDFTokenizer.hh
@@ -8,7 +8,7 @@
#ifndef __QPDFTOKENIZER_HH__
#define __QPDFTOKENIZER_HH__
-#include <qpdf/DLL.hh>
+#include <qpdf/DLL.h>
#include <string>
#include <stdio.h>
diff --git a/include/qpdf/QPDFWriter.hh b/include/qpdf/QPDFWriter.hh
index 9d92ffbb..15e9317b 100644
--- a/include/qpdf/QPDFWriter.hh
+++ b/include/qpdf/QPDFWriter.hh
@@ -19,7 +19,8 @@
#include <set>
#include <map>
-#include <qpdf/DLL.hh>
+#include <qpdf/DLL.h>
+#include <qpdf/Constants.h>
#include <qpdf/QPDFXRefEntry.hh>
@@ -51,16 +52,14 @@ class DLL_EXPORT 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.
- enum object_stream_e { o_disable, o_preserve, o_generate };
- void setObjectStreamMode(object_stream_e);
+ void setObjectStreamMode(qpdf_object_stream_e);
// Set value of stream data mode. In uncompress mode, we attempt
// to uncompress any stream that we can. In preserve mode, we
// 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.
- enum stream_data_e { s_uncompress, s_preserve, s_compress };
- void setStreamDataMode(stream_data_e);
+ void setStreamDataMode(qpdf_stream_data_e);
// Set value of content stream normalization. The default is
// "false". If true, we attempt to normalize newlines inside of
@@ -137,28 +136,14 @@ class DLL_EXPORT QPDFWriter
char const* user_password, char const* owner_password,
bool allow_print, bool allow_modify,
bool allow_extract, bool allow_annotate);
- enum r3_print_e
- {
- r3p_full, // allow all printing
- r3p_low, // allow only low-resolution printing
- r3p_none // allow no printing
- };
- enum r3_modify_e
- {
- r3m_all, // allow all modification
- r3m_annotate, // allow comment authoring and form operations
- r3m_form, // allow form field fill-in or signing
- r3m_assembly, // allow only document assembly
- r3m_none // allow no modification
- };
void setR3EncryptionParameters(
char const* user_password, char const* owner_password,
bool allow_accessibility, bool allow_extract,
- r3_print_e print, r3_modify_e modify);
+ qpdf_r3_print_e print, qpdf_r3_modify_e modify);
void setR4EncryptionParameters(
char const* user_password, char const* owner_password,
bool allow_accessibility, bool allow_extract,
- r3_print_e print, r3_modify_e modify,
+ qpdf_r3_print_e print, qpdf_r3_modify_e modify,
bool encrypt_metadata, bool use_aes);
// Create linearized output. Disables qdf mode, content
@@ -203,7 +188,7 @@ class DLL_EXPORT QPDFWriter
std::set<int>& bits_to_clear,
char const* user_password, char const* owner_password,
bool allow_accessibility, bool allow_extract,
- r3_print_e print, r3_modify_e modify);
+ qpdf_r3_print_e print, qpdf_r3_modify_e modify);
void disableIncompatbleEncryption(float v);
void setEncryptionParameters(
char const* user_password, char const* owner_password,
@@ -265,7 +250,7 @@ class DLL_EXPORT QPDFWriter
bool normalize_content_set;
bool normalize_content;
bool stream_data_mode_set;
- stream_data_e stream_data_mode;
+ qpdf_stream_data_e stream_data_mode;
bool qdf_mode;
bool static_id;
bool suppress_original_object_ids;
@@ -273,7 +258,7 @@ class DLL_EXPORT QPDFWriter
bool encrypted;
bool preserve_encryption;
bool linearized;
- object_stream_e object_stream_mode;
+ qpdf_object_stream_e object_stream_mode;
std::string encryption_key;
bool encrypt_metadata;
bool encrypt_use_aes;
diff --git a/include/qpdf/QPDFXRefEntry.hh b/include/qpdf/QPDFXRefEntry.hh
index e5b79df5..05a3f21e 100644
--- a/include/qpdf/QPDFXRefEntry.hh
+++ b/include/qpdf/QPDFXRefEntry.hh
@@ -8,7 +8,7 @@
#ifndef __QPDFXREFENTRY_HH__
#define __QPDFXREFENTRY_HH__
-#include <qpdf/DLL.hh>
+#include <qpdf/DLL.h>
class DLL_EXPORT QPDFXRefEntry
{
diff --git a/include/qpdf/QTC.hh b/include/qpdf/QTC.hh
index 6e7e4a90..d91fa6a5 100644
--- a/include/qpdf/QTC.hh
+++ b/include/qpdf/QTC.hh
@@ -8,7 +8,7 @@
#ifndef __QTC_HH__
#define __QTC_HH__
-#include <qpdf/DLL.hh>
+#include <qpdf/DLL.h>
namespace QTC
{
diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh
index bfd59b61..de3d3a39 100644
--- a/include/qpdf/QUtil.hh
+++ b/include/qpdf/QUtil.hh
@@ -8,7 +8,7 @@
#ifndef __QUTIL_HH__
#define __QUTIL_HH__
-#include <qpdf/DLL.hh>
+#include <qpdf/DLL.h>
#include <string>
#include <list>
#include <stdexcept>
diff --git a/include/qpdf/qpdf-c.h b/include/qpdf/qpdf-c.h
index 8c112ba5..90b3e5f9 100644
--- a/include/qpdf/qpdf-c.h
+++ b/include/qpdf/qpdf-c.h
@@ -61,7 +61,8 @@
* primarily on differences between the C and C++ API.
*/
-#include <qpdf/DLL.hh>
+#include <qpdf/DLL.h>
+#include <qpdf/Constants.h>
#ifdef __cplusplus
extern "C" {
@@ -199,20 +200,13 @@ extern "C" {
DLL_EXPORT
QPDF_ERROR_CODE qpdf_init_write(qpdf_data qpdf, char const* filename);
-# define QPDF_OBJECT_STREAM_DISABLE 0
-# define QPDF_OBJECT_STREAM_PRESERVE 1
-# define QPDF_OBJECT_STREAM_GENERATE 2
-
- /* For mode, pass one of the QPDF_OBJECT_STREAM constants. */
DLL_EXPORT
- void qpdf_set_object_stream_mode(qpdf_data qpdf, int mode);
+ void qpdf_set_object_stream_mode(qpdf_data qpdf,
+ enum qpdf_object_stream_e mode);
-# define QPDF_STREAM_DATA_UNCOMPRESS 0
-# define QPDF_STREAM_DATA_PRESERVE 1
-# define QPDF_STREAM_DATA_COMPRESS 2
- /* For mode, pass one of the QPDF_STREAM_DATA constants. */
DLL_EXPORT
- void qpdf_set_stream_data_mode(qpdf_data qpdf, int mode);
+ void qpdf_set_stream_data_mode(qpdf_data qpdf,
+ enum qpdf_stream_data_e mode);
DLL_EXPORT
void qpdf_set_content_normalization(qpdf_data qpdf, QPDF_BOOL value);
@@ -245,30 +239,17 @@ extern "C" {
QPDF_BOOL allow_print, QPDF_BOOL allow_modify,
QPDF_BOOL allow_extract, QPDF_BOOL allow_annotate);
-# define QPDF_R3_PRINT_FULL 0
-# define QPDF_R3_PRINT_LOW 1
-# define QPDF_R3_PRINT_NONE 2
-
-# define QPDF_R3_MODIFY_ALL 0
-# define QPDF_R3_MODIFY_ANNOTATE 1
-# define QPDF_R3_MODIFY_FORM 2
-# define QPDF_R3_MODIFY_ASSEMBLY 3
-# define QPDF_R3_MODIFY_NONE 4
-
- /* Value of print should be one of the QPDF_R3_PRINT constants.
- * Value of modify should be one of the QPDF_R3_MODIFY constants.
- */
DLL_EXPORT
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,
- int print, int modify);
+ enum qpdf_r3_print_e print, enum qpdf_r3_modify_e modify);
DLL_EXPORT
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,
- int print, int modify,
+ enum qpdf_r3_print_e print, enum qpdf_r3_modify_e modify,
QPDF_BOOL encrypt_metadata, QPDF_BOOL use_aes);
DLL_EXPORT