From 95e7d36b7a9d2c241cfb9e67745c653343bb73c3 Mon Sep 17 00:00:00 2001 From: m-holger Date: Fri, 4 Feb 2022 17:15:34 +0000 Subject: C-API add two binary UTF8 funtions add qpdf_oh_new_binary_unicode_string and qpdf_oh_get_binary_utf8_value --- libqpdf/qpdf-c.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'libqpdf') 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( + qpdf, oh, + return_T(""), + [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( @@ -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"); -- cgit v1.2.3-54-g00ecf