diff options
author | Hubert Figuière <hub@figuiere.net> | 2016-02-14 21:12:29 -0500 |
---|---|---|
committer | Hubert Figuière <hub@figuiere.net> | 2016-02-14 21:13:06 -0500 |
commit | a7dc5de2e1b91ee7a49e8cc7df5ebde02e881729 (patch) | |
tree | fd1b5364512c06ddb0c7e1257a828e2bac74f38e | |
parent | ba2edc8c492598f4591089a2db942ce8093644c7 (diff) |
Bug 94065 - Part 3: Added API xmp_files_put_xmp_xmpstring() and xmp_files_put_xmp_cstr() variants.
-rw-r--r-- | exempi/exempi.cpp | 34 | ||||
-rw-r--r-- | exempi/xmp.h | 2 |
2 files changed, 36 insertions, 0 deletions
diff --git a/exempi/exempi.cpp b/exempi/exempi.cpp index e975028..cfd163c 100644 --- a/exempi/exempi.cpp +++ b/exempi/exempi.cpp @@ -450,6 +450,40 @@ bool xmp_files_put_xmp(XmpFilePtr xf, XmpPtr xmp) return true; } +bool xmp_files_put_xmp_xmpstring(XmpFilePtr xf, XmpStringPtr xmp_packet) +{ + CHECK_PTR(xf, false); + CHECK_PTR(xmp_packet, false); + RESET_ERROR; + SXMPFiles *txf = reinterpret_cast<SXMPFiles*>(xf); + + try { + txf->PutXMP(*reinterpret_cast<const std::string*>(xmp_packet)); + } + catch(const XMP_Error & e) { + set_error(e); + return false; + } + return true; +} + +bool xmp_files_put_xmp_cstr(XmpFilePtr xf, const char* xmp_packet, size_t len) +{ + CHECK_PTR(xf, false); + CHECK_PTR(xmp_packet, false); + RESET_ERROR; + SXMPFiles *txf = reinterpret_cast<SXMPFiles*>(xf); + + try { + txf->PutXMP(xmp_packet, len); + } + catch(const XMP_Error & e) { + set_error(e); + return false; + } + return true; +} + bool xmp_files_get_file_info(XmpFilePtr xf, XmpStringPtr filePath, XmpOpenFileOptions *options, XmpFileType * file_format, XmpFileFormatOptions *handler_flags) { diff --git a/exempi/xmp.h b/exempi/xmp.h index eb46f5f..6777b65 100644 --- a/exempi/xmp.h +++ b/exempi/xmp.h @@ -393,6 +393,8 @@ bool xmp_files_can_put_xmp_cstr(XmpFilePtr xf, const char* xmp_packet, size_t len); bool xmp_files_put_xmp(XmpFilePtr xf, XmpPtr xmp); +bool xmp_files_put_xmp_xmpstring(XmpFilePtr xf, XmpStringPtr xmp_packet); +bool xmp_files_put_xmp_cstr(XmpFilePtr xf, const char* xmp_packet, size_t len); /** Get the file info from the open file * @param xf the file object |