Skip to content

Commit

Permalink
* ABI breakage: soversion is now 3
Browse files Browse the repository at this point in the history
	* exempi/{exempi.cpp,xmp.h}: xmp_get_property_and_bits() renamed
	xmp_get_property(). xmp_set_property2() renamed
	xmp_set_property(). More exception handling and refactor
	set_error() use.

	* exempi/tests/*: update for new API.
  • Loading branch information
Hubert Figuiere committed Nov 1, 2007
1 parent c0698f7 commit 605884a
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 86 deletions.
4 changes: 2 additions & 2 deletions AUTHORS
@@ -1,8 +1,8 @@
The package is based on Adobe XMP SDK 4.1.1.


Other authors are:
Authors are:

Hubert Figuiere <hub@figuiere.net>
Adobe Systems Incorporated (XMP SDK)
Ian Jacobi
Jason Kivlighn
11 changes: 11 additions & 0 deletions ChangeLog
@@ -1,3 +1,14 @@
2007-10-30 Hubert Figuiere <hub@figuiere.net>

* ABI breakage: soversion is now 3

* exempi/{exempi.cpp,xmp.h}: xmp_get_property_and_bits() renamed
xmp_get_property(). xmp_set_property2() renamed
xmp_set_property(). More exception handling and refactor
set_error() use.

* exempi/tests/*: update for new API.

2007-10-02 Hubert Figuiere <hub@figuiere.net>

* exempi/exempi.cpp (xmp_files_new): Catch
Expand Down
4 changes: 4 additions & 0 deletions NEWS
@@ -1,5 +1,9 @@
1.99.5

- ABI breakage: soversion is now 3
- Change: API xmp_get_property_and_bits() renamed xmp_get_property().
- Change: API xmp_set_property2() renamed xmp_set_property().
- Bug: more exception handling and refactor set_error() use.
- Bug: add AC_CONFIG_MACRO_DIR to configure.

1.99.4
Expand Down
10 changes: 6 additions & 4 deletions README
@@ -1,5 +1,7 @@
exempi is a port of Adobe XMP SDK to work on UNIX
and to be build with GNU automake.
It includes XMPCore and XMPFiles.
exempi is a port of Adobe XMP SDK to work on UNIX and to be build with
GNU automake.
It includes XMPCore and XMPFiles, and exempi, a C-based API.

It is maintained by Hubert Figuiere <hub@figuiere.net>
It is maintained by Hubert Figuiere <hub@figuiere.net>

Homepage: http://libopenraw.freedesktop.org/wiki/Exempi
8 changes: 5 additions & 3 deletions configure.ac
@@ -1,6 +1,6 @@
AC_PREREQ(2.50)
AC_INIT(exempi/xmp.h)
AM_INIT_AUTOMAKE(exempi, 1.99.4)
AM_INIT_AUTOMAKE(exempi, 1.99.5)
AM_MAINTAINER_MODE


Expand Down Expand Up @@ -31,9 +31,11 @@ dnl 1.99.1 is the revision 3 1 0
dnl 1.99.2 is the revision 4 2 0
dnl 1.99.3 is the revision 5 3 0
dnl 1.99.4 is the revision 6 4 0
dnl ABI breakage reset major to 3
dnl 1.99.5 is the revision 3.0.0
AC_SUBST([EXEMPI_REVISION], [0])
AC_SUBST([EXEMPI_AGE], [4])
AC_SUBST([EXEMPI_CURRENT], [6])
AC_SUBST([EXEMPI_AGE], [0])
AC_SUBST([EXEMPI_CURRENT], [3])
AC_SUBST([EXEMPI_CURRENT_MIN],
[`expr $EXEMPI_CURRENT - $EXEMPI_AGE`])
AC_SUBST([EXEMPI_VERSION_INFO],
Expand Down
8 changes: 4 additions & 4 deletions debian/control
Expand Up @@ -8,22 +8,22 @@ Standards-Version: 3.7.2

Package: libexempi-dev
Section: libdevel
Depends: libexempi2 (= ${Source-Version})
Depends: libexempi3 (= ${Source-Version})
Architecture: any
Description: A library to parse XMP metadata (Development files)
Exempi is a library to parse XMP metadata as defined by the
specification.


Package: libexempi2-dbg
Package: libexempi3-dbg
Architecture: any
Depends: libexempi2 (= ${Source-Version})
Depends: libexempi3 (= ${Source-Version})
Description: A library to parse XMP metadata (Debug files)
Exempi is a library to parse XMP metadata as defined by the
specification.


Package: libexempi2
Package: libexempi3
Section: libs
Architecture: any
Depends: ${shlibs:Depends}
Expand Down
63 changes: 26 additions & 37 deletions exempi/exempi.cpp
Expand Up @@ -113,9 +113,15 @@ bool xmp_register_namespace(const char *namespaceURI,
const char *suggestedPrefix,
XmpStringPtr registeredPrefix)
{
return SXMPMeta::RegisterNamespace(namespaceURI,
suggestedPrefix,
STRING(registeredPrefix));
try {
return SXMPMeta::RegisterNamespace(namespaceURI,
suggestedPrefix,
STRING(registeredPrefix));
}
catch(const XMP_Error & e) {
set_error(e);
}
return false;
}


Expand Down Expand Up @@ -160,8 +166,13 @@ bool xmp_files_open(XmpFilePtr xf, const char *path, XmpOpenFileOptions options)

void xmp_files_close(XmpFilePtr xf, XmpCloseFileOptions options)
{
SXMPFiles *txf = (SXMPFiles*)xf;
txf->CloseFile(options);
try {
SXMPFiles *txf = (SXMPFiles*)xf;
txf->CloseFile(options);
}
catch(const XMP_Error & e) {
set_error(e);
}
}


Expand Down Expand Up @@ -314,15 +325,8 @@ void xmp_free(XmpPtr xmp)


bool xmp_get_property(XmpPtr xmp, const char *schema,
const char *name, XmpStringPtr property)
{
return xmp_get_property_and_bits(xmp, schema, name, property, NULL);
}


bool xmp_get_property_and_bits(XmpPtr xmp, const char *schema,
const char *name, XmpStringPtr property,
uint32_t *propsBits)
const char *name, XmpStringPtr property,
uint32_t *propsBits)
{
bool ret = false;
try {
Expand Down Expand Up @@ -363,15 +367,7 @@ bool xmp_get_array_item(XmpPtr xmp, const char *schema,
return ret;
}

void xmp_set_property(XmpPtr xmp, const char *schema,
const char *name, const char *value)
{
xmp_set_property2(xmp, schema, name, value, 0);
}



bool xmp_set_property2(XmpPtr xmp, const char *schema,
bool xmp_set_property(XmpPtr xmp, const char *schema,
const char *name, const char *value,
uint32_t optionBits)
{
Expand All @@ -381,9 +377,8 @@ bool xmp_set_property2(XmpPtr xmp, const char *schema,
txmp->SetProperty(schema, name, value, optionBits);
}
catch(const XMP_Error & e) {
set_error(-e.GetID());
set_error(e);
ret = false;
std::cerr << e.GetErrMsg() << std::endl;
}
catch(...) {
ret = false;
Expand All @@ -402,9 +397,8 @@ bool xmp_set_array_item(XmpPtr xmp, const char *schema,
txmp->SetArrayItem(schema, name, index, value, optionBits);
}
catch(const XMP_Error & e) {
set_error(-e.GetID());
set_error(e);
ret = false;
std::cerr << e.GetErrMsg() << std::endl;
}
catch(...) {
ret = false;
Expand All @@ -423,9 +417,8 @@ bool xmp_append_array_item(XmpPtr xmp, const char *schema, const char *name,
optionBits);
}
catch(const XMP_Error & e) {
set_error(-e.GetID());
set_error(e);
ret = false;
std::cerr << e.GetErrMsg() << std::endl;
}
catch(...) {
ret = false;
Expand All @@ -441,9 +434,8 @@ bool xmp_delete_property(XmpPtr xmp, const char *schema, const char *name)
txmp->DeleteProperty(schema, name);
}
catch(const XMP_Error & e) {
set_error(-e.GetID());
set_error(e);
ret = false;
std::cerr << e.GetErrMsg() << std::endl;
}
catch(...) {
ret = false;
Expand All @@ -459,9 +451,8 @@ bool xmp_has_property(XmpPtr xmp, const char *schema, const char *name)
ret = txmp->DoesPropertyExist(schema, name);
}
catch(const XMP_Error & e) {
set_error(-e.GetID());
set_error(e);
ret = false;
std::cerr << e.GetErrMsg() << std::endl;
}
catch(...) {
ret = false;
Expand Down Expand Up @@ -503,9 +494,8 @@ bool xmp_set_localized_text(XmpPtr xmp, const char *schema, const char *name,
value, optionBits);
}
catch(const XMP_Error & e) {
set_error(-e.GetID());
set_error(e);
ret = false;
std::cerr << e.GetErrMsg() << std::endl;
}
catch(...) {
ret = false;
Expand All @@ -525,9 +515,8 @@ bool xmp_delete_localized_text(XmpPtr xmp, const char *schema,
specificLang);
}
catch(const XMP_Error & e) {
set_error(-e.GetID());
set_error(e);
ret = false;
std::cerr << e.GetErrMsg() << std::endl;
}
catch(...) {
ret = false;
Expand Down
22 changes: 9 additions & 13 deletions exempi/tests/test1.cpp
Expand Up @@ -84,10 +84,10 @@ void test_write_new_property()

xmp_string_free(reg_prefix);

xmp_set_property(xmp, NS_CC, "License", "Foo");
xmp_set_property(xmp, NS_CC, "License", "Foo", 0);

XmpStringPtr the_prop = xmp_string_new();
BOOST_CHECK(xmp_get_property(xmp, NS_CC, "License", the_prop));
BOOST_CHECK(xmp_get_property(xmp, NS_CC, "License", the_prop, NULL));
BOOST_CHECK_EQUAL(strcmp("Foo", xmp_string_cstr(the_prop)), 0);
xmp_string_free(the_prop);

Expand Down Expand Up @@ -177,25 +177,21 @@ void test_exempi()
BOOST_CHECK(xmp_has_property(xmp, NS_TIFF, "Make"));
BOOST_CHECK_EQUAL(xmp_has_property(xmp, NS_TIFF, "Foo"), false);

BOOST_CHECK(xmp_get_property(xmp, NS_TIFF, "Make", the_prop));
BOOST_CHECK(xmp_get_property(xmp, NS_TIFF, "Make", the_prop, NULL));
BOOST_CHECK_EQUAL(strcmp("Canon", xmp_string_cstr(the_prop)), 0);

xmp_set_property(xmp, NS_TIFF, "Make", "Nikon");
BOOST_CHECK(xmp_get_property(xmp, NS_TIFF, "Make", the_prop));
BOOST_CHECK_EQUAL(strcmp("Nikon", xmp_string_cstr(the_prop)), 0);

BOOST_CHECK(xmp_set_property2(xmp, NS_TIFF, "Make", "Leica", 0));
BOOST_CHECK(xmp_get_property(xmp, NS_TIFF, "Make", the_prop));
BOOST_CHECK(xmp_set_property(xmp, NS_TIFF, "Make", "Leica", 0));
BOOST_CHECK(xmp_get_property(xmp, NS_TIFF, "Make", the_prop, NULL));
BOOST_CHECK_EQUAL(strcmp("Leica", xmp_string_cstr(the_prop)), 0);

uint32_t bits;
BOOST_CHECK(xmp_get_property_and_bits(xmp, NS_DC, "rights[1]/?xml:lang",
the_prop, &bits));
BOOST_CHECK(xmp_get_property(xmp, NS_DC, "rights[1]/?xml:lang",
the_prop, &bits));
BOOST_CHECK_EQUAL(bits, 0x20);
BOOST_CHECK(XMP_IS_PROP_QUALIFIER(bits));

BOOST_CHECK(xmp_get_property_and_bits(xmp, NS_DC, "rights[1]",
the_prop, &bits));
BOOST_CHECK(xmp_get_property(xmp, NS_DC, "rights[1]",
the_prop, &bits));
BOOST_CHECK_EQUAL(bits, 0x50);
BOOST_CHECK(XMP_HAS_PROP_QUALIFIERS(bits));

Expand Down
6 changes: 3 additions & 3 deletions exempi/tests/test2.cpp
Expand Up @@ -77,7 +77,7 @@ void test_xmpfiles_write()
return;
}

xmp_set_property(xmp, NS_PHOTOSHOP, "ICCProfile", "foo");
xmp_set_property(xmp, NS_PHOTOSHOP, "ICCProfile", "foo", 0);

BOOST_CHECK(xmp_files_can_put_xmp(f, xmp));
xmp_files_put_xmp(f, xmp);
Expand All @@ -96,7 +96,7 @@ void test_xmpfiles_write()
BOOST_CHECK(xmp != NULL);

XmpStringPtr the_prop = xmp_string_new();
BOOST_CHECK(xmp_get_property(xmp, NS_PHOTOSHOP, "ICCProfile", the_prop));
BOOST_CHECK(xmp_get_property(xmp, NS_PHOTOSHOP, "ICCProfile", the_prop, NULL));
BOOST_CHECK_EQUAL(strcmp("foo", xmp_string_cstr(the_prop)), 0);

xmp_string_free(the_prop);
Expand Down Expand Up @@ -130,7 +130,7 @@ void test_xmpfiles()

XmpStringPtr the_prop = xmp_string_new();

BOOST_CHECK(xmp_get_property(xmp, NS_PHOTOSHOP, "ICCProfile", the_prop));
BOOST_CHECK(xmp_get_property(xmp, NS_PHOTOSHOP, "ICCProfile", the_prop, NULL));
BOOST_CHECK_EQUAL(strcmp("sRGB IEC61966-2.1", xmp_string_cstr(the_prop)), 0);

xmp_string_free(the_prop);
Expand Down
27 changes: 8 additions & 19 deletions exempi/xmp.h
Expand Up @@ -378,16 +378,6 @@ bool xmp_serialize_and_format(XmpPtr xmp, XmpStringPtr buffer,
uint32_t padding, const char *newline,
const char *tab, int32_t indent);

/** Get an XMP property from the XMP packet
* @param xmp the XMP packet
* @param schema
* @param name
* @param property the allocated XmpStrinPtr
* @return true if found
* @todo deprecate in favor of %xmp_get_property_and_bits()
*/
bool xmp_get_property(XmpPtr xmp, const char *schema,
const char *name, XmpStringPtr property);

/** Get an XMP property and it option bits from the XMP packet
* @param xmp the XMP packet
Expand All @@ -397,9 +387,9 @@ bool xmp_get_property(XmpPtr xmp, const char *schema,
* @param propsBits pointer to the option bits. Pass NULL if not needed
* @return true if found
*/
bool xmp_get_property_and_bits(XmpPtr xmp, const char *schema,
const char *name, XmpStringPtr property,
uint32_t *propsBits);
bool xmp_get_property(XmpPtr xmp, const char *schema,
const char *name, XmpStringPtr property,
uint32_t *propsBits);

/** Get an item frpm an array property
* @param xmp the xmp meta
Expand All @@ -419,13 +409,12 @@ bool xmp_get_array_item(XmpPtr xmp, const char *schema,
* @param schema
* @param name
* @param value 0 terminated string
* @param optionBits
* @return false if failure
*/
void xmp_set_property(XmpPtr xmp, const char *schema,
const char *name, const char *value);

bool xmp_set_property2(XmpPtr xmp, const char *schema,
const char *name, const char *value,
uint32_t optionBits);
bool xmp_set_property(XmpPtr xmp, const char *schema,
const char *name, const char *value,
uint32_t optionBits);


bool xmp_set_array_item(XmpPtr xmp, const char *schema,
Expand Down
2 changes: 1 addition & 1 deletion rpm/SLED10.spec
Expand Up @@ -11,7 +11,7 @@

Summary: XMP support library
Name: exempi
Version: 1.99.2
Version: 1.99.5
Release: 1
License: BSD
Group: System/Libraries
Expand Down

0 comments on commit 605884a

Please sign in to comment.