aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/qpdf-c.cc
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2022-02-04 18:15:34 +0100
committerJay Berkenbilt <jberkenbilt@users.noreply.github.com>2022-02-04 19:10:51 +0100
commit95e7d36b7a9d2c241cfb9e67745c653343bb73c3 (patch)
tree090a2f53b61a1d4d8b3ee0b9e60a31f0f5d923bb /libqpdf/qpdf-c.cc
parent3c138be0efa2daf1e5e162edf1100cf5e8b5521c (diff)
downloadqpdf-95e7d36b7a9d2c241cfb9e67745c653343bb73c3.tar.zst
C-API add two binary UTF8 funtions
add qpdf_oh_new_binary_unicode_string and qpdf_oh_get_binary_utf8_value
Diffstat (limited to 'libqpdf/qpdf-c.cc')
-rw-r--r--libqpdf/qpdf-c.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/libqpdf/qpdf-c.cc b/libqpdf/qpdf-c.cc
index c7300cae..596ce4f7 100644
--- a/libqpdf/qpdf-c.cc
+++ b/libqpdf/qpdf-c.cc
@@ -1327,6 +1327,20 @@ char const* qpdf_oh_get_binary_string_value(
});
}
+char const* qpdf_oh_get_binary_utf8_value(
+ qpdf_data qpdf, qpdf_oh oh, size_t* length)
+{
+ return do_with_oh<char const*>(
+ qpdf, oh,
+ return_T<char const*>(""),
+ [qpdf, length](QPDFObjectHandle& o) {
+ QTC::TC("qpdf", "qpdf-c called qpdf_oh_get_binary_utf8_value");
+ qpdf->tmp_string = o.getUTF8Value();
+ *length = qpdf->tmp_string.length();
+ return qpdf->tmp_string.c_str();
+ });
+}
+
int qpdf_oh_get_array_n_items(qpdf_data qpdf, qpdf_oh oh)
{
return do_with_oh<int>(
@@ -1468,6 +1482,14 @@ qpdf_oh qpdf_oh_new_binary_string(
qpdf, QPDFObjectHandle::newString(std::string(str, length)));
}
+qpdf_oh qpdf_oh_new_binary_unicode_string(
+ qpdf_data qpdf, char const* utf8_str, size_t length)
+{
+ QTC::TC("qpdf", "qpdf-c called qpdf_oh_new_binary_unicode_string");
+ return new_object(
+ qpdf, QPDFObjectHandle::newUnicodeString(std::string(utf8_str, length)));
+}
+
qpdf_oh qpdf_oh_new_array(qpdf_data qpdf)
{
QTC::TC("qpdf", "qpdf-c called qpdf_oh_new_array");