[niepce] Rust: cleanup



commit 42009612860e7c519a0baa49d29866a0560bb610
Author: Hubert Figuière <hub figuiere net>
Date:   Sun Sep 24 23:24:41 2017 -0400

    Rust: cleanup
    
    - move more function to be cbindgenerated
    - remove dead code
    - fix or remove obsoleted tests.

 src/engine/db/label.hpp              |    4 -
 src/engine/db/libmetadata.cpp        |    1 -
 src/engine/db/libmetadata.rs         |   10 ---
 src/fwk/base/Makefile.am             |   16 +---
 src/fwk/base/colour.cpp              |   33 ++++------
 src/fwk/base/colour.hpp              |   10 ++--
 src/fwk/base/date.cpp                |   96 +++-----------------------
 src/fwk/base/date.hpp                |    1 -
 src/fwk/base/date.rs                 |    4 +-
 src/fwk/base/rgbcolour.rs            |   10 ++--
 src/fwk/base/rust.hpp                |   12 ---
 src/fwk/base/t/testdate.cpp          |   50 --------------
 src/fwk/base/t/testpropertybag.cpp   |   43 ------------
 src/fwk/mod.rs                       |    4 +-
 src/fwk/utils/Makefile.am            |    9 +--
 src/fwk/utils/exempi.cpp             |   12 +---
 src/fwk/utils/exempi.hpp             |   11 +---
 src/fwk/utils/exempi.rs              |   12 ++--
 src/fwk/utils/testufrawmeta.cpp      |  124 +++++++++++++++++-----------------
 src/fwk/utils/testxmp.cpp            |   58 ----------------
 src/niepce/modules/map/mapmodule.cpp |    4 +-
 src/rust_bindings.hpp                |    2 +
 22 files changed, 119 insertions(+), 407 deletions(-)
---
diff --git a/src/engine/db/label.hpp b/src/engine/db/label.hpp
index 9d73056..2aa7b04 100644
--- a/src/engine/db/label.hpp
+++ b/src/engine/db/label.hpp
@@ -27,10 +27,6 @@
 
 #include "rust_bindings.hpp"
 
-namespace fwk {
-class RgbColour;
-}
-
 namespace eng {
 
 
diff --git a/src/engine/db/libmetadata.cpp b/src/engine/db/libmetadata.cpp
index f05efb8..1abed0f 100644
--- a/src/engine/db/libmetadata.cpp
+++ b/src/engine/db/libmetadata.cpp
@@ -28,7 +28,6 @@
 
 #include "fwk/base/date.hpp"
 #include "fwk/base/debug.hpp"
-#include "fwk/base/rust.hpp"
 #include "fwk/utils/exempi.hpp"
 #include "fwk/utils/stringutils.hpp"
 #include "libmetadata.hpp"
diff --git a/src/engine/db/libmetadata.rs b/src/engine/db/libmetadata.rs
index f80b332..604880c 100644
--- a/src/engine/db/libmetadata.rs
+++ b/src/engine/db/libmetadata.rs
@@ -234,16 +234,6 @@ pub extern "C" fn engine_libmetadata_get_id(meta: &LibMetadata) -> LibraryId {
 }
 
 #[no_mangle]
-pub extern "C" fn engine_libmetadata_get_xmp(meta: &LibMetadata) -> exempi::Xmp {
-    meta.xmp.xmp.clone()
-}
-
-#[no_mangle]
-pub extern "C" fn engine_libmetadata_get_xmpmeta(meta: &LibMetadata) -> *const XmpMeta {
-    &meta.xmp
-}
-
-#[no_mangle]
 pub extern "C" fn engine_libmetadata_to_properties(meta: &LibMetadata, propset: &PropertySet)
                                         -> *mut PropertyBag {
     let result = Box::new(meta.to_properties(propset));
diff --git a/src/fwk/base/Makefile.am b/src/fwk/base/Makefile.am
index 7cde84f..a0b7a1a 100644
--- a/src/fwk/base/Makefile.am
+++ b/src/fwk/base/Makefile.am
@@ -7,15 +7,11 @@ AM_CPPFLAGS = -I$(top_srcdir)/src \
 noinst_LIBRARIES = libfwkbase.a
 
 
-TESTS = testmoniker testgeometry testdate testmap\
-       testoption testpropertybag
+TESTS = testmoniker testgeometry testmap\
+       testoption
 
-check_PROGRAMS = testmoniker testgeometry testdate testmap\
-       testoption testpropertybag
-
-testdate_SOURCES = t/testdate.cpp
-testdate_LDADD = libfwkbase.a \
-       @FRAMEWORK_LIBS@
+check_PROGRAMS = testmoniker testgeometry testmap\
+       testoption
 
 testmoniker_SOURCES = t/testmoniker.cpp
 testmoniker_LDADD = libfwkbase.a \
@@ -33,10 +29,6 @@ testoption_SOURCES = t/testoption.cpp
 testoption_LDADD = libfwkbase.a \
        @FRAMEWORK_LIBS@
 
-testpropertybag_SOURCES = t/testpropertybag.cpp
-testpropertybag_LDADD = libfwkbase.a \
-       @FRAMEWORK_LIBS@
-
 libfwkbase_a_SOURCES = colour.hpp colour.cpp \
        autoflag.hpp \
        date.hpp date.cpp \
diff --git a/src/fwk/base/colour.cpp b/src/fwk/base/colour.cpp
index f91d846..97fc51f 100644
--- a/src/fwk/base/colour.cpp
+++ b/src/fwk/base/colour.cpp
@@ -18,47 +18,40 @@
  */
 
 #include "fwk/base/colour.hpp"
-#include "fwk/base/rust.hpp"
 
-// Rust glue.
-
-extern "C" {
-
-fwk::RgbColour* fwk_rgbcolour_new(uint16_t r, uint16_t g, uint16_t b);
-fwk::RgbColour* fwk_rgbcolour_clone(const fwk::RgbColour*);
-void fwk_rgbcolour_delete(fwk::RgbColour*);
-}
+#include "rust_bindings.hpp"
 
 namespace fwk {
 
 RgbColourPtr rgbcolour_new(uint16_t r, uint16_t g, uint16_t b)
 {
-    return rgbcolour_wrap(fwk_rgbcolour_new(r, g, b));
+  return rgbcolour_wrap(ffi::fwk_rgbcolour_new(r, g, b));
 }
 
 RgbColourPtr rgbcolour_clone(const RgbColour* c)
 {
-    return rgbcolour_wrap(fwk_rgbcolour_clone(c));
+  return rgbcolour_wrap(ffi::fwk_rgbcolour_clone(c));
 }
 
 RgbColourPtr rgbcolour_wrap(RgbColour* c)
 {
-    return RgbColourPtr(c, &fwk_rgbcolour_delete);
+  return RgbColourPtr(c, &ffi::fwk_rgbcolour_delete);
 }
 
 std::string rgbcolour_to_string(uint16_t r, uint16_t g, uint16_t b)
 {
-    RgbColour* colour = fwk_rgbcolour_new(r, g, b);
-    std::string s = rgbcolour_to_string(colour);
-    fwk_rgbcolour_delete(colour);
-    return s;
+  RgbColour* colour = ffi::fwk_rgbcolour_new(r, g, b);
+  std::string s = rgbcolour_to_string(colour);
+  ffi::fwk_rgbcolour_delete(colour);
+  return s;
 }
 
 std::string rgbcolour_to_string(const RgbColour* c)
 {
-    char* p = fwk_rgbcolour_to_string(c);
-    std::string s(p);
-    rust_cstring_delete(p);
-    return s;
+  char* p = ffi::fwk_rgbcolour_to_string(c);
+  std::string s(p);
+  ffi::rust_cstring_delete(p);
+  return s;
 }
+
 }
diff --git a/src/fwk/base/colour.hpp b/src/fwk/base/colour.hpp
index e758969..523a294 100644
--- a/src/fwk/base/colour.hpp
+++ b/src/fwk/base/colour.hpp
@@ -22,9 +22,14 @@
 #include <memory>
 #include <string>
 
+#include "rust_bindings.hpp"
+
 namespace fwk {
 
+#if RUST_BINDGEN
 class RgbColour;
+#endif
+
 typedef std::shared_ptr<RgbColour> RgbColourPtr;
 
 RgbColourPtr rgbcolour_new(uint16_t r, uint16_t g, uint16_t b);
@@ -34,8 +39,3 @@ RgbColourPtr rgbcolour_wrap(RgbColour*);
 std::string rgbcolour_to_string(uint16_t r, uint16_t g, uint16_t b);
 std::string rgbcolour_to_string(const RgbColour*);
 }
-
-extern "C" {
-uint16_t fwk_rgbcolour_component(const fwk::RgbColour*, int32_t idx);
-char* fwk_rgbcolour_to_string(const fwk::RgbColour*);
-}
diff --git a/src/fwk/base/date.cpp b/src/fwk/base/date.cpp
index a481561..31ac274 100644
--- a/src/fwk/base/date.cpp
+++ b/src/fwk/base/date.cpp
@@ -1,7 +1,7 @@
 /*
- * niepce - fwk/base/date.hpp
+ * niepce - fwk/base/date.cpp
  *
- * Copyright (C) 2012 Hubert Figuiere
+ * Copyright (C) 2012-2017 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,19 +22,20 @@
 
 #include "date.hpp"
 #include "debug.hpp"
-#include "rust.hpp"
 
-// rust glue
-extern "C" {
-void fwk_date_delete(fwk::Date*);
-char* fwk_date_to_string(const fwk::Date*);
+#include "rust_bindings.hpp"
+
+// cbindgen seems to not like to generate declaration for this.
+// XXX remove when it does
+namespace ffi {
+extern "C" char* fwk_date_to_string(const fwk::Date*);
 }
 
 namespace fwk {
 
 DatePtr date_wrap(fwk::Date* date)
 {
-    return DatePtr(date, fwk_date_delete);
+    return DatePtr(date, ffi::fwk_date_delete);
 }
 
 std::string date_to_string(const Date* d)
@@ -43,87 +44,12 @@ std::string date_to_string(const Date* d)
     if (!d) {
         return "";
     }
-    char* p = fwk_date_to_string(d);
+    char* p = ffi::fwk_date_to_string(d);
     std::string s(p);
-    rust_cstring_delete(p);
+    ffi::rust_cstring_delete(p);
     return s;
 }
 
-#if 0
-time_t make_time_value(const Date & d)
-{
-    time_t date = 0;
-
-    const XmpDateTime & value = d.xmp_date();
-    struct tm dt;
-    dt.tm_sec = value.second;
-    dt.tm_min = value.minute;
-    dt.tm_hour = value.hour;
-    dt.tm_mday = value.day;
-    dt.tm_mon = value.month;
-    dt.tm_year = value.year - 1900;
-    dt.tm_isdst = -1;
-    // this field is supposed to be a glibc extension. oh joy.
-    dt.tm_gmtoff = value.tzSign * ((value.tzHour * 3600) +
-                                   (value.tzMinute * 60));
-    date = mktime(&dt);
-    DBG_ASSERT(date != -1, "date is -1");
-
-    return date;
-}
-#endif
-
-bool make_xmp_date_time(time_t t, XmpDateTime& xmp_dt)
-{
-    struct tm gmt;
-    struct tm* pgmt = gmtime_r(&t, &gmt);
-    DBG_ASSERT(pgmt == &gmt, "gmtime failed");
-
-    if (!pgmt) {
-        return false;
-    }
-
-    xmp_dt.year = pgmt->tm_year + 1900;
-    xmp_dt.month = pgmt->tm_mon + 1;
-    xmp_dt.day = pgmt->tm_mday;
-    xmp_dt.hour = pgmt->tm_hour;
-    xmp_dt.minute = pgmt->tm_min;
-    xmp_dt.second = pgmt->tm_sec;
-    xmp_dt.tzSign = 0;
-    xmp_dt.tzHour = 0;
-    xmp_dt.tzMinute = 0;
-    xmp_dt.nanoSecond = 0;
-
-    return true;
-}
-
-#if 0
-Date::Date(const XmpDateTime& dt, const Timezone* tz)
-    : m_datetime(dt)
-    , m_tz(tz)
-{
-}
-
-Date::Date(const time_t dt, const Timezone* tz)
-    : m_tz(tz)
-{
-    make_xmp_date_time(dt, m_datetime);
-}
-
-std::string Date::to_string() const
-{
-    char buffer[256];
-
-    snprintf(buffer, 256, "%.4u:%.2u:%.2d %.2u:%.2u:%.2u %c%.2u%.2u",
-             m_datetime.year, m_datetime.month,
-             m_datetime.day, m_datetime.hour,
-             m_datetime.minute, m_datetime.second,
-             m_datetime.tzSign >= 0 ? '+' : '-',
-             m_datetime.tzHour, m_datetime.tzMinute);
-
-    return buffer;
-}
-#endif
 }
 
 /*
diff --git a/src/fwk/base/date.hpp b/src/fwk/base/date.hpp
index ba92439..d6bd5bd 100644
--- a/src/fwk/base/date.hpp
+++ b/src/fwk/base/date.hpp
@@ -42,7 +42,6 @@ class Date;
 
 typedef std::shared_ptr<Date> DatePtr;
 
-
 DatePtr date_wrap(Date*);
 std::string date_to_string(const Date*);
 }
diff --git a/src/fwk/base/date.rs b/src/fwk/base/date.rs
index 0dc8032..5fe9928 100644
--- a/src/fwk/base/date.rs
+++ b/src/fwk/base/date.rs
@@ -139,12 +139,12 @@ pub fn make_xmp_date_time(t: Time, xmp_dt: &mut exempi::DateTime) -> bool {
 }
 
 #[no_mangle]
-pub fn fwk_date_delete(date: *mut Date) {
+pub extern "C" fn fwk_date_delete(date: *mut Date) {
     unsafe { Box::from_raw(date); }
 }
 
 #[no_mangle]
-pub fn fwk_date_to_string(date: &Date) -> *mut libc::c_char {
+pub extern "C" fn fwk_date_to_string(date: &Date) -> *mut libc::c_char {
     CString::new(date.to_string().as_bytes()).unwrap().into_raw()
 }
 
diff --git a/src/fwk/base/rgbcolour.rs b/src/fwk/base/rgbcolour.rs
index 56aed43..29979c5 100644
--- a/src/fwk/base/rgbcolour.rs
+++ b/src/fwk/base/rgbcolour.rs
@@ -76,17 +76,17 @@ impl ToString for RgbColour {
 }
 
 #[no_mangle]
-pub fn fwk_rgbcolour_to_string(c: &RgbColour) -> *mut c_char {
+pub extern "C" fn fwk_rgbcolour_to_string(c: &RgbColour) -> *mut c_char {
     CString::new(c.to_string().as_bytes()).unwrap().into_raw()
 }
 
 #[no_mangle]
-pub fn fwk_rgbcolour_delete(c: *mut RgbColour) {
+pub extern "C" fn fwk_rgbcolour_delete(c: *mut RgbColour) {
     unsafe { Box::from_raw(c); }
 }
 
 #[no_mangle]
-pub fn fwk_rgbcolour_component(c: &RgbColour, idx: i32) -> u16 {
+pub extern "C" fn fwk_rgbcolour_component(c: &RgbColour, idx: i32) -> u16 {
     match idx {
         0 => c.r,
         1 => c.g,
@@ -96,11 +96,11 @@ pub fn fwk_rgbcolour_component(c: &RgbColour, idx: i32) -> u16 {
 }
 
 #[no_mangle]
-pub fn fwk_rgbcolour_new(r: u16, g: u16, b: u16) -> *mut RgbColour {
+pub extern "C" fn fwk_rgbcolour_new(r: u16, g: u16, b: u16) -> *mut RgbColour {
     Box::into_raw(Box::new(RgbColour::new(r, g, b)))
 }
 
 #[no_mangle]
-pub fn fwk_rgbcolour_clone(c: &RgbColour) -> *mut RgbColour {
+pub extern "C" fn fwk_rgbcolour_clone(c: &RgbColour) -> *mut RgbColour {
     Box::into_raw(Box::new(c.clone()))
 }
diff --git a/src/fwk/mod.rs b/src/fwk/mod.rs
index 581d3ed..c861b4b 100644
--- a/src/fwk/mod.rs
+++ b/src/fwk/mod.rs
@@ -48,7 +48,7 @@ use std::ffi::CStr;
 use libc::c_char;
 
 #[no_mangle]
-pub extern fn fwk_gps_coord_from_xmp(cvalue: *const c_char) -> f64 {
+pub extern "C" fn fwk_gps_coord_from_xmp(cvalue: *const c_char) -> f64 {
     let value = unsafe { CStr::from_ptr(cvalue) };
     if let Ok(svalue) = value.to_str() {
         if let Some(coord) = gps_coord_from_xmp(svalue) {
@@ -59,7 +59,7 @@ pub extern fn fwk_gps_coord_from_xmp(cvalue: *const c_char) -> f64 {
 }
 
 #[no_mangle]
-pub extern fn fwk_fraction_to_decimal(cvalue: *const c_char) -> f64 {
+pub extern "C" fn fwk_fraction_to_decimal(cvalue: *const c_char) -> f64 {
     let value = unsafe { CStr::from_ptr(cvalue) };
     if let Ok(svalue) = value.to_str() {
         if let Some(dec) = fraction_to_decimal(svalue) {
diff --git a/src/fwk/utils/Makefile.am b/src/fwk/utils/Makefile.am
index b88dc9f..aac7e08 100644
--- a/src/fwk/utils/Makefile.am
+++ b/src/fwk/utils/Makefile.am
@@ -2,13 +2,13 @@
 AM_CPPFLAGS = -I$(top_srcdir)/src/ \
        @FRAMEWORK_CFLAGS@
 
-TESTS = testfiles testxmp \
+TESTS = testfiles \
        testpathutils \
        teststringutils testufrawmeta
 
 EXTRA_DIST = test.xmp test2.ufraw MODULES_HOWTO
 
-check_PROGRAMS = testfiles testxmp \
+check_PROGRAMS = testfiles \
        testpathutils \
        teststringutils testufrawmeta
 
@@ -19,11 +19,6 @@ testfiles_LDADD = libniepceutils.a \
        @FRAMEWORK_LIBS@
 
 
-testxmp_SOURCES = testxmp.cpp
-testxmp_LDADD = libniepceutils.a \
-       ../base/libfwkbase.a \
-       @FRAMEWORK_LIBS@
-
 testufrawmeta_SOURCES = testufrawmeta.cpp
 testufrawmeta_CXXFLAGS =  -g -O0
 testufrawmeta_LDADD = libniepceutils.a \
diff --git a/src/fwk/utils/exempi.cpp b/src/fwk/utils/exempi.cpp
index 8ccd79a..a84ee4a 100644
--- a/src/fwk/utils/exempi.cpp
+++ b/src/fwk/utils/exempi.cpp
@@ -20,8 +20,6 @@
 #include <string.h>
 #include <time.h>
 
-#include <boost/lexical_cast.hpp>
-
 #include <giomm/file.h>
 #include <glib.h>
 
@@ -43,18 +41,12 @@ const char* UFRAW_INTEROP_NAMESPACE =
 const char* UFRAW_INTEROP_NS_PREFIX = "ufrint";
 }
 
-extern "C" {
-
-fwk::ExempiManager* fwk_exempi_manager_new();
-void fwk_exempi_manager_delete(fwk::ExempiManager*);
-}
-
 namespace fwk {
 
 ExempiManagerPtr exempi_manager_new()
 {
-    return ExempiManagerPtr(fwk_exempi_manager_new(),
-                            &fwk_exempi_manager_delete);
+    return ExempiManagerPtr(ffi::fwk_exempi_manager_new(),
+                            &ffi::fwk_exempi_manager_delete);
 }
 }
 
diff --git a/src/fwk/utils/exempi.hpp b/src/fwk/utils/exempi.hpp
index 1582632..ac88c26 100644
--- a/src/fwk/utils/exempi.hpp
+++ b/src/fwk/utils/exempi.hpp
@@ -89,10 +89,10 @@ namespace fwk {
 
 #if RUST_BINDGEN
 class Date;
+class ExempiManager;
 #endif
 
 class XmpMeta;
-class ExempiManager;
 typedef std::shared_ptr<ExempiManager> ExempiManagerPtr;
 
 ExempiManagerPtr exempi_manager_new();
@@ -100,15 +100,6 @@ ExempiManagerPtr exempi_manager_new();
 }
 
 
-extern "C" {
-    double fwk_gps_coord_from_xmp(const char* value);
-    int32_t fwk_xmp_meta_get_orientation(const fwk::XmpMeta*);
-    int32_t fwk_xmp_meta_get_rating(const fwk::XmpMeta*);
-    // the pointer must be released by calling rust_cstring_delete()
-    char* fwk_xmp_meta_get_label(const fwk::XmpMeta*);
-    fwk::Date* fwk_xmp_meta_get_creation_date(const fwk::XmpMeta*);
-}
-
 /*
   Local Variables:
   mode:c++
diff --git a/src/fwk/utils/exempi.rs b/src/fwk/utils/exempi.rs
index 8cd688e..0eaeb2d 100644
--- a/src/fwk/utils/exempi.rs
+++ b/src/fwk/utils/exempi.rs
@@ -272,17 +272,17 @@ pub fn gps_coord_from_xmp(xmps: &str) -> Option<f64> {
 }
 
 #[no_mangle]
-pub fn fwk_exempi_manager_new() -> *mut ExempiManager {
+pub extern "C" fn fwk_exempi_manager_new() -> *mut ExempiManager {
     return Box::into_raw(Box::new(ExempiManager::new(None)))
 }
 
 #[no_mangle]
-pub fn fwk_exempi_manager_delete(em: *mut ExempiManager) {
+pub extern "C" fn fwk_exempi_manager_delete(em: *mut ExempiManager) {
     unsafe { Box::from_raw(em); }
 }
 
 #[no_mangle]
-pub fn fwk_xmp_meta_get_orientation(xmp: &XmpMeta) -> i32 {
+pub extern "C" fn fwk_xmp_meta_get_orientation(xmp: &XmpMeta) -> i32 {
     if let Some(o) = xmp.orientation() {
         return o;
     }
@@ -290,7 +290,7 @@ pub fn fwk_xmp_meta_get_orientation(xmp: &XmpMeta) -> i32 {
 }
 
 #[no_mangle]
-pub fn fwk_xmp_meta_get_rating(xmp: &XmpMeta) -> i32 {
+pub extern "C" fn fwk_xmp_meta_get_rating(xmp: &XmpMeta) -> i32 {
     if let Some(r) = xmp.rating() {
         return r;
     }
@@ -299,7 +299,7 @@ pub fn fwk_xmp_meta_get_rating(xmp: &XmpMeta) -> i32 {
 
 
 #[no_mangle]
-pub fn fwk_xmp_meta_get_label(xmp: &XmpMeta) -> *mut c_char {
+pub extern "C" fn fwk_xmp_meta_get_label(xmp: &XmpMeta) -> *mut c_char {
     if let Some(s) = xmp.label() {
         return CString::new(s.as_bytes()).unwrap().into_raw()
     }
@@ -307,7 +307,7 @@ pub fn fwk_xmp_meta_get_label(xmp: &XmpMeta) -> *mut c_char {
 }
 
 #[no_mangle]
-pub fn fwk_xmp_meta_get_creation_date(xmp: &XmpMeta) -> *mut Date {
+pub extern "C" fn fwk_xmp_meta_get_creation_date(xmp: &XmpMeta) -> *mut Date {
     if let Some(d) = xmp.creation_date() {
         return Box::into_raw(Box::new(d));
     }
diff --git a/src/fwk/utils/testufrawmeta.cpp b/src/fwk/utils/testufrawmeta.cpp
index 93d3a88..2abc1bb 100644
--- a/src/fwk/utils/testufrawmeta.cpp
+++ b/src/fwk/utils/testufrawmeta.cpp
@@ -36,73 +36,73 @@ int test_main( int, char *[] )             // note the name!
   fwk::utils::init();
 
   std::string dir;
-       const char * pdir = getenv("srcdir");
-       if(pdir == NULL) {
-               dir = ".";
-       }
-       else {
-               dir = pdir;
-       }
-       fwk::ExempiManager xmpManager(NULL);
+  const char * pdir = getenv("srcdir");
+  if(pdir == NULL) {
+    dir = ".";
+  }
+  else {
+    dir = pdir;
+  }
+  fwk::ExempiManagerPtr exemmpi_manager_new();
 
   xmp::ScopedPtr<XmpPtr> xmp(xmp_new_empty());
 
-       fwk::UfrawMeta ufraw(dir + "/test2.ufraw");
+  fwk::UfrawMeta ufraw(dir + "/test2.ufraw");
 
-       BOOST_CHECK(ufraw.ufraw_to_xmp(xmp));
+  BOOST_CHECK(ufraw.ufraw_to_xmp(xmp));
 
   xmp::ScopedPtr<XmpStringPtr> property(xmp_string_new());
-       BOOST_CHECK(property != NULL);
-       BOOST_CHECK(xmp_get_property(xmp, NS_CAMERA_RAW_SETTINGS,
-                                                                "WhiteBalance", property, NULL));
-       BOOST_CHECK(strcmp("Auto", xmp_string_cstr(property)) == 0);
-
-       int32_t t = 0;
-       BOOST_CHECK(xmp_get_property_int32(xmp, NS_CAMERA_RAW_SETTINGS,
-                                                                          "Temperature", &t, NULL));
-       BOOST_CHECK(t == 3684);
-       double exposure = 0;
-       BOOST_CHECK(xmp_get_property_float(xmp, NS_CAMERA_RAW_SETTINGS,
-                                                                          "Exposure", &exposure, NULL));
-       BOOST_CHECK(exposure == 1.0);
-       
-       bool hasCrop = false;
-       BOOST_CHECK(xmp_get_property_bool(xmp, NS_CAMERA_RAW_SETTINGS,
-                                                                         "HasCrop", &hasCrop, NULL));
-       BOOST_CHECK(hasCrop);
-       
-       
-       BOOST_CHECK(xmp_get_property_int32(xmp, NS_CAMERA_RAW_SETTINGS,
-                                                                          "CropUnits", &t, NULL));
-       BOOST_CHECK(t == 0);
-
-
-       double aDim = 0;
-       BOOST_CHECK(xmp_get_property_float(xmp, NS_CAMERA_RAW_SETTINGS,
-                                                                          "CropLeft", &aDim, NULL));
-       BOOST_CHECK(aDim == 0);
-       BOOST_CHECK(xmp_get_property_float(xmp, NS_CAMERA_RAW_SETTINGS,
-                                                                          "CropTop", &aDim, NULL));
-       BOOST_CHECK(aDim == 201);
-       BOOST_CHECK(xmp_get_property_float(xmp, NS_CAMERA_RAW_SETTINGS,
-                                                                          "CropBottom", &aDim, NULL));
-       BOOST_CHECK(aDim == 3522);
-       BOOST_CHECK(xmp_get_property_float(xmp, NS_CAMERA_RAW_SETTINGS,
-                                                                          "CropRight", &aDim, NULL));
-       BOOST_CHECK(aDim == 2213);
-
-       BOOST_CHECK(xmp_get_property_float(xmp, NS_CAMERA_RAW_SETTINGS,
-                                                                          "CropWidth", &aDim, NULL));
-       BOOST_CHECK(aDim == 2213);
-       BOOST_CHECK(xmp_get_property_float(xmp, NS_CAMERA_RAW_SETTINGS,
-                                                                          "CropHeight", &aDim, NULL));
-       BOOST_CHECK(aDim == 3321);
-
-       bool imported = false;
-       BOOST_CHECK(xmp_get_property_bool(xmp, xmp::UFRAW_INTEROP_NAMESPACE,
-                                                                         "ImportedFromUFraw", &imported, 
NULL));
-       BOOST_CHECK(imported);
-
-       return 0;
+  BOOST_CHECK(property != NULL);
+  BOOST_CHECK(xmp_get_property(xmp, NS_CAMERA_RAW_SETTINGS,
+                               "WhiteBalance", property, NULL));
+  BOOST_CHECK(strcmp("Auto", xmp_string_cstr(property)) == 0);
+
+  int32_t t = 0;
+  BOOST_CHECK(xmp_get_property_int32(xmp, NS_CAMERA_RAW_SETTINGS,
+                                     "Temperature", &t, NULL));
+  BOOST_CHECK(t == 3684);
+  double exposure = 0;
+  BOOST_CHECK(xmp_get_property_float(xmp, NS_CAMERA_RAW_SETTINGS,
+                                     "Exposure", &exposure, NULL));
+  BOOST_CHECK(exposure == 1.0);
+
+  bool hasCrop = false;
+  BOOST_CHECK(xmp_get_property_bool(xmp, NS_CAMERA_RAW_SETTINGS,
+                                    "HasCrop", &hasCrop, NULL));
+  BOOST_CHECK(hasCrop);
+
+
+  BOOST_CHECK(xmp_get_property_int32(xmp, NS_CAMERA_RAW_SETTINGS,
+                                     "CropUnits", &t, NULL));
+  BOOST_CHECK(t == 0);
+
+
+  double aDim = 0;
+  BOOST_CHECK(xmp_get_property_float(xmp, NS_CAMERA_RAW_SETTINGS,
+                                     "CropLeft", &aDim, NULL));
+  BOOST_CHECK(aDim == 0);
+  BOOST_CHECK(xmp_get_property_float(xmp, NS_CAMERA_RAW_SETTINGS,
+                                     "CropTop", &aDim, NULL));
+  BOOST_CHECK(aDim == 201);
+  BOOST_CHECK(xmp_get_property_float(xmp, NS_CAMERA_RAW_SETTINGS,
+                                     "CropBottom", &aDim, NULL));
+  BOOST_CHECK(aDim == 3522);
+  BOOST_CHECK(xmp_get_property_float(xmp, NS_CAMERA_RAW_SETTINGS,
+                                     "CropRight", &aDim, NULL));
+  BOOST_CHECK(aDim == 2213);
+
+  BOOST_CHECK(xmp_get_property_float(xmp, NS_CAMERA_RAW_SETTINGS,
+                                     "CropWidth", &aDim, NULL));
+  BOOST_CHECK(aDim == 2213);
+  BOOST_CHECK(xmp_get_property_float(xmp, NS_CAMERA_RAW_SETTINGS,
+                                     "CropHeight", &aDim, NULL));
+  BOOST_CHECK(aDim == 3321);
+
+  bool imported = false;
+  BOOST_CHECK(xmp_get_property_bool(xmp, xmp::UFRAW_INTEROP_NAMESPACE,
+                                    "ImportedFromUFraw", &imported, NULL));
+  BOOST_CHECK(imported);
+
+  return 0;
 }
 
diff --git a/src/niepce/modules/map/mapmodule.cpp b/src/niepce/modules/map/mapmodule.cpp
index a816268..601b94c 100644
--- a/src/niepce/modules/map/mapmodule.cpp
+++ b/src/niepce/modules/map/mapmodule.cpp
@@ -90,7 +90,7 @@ MapModule::on_lib_notification(const eng::LibNotification &ln)
                 fwk::PropertyValuePtr val = result.unwrap();
                 // it is a string
                 if (fwk_property_value_is_string(val.get())) {
-                    longitude = fwk_gps_coord_from_xmp(
+                    longitude = ffi::fwk_gps_coord_from_xmp(
                         fwk::property_value_get_string(*val).c_str());
                 }
             }
@@ -99,7 +99,7 @@ MapModule::on_lib_notification(const eng::LibNotification &ln)
                 fwk::PropertyValuePtr val = result.unwrap();
                 // it is a string
                 if (fwk_property_value_is_string(val.get())) {
-                    latitude = fwk_gps_coord_from_xmp(
+                    latitude = ffi::fwk_gps_coord_from_xmp(
                         fwk::property_value_get_string(*val).c_str());
                 }
             }
diff --git a/src/rust_bindings.hpp b/src/rust_bindings.hpp
index fc3f95e..1a157a8 100644
--- a/src/rust_bindings.hpp
+++ b/src/rust_bindings.hpp
@@ -31,10 +31,12 @@ using eng::QueriedContent;
 
 namespace fwk {
 
+typedef ffi::ExempiManager ExempiManager;
 typedef ffi::PropertyValue PropertyValue;
 typedef ffi::PropertyBag PropertyBag;
 typedef ffi::PropertySet PropertySet;
 typedef ffi::Date Date;
+typedef ffi::RgbColour RgbColour;
 
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]