diff options
author | Jay Berkenbilt <ejb@ql.org> | 2018-06-21 20:03:45 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2018-06-21 21:57:13 +0200 |
commit | 952a665a4ed51400b5925e7cd69f08f0aeb374fe (patch) | |
tree | 080fef42cc7978c01e88a854ce9b96fb1b1916c0 /libqpdf/QPDFObjectHandle.cc | |
parent | e44c395c51518bafbf8f8466ea5a0f4b1f2b2efe (diff) | |
download | qpdf-952a665a4ed51400b5925e7cd69f08f0aeb374fe.tar.zst |
Better support for creating Unicode strings
Diffstat (limited to 'libqpdf/QPDFObjectHandle.cc')
-rw-r--r-- | libqpdf/QPDFObjectHandle.cc | 20 |
1 files changed, 20 insertions, 0 deletions
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<QPDF_String*>( + this->m->obj.getPointer())->unparse(true); + } + else + { + return unparse(); + } +} + QPDFObjectHandle QPDFObjectHandle::parse(std::string const& object_str, std::string const& object_description) @@ -1846,6 +1860,12 @@ QPDFObjectHandle::newString(std::string const& str) } QPDFObjectHandle +QPDFObjectHandle::newUnicodeString(std::string const& utf8_str) +{ + return QPDFObjectHandle(QPDF_String::new_utf16(utf8_str)); +} + +QPDFObjectHandle QPDFObjectHandle::newOperator(std::string const& value) { return QPDFObjectHandle(new QPDF_Operator(value)); |