From 952a665a4ed51400b5925e7cd69f08f0aeb374fe Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 21 Jun 2018 14:03:45 -0400 Subject: Better support for creating Unicode strings --- libqpdf/QPDFObjectHandle.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'libqpdf/QPDFObjectHandle.cc') diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index 5c111cc8..da609cc2 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -1221,6 +1221,20 @@ QPDFObjectHandle::unparseResolved() return this->m->obj->unparse(); } +std::string +QPDFObjectHandle::unparseBinary() +{ + if (this->isString()) + { + return dynamic_cast( + this->m->obj.getPointer())->unparse(true); + } + else + { + return unparse(); + } +} + QPDFObjectHandle QPDFObjectHandle::parse(std::string const& object_str, std::string const& object_description) @@ -1845,6 +1859,12 @@ QPDFObjectHandle::newString(std::string const& str) return QPDFObjectHandle(new QPDF_String(str)); } +QPDFObjectHandle +QPDFObjectHandle::newUnicodeString(std::string const& utf8_str) +{ + return QPDFObjectHandle(QPDF_String::new_utf16(utf8_str)); +} + QPDFObjectHandle QPDFObjectHandle::newOperator(std::string const& value) { -- cgit v1.2.3-54-g00ecf