[niepce] rust: remove bindgen dependency
- From: Hubert Figuière <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] rust: remove bindgen dependency
- Date: Thu, 18 Mar 2021 00:38:52 +0000 (UTC)
commit f3b3378456e58e6885d3c01b1ad4557a5fcc3360
Author: Hubert Figuière <hub figuiere net>
Date: Fri Feb 26 20:23:54 2021 -0500
rust: remove bindgen dependency
Cargo.lock | 205 ++---------------------
crates/npc-engine/Cargo.toml | 4 +-
crates/npc-engine/build.rs | 54 ------
crates/npc-engine/src/db/libfile.rs | 22 +--
crates/npc-engine/src/db/libmetadata.rs | 46 +++--
crates/npc-engine/src/db/library.rs | 20 +--
crates/npc-engine/src/db/mod.rs | 3 +-
crates/npc-engine/src/db/props.rs | 67 ++++++++
crates/npc-engine/src/lib.rs | 8 +-
crates/npc-engine/src/library/commands.rs | 4 +-
crates/npc-fwk/src/utils/exempi.rs | 7 +-
niepce-main/examples/widget-test.rs | 22 +--
niepce-main/src/libraryclient/clientimpl.rs | 4 +-
niepce-main/src/libraryclient/clientinterface.rs | 4 +-
niepce-main/src/libraryclient/mod.rs | 4 +-
niepce-main/src/niepce/ui/image_list_store.rs | 12 +-
src/Makefile.am | 1 +
src/engine/db/label.hpp | 6 +-
src/engine/db/libfile.hpp | 6 +-
src/engine/db/libmetadata.cpp | 50 +-----
src/engine/db/libmetadata.hpp | 17 +-
src/engine/db/metadata.hpp | 6 +-
src/fwk/base/colour.hpp | 4 -
src/fwk/base/date.hpp | 4 -
src/fwk/base/propertybag.hpp | 9 -
src/fwk/utils/exempi.hpp | 5 -
src/fwk/utils/files.hpp | 4 -
src/rust_bindings.hpp | 4 -
28 files changed, 158 insertions(+), 444 deletions(-)
---
diff --git a/Cargo.lock b/Cargo.lock
index 0fc8284..bd2337a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,14 +1,5 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
-[[package]]
-name = "aho-corasick"
-version = "0.7.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "743ad5a418686aad3b87fd14c43badd828cf26e214a00f92a384291cf22e1811"
-dependencies = [
- "memchr",
-]
-
[[package]]
name = "ansi_term"
version = "0.11.0"
@@ -67,30 +58,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
-[[package]]
-name = "bindgen"
-version = "0.53.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "99de13bb6361e01e493b3db7928085dcc474b7ba4f5481818e53a89d76b8393f"
-dependencies = [
- "bitflags",
- "cexpr",
- "cfg-if",
- "clang-sys",
- "clap",
- "env_logger",
- "lazy_static",
- "lazycell",
- "log",
- "peeking_take_while",
- "proc-macro2",
- "quote",
- "regex",
- "rustc-hash",
- "shlex",
- "which",
-]
-
[[package]]
name = "bitflags"
version = "1.2.1"
@@ -155,15 +122,6 @@ version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd"
-[[package]]
-name = "cexpr"
-version = "0.3.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fce5b5fb86b0c57c20c834c1b412fd09c77c8a59b9473f86272709e78874cd1d"
-dependencies = [
- "nom",
-]
-
[[package]]
name = "cfg-if"
version = "0.1.10"
@@ -181,17 +139,6 @@ dependencies = [
"time",
]
-[[package]]
-name = "clang-sys"
-version = "0.28.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "81de550971c976f176130da4b2978d3b524eaa0fd9ac31f3ceb5ae1231fb4853"
-dependencies = [
- "glob",
- "libc",
- "libloading",
-]
-
[[package]]
name = "clap"
version = "2.33.0"
@@ -222,19 +169,6 @@ version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
-[[package]]
-name = "env_logger"
-version = "0.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
-dependencies = [
- "atty",
- "humantime",
- "log",
- "regex",
- "termcolor",
-]
-
[[package]]
name = "exempi"
version = "2.6.0"
@@ -519,12 +453,6 @@ dependencies = [
"system-deps",
]
-[[package]]
-name = "glob"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
-
[[package]]
name = "gobject-sys"
version = "0.10.0"
@@ -600,15 +528,6 @@ dependencies = [
"libc",
]
-[[package]]
-name = "humantime"
-version = "1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
-dependencies = [
- "quick-error",
-]
-
[[package]]
name = "itertools"
version = "0.9.0"
@@ -630,28 +549,12 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
-[[package]]
-name = "lazycell"
-version = "1.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
-
[[package]]
name = "libc"
version = "0.2.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
-[[package]]
-name = "libloading"
-version = "0.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"
-dependencies = [
- "cc",
- "winapi",
-]
-
[[package]]
name = "libopenraw-rs"
version = "0.1.0"
@@ -709,6 +612,12 @@ dependencies = [
"linked-hash-map",
]
+[[package]]
+name = "maplit"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
+
[[package]]
name = "maybe-uninit"
version = "2.0.0"
@@ -751,30 +660,20 @@ dependencies = [
"once_cell 0.2.4",
]
-[[package]]
-name = "nom"
-version = "4.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6"
-dependencies = [
- "memchr",
- "version_check 0.1.5",
-]
-
[[package]]
name = "npc-engine"
version = "0.1.0"
dependencies = [
- "bindgen",
"cbindgen",
"chrono",
"exempi",
"gdk-pixbuf",
"gdk-pixbuf-sys",
"glib",
+ "lazy_static",
"libc",
+ "maplit",
"npc-fwk",
- "pkg-config",
"rusqlite",
"try_opt",
]
@@ -903,12 +802,6 @@ dependencies = [
"winapi",
]
-[[package]]
-name = "peeking_take_while"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
-
[[package]]
name = "pin-project"
version = "0.4.22"
@@ -966,7 +859,7 @@ dependencies = [
"proc-macro2",
"quote",
"syn",
- "version_check 0.9.2",
+ "version_check",
]
[[package]]
@@ -979,7 +872,7 @@ dependencies = [
"quote",
"syn",
"syn-mid",
- "version_check 0.9.2",
+ "version_check",
]
[[package]]
@@ -1008,12 +901,6 @@ dependencies = [
"unicode-xid",
]
-[[package]]
-name = "quick-error"
-version = "1.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
-
[[package]]
name = "quote"
version = "1.0.2"
@@ -1070,24 +957,6 @@ version = "0.1.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
-[[package]]
-name = "regex"
-version = "1.3.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "322cf97724bea3ee221b78fe25ac9c46114ebb51747ad5babd51a2fc6a8235a8"
-dependencies = [
- "aho-corasick",
- "memchr",
- "regex-syntax",
- "thread_local",
-]
-
-[[package]]
-name = "regex-syntax"
-version = "0.6.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b28dfe3fe9badec5dbf0a79a9cccad2cfc2ab5484bdb3e44cbd1ae8b3ba2be06"
-
[[package]]
name = "remove_dir_all"
version = "0.5.2"
@@ -1120,12 +989,6 @@ dependencies = [
"time",
]
-[[package]]
-name = "rustc-hash"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
-
[[package]]
name = "rustc_version"
version = "0.2.3"
@@ -1193,12 +1056,6 @@ dependencies = [
"serde",
]
-[[package]]
-name = "shlex"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
-
[[package]]
name = "slab"
version = "0.4.2"
@@ -1289,15 +1146,6 @@ dependencies = [
"winapi",
]
-[[package]]
-name = "termcolor"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f"
-dependencies = [
- "winapi-util",
-]
-
[[package]]
name = "textwrap"
version = "0.11.0"
@@ -1327,15 +1175,6 @@ dependencies = [
"syn",
]
-[[package]]
-name = "thread_local"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
-dependencies = [
- "lazy_static",
-]
-
[[package]]
name = "time"
version = "0.1.42"
@@ -1398,12 +1237,6 @@ version = "0.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d63556a25bae6ea31b52e640d7c41d1ab27faba4ccb600013837a3d0b3994ca1"
-[[package]]
-name = "version_check"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
-
[[package]]
name = "version_check"
version = "0.9.2"
@@ -1416,15 +1249,6 @@ version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
-[[package]]
-name = "which"
-version = "3.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5475d47078209a02e60614f7ba5e645ef3ed60f771920ac1906d7c1cc65024c8"
-dependencies = [
- "libc",
-]
-
[[package]]
name = "winapi"
version = "0.3.8"
@@ -1441,15 +1265,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
-[[package]]
-name = "winapi-util"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ccfbf554c6ad11084fb7517daca16cfdcaccbdadba4fc336f032a8b12c2ad80"
-dependencies = [
- "winapi",
-]
-
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
diff --git a/crates/npc-engine/Cargo.toml b/crates/npc-engine/Cargo.toml
index b60d290..a59658e 100644
--- a/crates/npc-engine/Cargo.toml
+++ b/crates/npc-engine/Cargo.toml
@@ -13,13 +13,13 @@ exempi = { version = "2.6.0", git = "https://github.com/hfiguiere/exempi-rs.git"
gdk-pixbuf-sys = "*"
gdk-pixbuf = "*"
glib = "*"
+lazy_static = "^1.2.0"
libc = "0.2.39"
+maplit = "1.0.2"
rusqlite = { version = "0.14.0", features = ["functions"] }
try_opt = "0.1.1"
npc-fwk = { path = "../npc-fwk" }
[build-dependencies]
-bindgen = "0.53.1"
cbindgen = { version = "0.13.1" }
-pkg-config = "0.3.9"
diff --git a/crates/npc-engine/build.rs b/crates/npc-engine/build.rs
index 285d1cd..8565a72 100644
--- a/crates/npc-engine/build.rs
+++ b/crates/npc-engine/build.rs
@@ -1,61 +1,7 @@
-extern crate bindgen;
-extern crate pkg_config;
-
use std::env;
use std::path::PathBuf;
fn main() {
- let exempi = pkg_config::Config::new()
- .print_system_libs(false)
- .probe("exempi-2.0")
- .unwrap();
- // The bindgen::Builder is the main entry point
- // to bindgen, and lets you build up options for
- // the resulting bindings.
- let mut builder = bindgen::Builder::default()
- .enable_cxx_namespaces()
- .generate_comments(false)
- .generate_inline_functions(true)
- // The input header we would like to generate
- // bindings for.
- .whitelist_type("eng::NiepceProperties")
- .constified_enum("eng::NiepceProperties")
- .prepend_enum_name(false)
- .opaque_type("std::.*")
- .whitelist_type("eng::IndexToXmp")
- .whitelist_function("eng::property_index_to_xmp")
- .header("../../src/engine/db/bindings.hpp")
- // bindgen 0.38+ now require to set the language so that it can find
- // the proper headers for C++
- .clang_arg("-xc++")
- .clang_arg("--std=c++11")
- .clang_arg("-DRUST_BINDGEN=1")
- .clang_arg("-I../../src");
-
- for include in exempi
- .include_paths
- .into_iter()
- .map(|path| format!("-I{}", path.to_str().unwrap_or(".")))
- {
- builder = builder.clang_arg(include);
- }
-
- builder
- .dump_preprocessed_input()
- .expect("Unable to dump preprocessed input");
- // Finish the builder and generate the bindings.
- let bindings = builder
- .rustfmt_bindings(true)
- .generate()
- // Unwrap the Result and panic on failure.
- .expect("Unable to generate bindings");
-
- // Write the bindings to the $OUT_DIR/bindings.rs file.
- let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
- bindings
- .write_to_file(out_path.join("bindings.rs"))
- .expect("Couldn't write bindings!");
-
if env::var("SKIP_CBINDINGS").is_err() {
// Use cbindgen to generate C bindings.
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
diff --git a/crates/npc-engine/src/db/libfile.rs b/crates/npc-engine/src/db/libfile.rs
index 7cede33..60d4b6b 100644
--- a/crates/npc-engine/src/db/libfile.rs
+++ b/crates/npc-engine/src/db/libfile.rs
@@ -1,7 +1,7 @@
/*
* niepce - eng/db/libfile.rs
*
- * Copyright (C) 2017-2020 Hubert Figuière
+ * Copyright (C) 2017-2021 Hubert Figuière
*
* 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
@@ -24,10 +24,10 @@ use std::ffi::CString;
use std::path::{Path, PathBuf};
use super::fsfile::FsFile;
+use super::props::np;
+use super::props::NiepceProperties as Np;
use super::FromDb;
use super::LibraryId;
-use crate::root::eng;
-use crate::root::eng::NiepceProperties as Np;
use npc_fwk;
use npc_fwk::base::PropertyIndex;
@@ -196,20 +196,20 @@ impl LibFile {
pub fn property(&self, idx: Np) -> i32 {
match idx {
- eng::NpTiffOrientationProp => self.orientation(),
- eng::NpXmpRatingProp => self.rating(),
- eng::NpXmpLabelProp => self.label(),
- eng::NpNiepceFlagProp => self.flag(),
+ np::NpTiffOrientationProp => self.orientation(),
+ np::NpXmpRatingProp => self.rating(),
+ np::NpXmpLabelProp => self.label(),
+ np::NpNiepceFlagProp => self.flag(),
_ => -1,
}
}
pub fn set_property(&mut self, idx: Np, value: i32) {
match idx {
- eng::NpTiffOrientationProp => self.set_orientation(value),
- eng::NpXmpRatingProp => self.set_rating(value),
- eng::NpXmpLabelProp => self.set_label(value),
- eng::NpNiepceFlagProp => self.set_flag(value),
+ np::NpTiffOrientationProp => self.set_orientation(value),
+ np::NpXmpRatingProp => self.set_rating(value),
+ np::NpXmpLabelProp => self.set_label(value),
+ np::NpNiepceFlagProp => self.set_flag(value),
_ => err_out!("invalid property {:?} - noop", idx),
};
}
diff --git a/crates/npc-engine/src/db/libmetadata.rs b/crates/npc-engine/src/db/libmetadata.rs
index efc4d3a..d57b079 100644
--- a/crates/npc-engine/src/db/libmetadata.rs
+++ b/crates/npc-engine/src/db/libmetadata.rs
@@ -1,7 +1,7 @@
/*
* niepce - eng/db/libmetadata.rs
*
- * Copyright (C) 2017-2020 Hubert Figuière
+ * Copyright (C) 2017-2021 Hubert Figuière
*
* 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
@@ -20,12 +20,12 @@
use chrono::Utc;
use exempi;
use rusqlite;
-use std::ffi::CStr;
+use super::libfile::FileType;
+use super::props;
+use super::props::np::*;
+use super::props::NiepceProperties as Np;
use super::{FromDb, LibraryId};
-use crate::db::libfile::FileType;
-use crate::root::eng;
-use crate::root::eng::NiepceProperties as Np;
use npc_fwk::utils::exempi::{NS_DC, NS_XAP};
use npc_fwk::{xmp_date_from, PropertyBag, PropertySet, PropertyValue, XmpMeta};
@@ -40,19 +40,14 @@ pub struct LibMetadata {
}
struct IndexToXmp {
- pub ns: String,
- pub property: String,
+ pub ns: &'static str,
+ pub property: &'static str,
}
fn property_index_to_xmp(meta: Np) -> Option<IndexToXmp> {
- let index = unsafe { crate::root::eng::property_index_to_xmp(meta as u32) };
- if index.ns.is_null() || index.property.is_null() {
- err_out!("property {} not found", meta as u32);
- return None;
- }
- Some(IndexToXmp {
- ns: String::from(unsafe { CStr::from_ptr(index.ns) }.to_string_lossy()),
- property: String::from(unsafe { CStr::from_ptr(index.property) }.to_string_lossy()),
+ props::PROP_TO_XMP_MAP.get(&meta).map(|t| IndexToXmp {
+ ns: t.0,
+ property: t.1,
})
}
@@ -195,28 +190,29 @@ impl LibMetadata {
pub fn to_properties(&self, propset: &PropertySet) -> PropertyBag {
let mut props = PropertyBag::new();
for prop_id in propset {
+ #[allow(non_upper_case_globals)]
match *prop_id {
- eng::NpXmpRatingProp => {
+ NpXmpRatingProp => {
if let Some(rating) = self.xmp.rating() {
props.set_value(*prop_id, PropertyValue::Int(rating));
}
}
- eng::NpXmpLabelProp => {
+ NpXmpLabelProp => {
if let Some(label) = self.xmp.label() {
props.set_value(*prop_id, PropertyValue::String(label));
}
}
- eng::NpTiffOrientationProp => {
+ NpTiffOrientationProp => {
if let Some(orientation) = self.xmp.orientation() {
props.set_value(*prop_id, PropertyValue::Int(orientation));
}
}
- eng::NpExifDateTimeOriginalProp => {
+ NpExifDateTimeOriginalProp => {
if let Some(date) = self.xmp.creation_date() {
props.set_value(*prop_id, PropertyValue::Date(date));
}
}
- eng::NpIptcKeywordsProp => {
+ NpIptcKeywordsProp => {
let mut iter = exempi::XmpIterator::new(
&self.xmp.xmp,
NS_DC,
@@ -233,18 +229,18 @@ impl LibMetadata {
}
props.set_value(*prop_id, PropertyValue::StringArray(keywords));
}
- eng::NpFileNameProp => {
+ NpFileNameProp => {
props.set_value(*prop_id, PropertyValue::String(self.name.clone()));
}
- eng::NpFileTypeProp => {
+ NpFileTypeProp => {
let file_type: &str = self.file_type.into();
props.set_value(*prop_id, PropertyValue::String(String::from(file_type)));
}
- eng::NpFileSizeProp => {}
- eng::NpFolderProp => {
+ NpFileSizeProp => {}
+ NpFolderProp => {
props.set_value(*prop_id, PropertyValue::String(self.folder.clone()));
}
- eng::NpSidecarsProp => {
+ NpSidecarsProp => {
props.set_value(*prop_id, PropertyValue::StringArray(self.sidecars.clone()));
}
_ => {
diff --git a/crates/npc-engine/src/db/library.rs b/crates/npc-engine/src/db/library.rs
index 86ee02a..4618005 100644
--- a/crates/npc-engine/src/db/library.rs
+++ b/crates/npc-engine/src/db/library.rs
@@ -27,6 +27,8 @@ use std::sync::mpsc;
use chrono::Utc;
use rusqlite;
+use super::props::np::*;
+use super::props::NiepceProperties as Np;
use super::{FromDb, LibraryId};
use crate::db::filebundle::{FileBundle, Sidecar};
use crate::db::keyword::Keyword;
@@ -37,8 +39,6 @@ use crate::db::libfolder;
use crate::db::libfolder::LibFolder;
use crate::db::libmetadata::LibMetadata;
use crate::library::notification::LibNotification;
-use crate::root::eng;
-use crate::root::eng::NiepceProperties as Np;
use npc_fwk;
use npc_fwk::PropertyValue;
@@ -882,20 +882,18 @@ impl Library {
}
pub fn set_metadata(&self, file_id: LibraryId, meta: Np, value: &PropertyValue) -> Result<()> {
+ #[allow(non_upper_case_globals)]
match meta {
- eng::NpXmpRatingProp
- | eng::NpXmpLabelProp
- | eng::NpTiffOrientationProp
- | eng::NpNiepceFlagProp => {
+ NpXmpRatingProp | NpXmpLabelProp | NpTiffOrientationProp | NpNiepceFlagProp => {
match *value {
PropertyValue::Int(i) => {
// internal
// make the column mapping more generic.
let column = match meta {
- eng::NpXmpRatingProp => "rating",
- eng::NpXmpLabelProp => "label",
- eng::NpTiffOrientationProp => "orientation",
- eng::NpNiepceFlagProp => "flag",
+ NpXmpRatingProp => "rating",
+ NpXmpLabelProp => "label",
+ NpTiffOrientationProp => "orientation",
+ NpNiepceFlagProp => "flag",
_ => unreachable!(),
};
if !column.is_empty() {
@@ -905,7 +903,7 @@ impl Library {
_ => err_out!("improper value type for {:?}", meta),
}
}
- eng::NpIptcKeywordsProp => {
+ NpIptcKeywordsProp => {
self.unassign_all_keywords_for_file(file_id)?;
match *value {
diff --git a/crates/npc-engine/src/db/mod.rs b/crates/npc-engine/src/db/mod.rs
index e9f2f27..1a03ccb 100644
--- a/crates/npc-engine/src/db/mod.rs
+++ b/crates/npc-engine/src/db/mod.rs
@@ -1,7 +1,7 @@
/*
* niepce - engine/db/mod.rs
*
- * Copyright (C) 2017 Hubert Figuière
+ * Copyright (C) 2017-2021 Hubert Figuière
*
* 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
@@ -25,6 +25,7 @@ pub mod libfile;
pub mod libfolder;
pub mod libmetadata;
pub mod library;
+pub mod props;
pub type LibraryId = i64;
diff --git a/crates/npc-engine/src/db/props.rs b/crates/npc-engine/src/db/props.rs
new file mode 100644
index 0000000..4789ef3
--- /dev/null
+++ b/crates/npc-engine/src/db/props.rs
@@ -0,0 +1,67 @@
+use lazy_static::lazy_static;
+use maplit::hashmap;
+use npc_fwk::utils::exempi::NS_AUX as NS_EXIF_AUX;
+use npc_fwk::utils::exempi::{NS_DC, NS_EXIF, NS_PHOTOSHOP, NS_TIFF, NS_XAP};
+mod xmp {
+ pub use npc_fwk::utils::exempi::NIEPCE_XMP_NAMESPACE;
+}
+
+pub type NiepceProperties = u32;
+
+#[allow(non_upper_case_globals)]
+#[allow(unused_parens)]
+pub mod np {
+ pub const NpFileNameProp: u32 = (0x0f00 << 16 | 0);
+ pub const NpFileTypeProp: u32 = (0x0f00 << 16 | 1);
+ pub const NpFileSizeProp: u32 = (0x0f00 << 16 | 2);
+ pub const NpFolderProp: u32 = (0x0f00 << 16 | 3);
+ pub const NpSidecarsProp: u32 = (0x0f00 << 16 | 4);
+ pub const NpXmpRatingProp: u32 = (0 << 16 | 1);
+ pub const NpXmpLabelProp: u32 = (0 << 16 | 2);
+ pub const NpTiffOrientationProp: u32 = (1 << 16 | 0);
+ pub const NpTiffMakeProp: u32 = (1 << 16 | 1);
+ pub const NpTiffModelProp: u32 = (1 << 16 | 2);
+ pub const NpExifAuxLensProp: u32 = (2 << 16 | 0);
+ pub const NpExifExposureProgramProp: u32 = (2 << 16 | 1);
+ pub const NpExifExposureTimeProp: u32 = (2 << 16 | 2);
+ pub const NpExifFNumberPropProp: u32 = (2 << 16 | 3);
+ pub const NpExifIsoSpeedRatingsProp: u32 = (2 << 16 | 4);
+ pub const NpExifExposureBiasProp: u32 = (2 << 16 | 5);
+ pub const NpExifFlashFiredProp: u32 = (2 << 16 | 6);
+ pub const NpExifAuxFlashCompensationProp: u32 = (2 << 16 | 7);
+ pub const NpExifWbProp: u32 = (2 << 16 | 8);
+ pub const NpExifDateTimeOriginalProp: u32 = (2 << 16 | 9);
+ pub const NpExifFocalLengthProp: u32 = (2 << 16 | 10);
+ pub const NpExifGpsLongProp: u32 = (2 << 16 | 11);
+ pub const NpExifGpsLatProp: u32 = (2 << 16 | 12);
+ pub const NpIptcHeadlineProp: u32 = (3 << 16 | 0);
+ pub const NpIptcDescriptionProp: u32 = (3 << 16 | 1);
+ pub const NpIptcKeywordsProp: u32 = (3 << 16 | 2);
+ pub const NpNiepceFlagProp: u32 = (4 << 16 | 0);
+}
+lazy_static! {
+ pub static ref PROP_TO_XMP_MAP: std::collections::HashMap<NiepceProperties, (&'static str, &'static
str)> = hashmap! {
+ np::NpXmpRatingProp => (NS_XAP, "Rating"),
+ np::NpXmpLabelProp => (NS_XAP, "Label"),
+ np::NpTiffOrientationProp => (NS_TIFF, "Orientation"),
+ np::NpTiffMakeProp => (NS_TIFF, "Make"),
+ np::NpTiffModelProp => (NS_TIFF, "Model"),
+ np::NpExifAuxLensProp => (NS_EXIF_AUX, "Lens"),
+ np::NpExifExposureProgramProp => (NS_EXIF, "ExposureProgram"),
+ np::NpExifExposureTimeProp => (NS_EXIF, "ExposureTime"),
+ np::NpExifFNumberPropProp => (NS_EXIF, "FNumber"),
+ np::NpExifIsoSpeedRatingsProp => (NS_EXIF, "ISOSpeedRatings"),
+ np::NpExifExposureBiasProp => (NS_EXIF, "ExposureBiasValue"),
+ np::NpExifFlashFiredProp => (NS_EXIF, "Flash/exif:Fired"),
+ np::NpExifAuxFlashCompensationProp => (NS_EXIF_AUX, "FlashCompensation"),
+ np::NpExifWbProp => (NS_EXIF, "WhiteBalance"),
+ np::NpExifDateTimeOriginalProp => (NS_EXIF, "DateTimeOriginal"),
+ np::NpExifFocalLengthProp => (NS_EXIF, "FocalLength"),
+ np::NpExifGpsLongProp => (NS_EXIF, "GPSLongitude"),
+ np::NpExifGpsLatProp => (NS_EXIF, "GPSLatitude"),
+ np::NpIptcHeadlineProp => (NS_PHOTOSHOP, "Headline"),
+ np::NpIptcDescriptionProp => (NS_DC, "description"),
+ np::NpIptcKeywordsProp => (NS_DC, "subject"),
+ np::NpNiepceFlagProp => (xmp::NIEPCE_XMP_NAMESPACE, "Flag"),
+ };
+}
diff --git a/crates/npc-engine/src/lib.rs b/crates/npc-engine/src/lib.rs
index e489fa4..660ab4c 100644
--- a/crates/npc-engine/src/lib.rs
+++ b/crates/npc-engine/src/lib.rs
@@ -1,7 +1,7 @@
/*
* niepce - engine/mod.rs
*
- * Copyright (C) 2017-2020 Hubert Figuière
+ * Copyright (C) 2017-2021 Hubert Figuière
*
* 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
@@ -28,9 +28,3 @@ extern crate npc_fwk;
pub mod db;
pub mod library;
-
-#[allow(clippy::all)]
-mod bindings {
- include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
-}
-pub use bindings::*;
diff --git a/crates/npc-engine/src/library/commands.rs b/crates/npc-engine/src/library/commands.rs
index 608040a..826791b 100644
--- a/crates/npc-engine/src/library/commands.rs
+++ b/crates/npc-engine/src/library/commands.rs
@@ -1,7 +1,7 @@
/*
* niepce - npc-engine/library/commands.rs
*
- * Copyright (C) 2017-2020 Hubert Figuière
+ * Copyright (C) 2017-2021 Hubert Figuière
*
* 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
@@ -28,8 +28,8 @@ use crate::db::label::Label;
use crate::db::libfolder::LibFolder;
use crate::db::library;
use crate::db::library::{Library, Managed};
+use crate::db::props::NiepceProperties as Np;
use crate::db::LibraryId;
-use crate::root::eng::NiepceProperties as Np;
use npc_fwk::PropertyValue;
pub fn cmd_list_all_keywords(lib: &Library) -> bool {
diff --git a/crates/npc-fwk/src/utils/exempi.rs b/crates/npc-fwk/src/utils/exempi.rs
index 0d7fd73..8d6a428 100644
--- a/crates/npc-fwk/src/utils/exempi.rs
+++ b/crates/npc-fwk/src/utils/exempi.rs
@@ -1,7 +1,7 @@
/*
* niepce - fwk/utils/exempi.rs
*
- * Copyright (C) 2017-2020 Hubert Figuière
+ * Copyright (C) 2017-2021 Hubert Figuière
*
* 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
@@ -28,8 +28,8 @@ use exempi::Xmp;
use super::exiv2;
-const NIEPCE_XMP_NAMESPACE: &str = "http://xmlns.figuiere.net/ns/niepce/1.0";
-const NIEPCE_XMP_NS_PREFIX: &str = "niepce";
+pub const NIEPCE_XMP_NAMESPACE: &str = "http://xmlns.figuiere.net/ns/niepce/1.0";
+pub const NIEPCE_XMP_NS_PREFIX: &str = "niepce";
const UFRAW_INTEROP_NAMESPACE: &str = "http://xmlns.figuiere.net/ns/ufraw_interop/1.0";
const UFRAW_INTEROP_NS_PREFIX: &str = "ufrint";
@@ -39,6 +39,7 @@ pub const NS_EXIF: &str = "http://ns.adobe.com/exif/1.0/";
pub const NS_EXIF_EX: &str = "http://cipa.jp/exif/1.0/";
pub const NS_DC: &str = "http://purl.org/dc/elements/1.1/";
pub const NS_AUX: &str = "http://ns.adobe.com/exif/1.0/aux/";
+pub const NS_PHOTOSHOP: &str = "http://ns.adobe.com/photoshop/1.0/";
const XMP_TRUE: &str = "True";
const XMP_FALSE: &str = "False";
diff --git a/niepce-main/examples/widget-test.rs b/niepce-main/examples/widget-test.rs
index 971be1b..f78f5a1 100644
--- a/niepce-main/examples/widget-test.rs
+++ b/niepce-main/examples/widget-test.rs
@@ -34,19 +34,19 @@ use niepce_rust::niepce::ui::thumb_strip_view::ThumbStripView;
use npc_fwk::toolkit::widgets::rating_label::RatingLabel;
fn init() -> Result<(), Error> {
-/*
- // load the gresource binary at build time and include/link it into the final
- // binary.
- let res_bytes = include_bytes!("gresource.gresource");
+ /*
+ // load the gresource binary at build time and include/link it into the final
+ // binary.
+ let res_bytes = include_bytes!("gresource.gresource");
- // Create Resource it will live as long the value lives.
- let gbytes = Bytes::from_static(res_bytes.as_ref());
- let resource = Resource::from_data(&gbytes)?;
+ // Create Resource it will live as long the value lives.
+ let gbytes = Bytes::from_static(res_bytes.as_ref());
+ let resource = Resource::from_data(&gbytes)?;
- // Register the resource so it won't be dropped and will continue to live in
- // memory.
- resources_register(&resource);
-*/
+ // Register the resource so it won't be dropped and will continue to live in
+ // memory.
+ resources_register(&resource);
+ */
Ok(())
}
diff --git a/niepce-main/src/libraryclient/clientimpl.rs b/niepce-main/src/libraryclient/clientimpl.rs
index 58e11d6..c24104c 100644
--- a/niepce-main/src/libraryclient/clientimpl.rs
+++ b/niepce-main/src/libraryclient/clientimpl.rs
@@ -1,7 +1,7 @@
/*
* niepce - libraryclient/clientimpl.rs
*
- * Copyright (C) 2017-2019 Hubert Figuière
+ * Copyright (C) 2017-2021 Hubert Figuière
*
* 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
@@ -26,11 +26,11 @@ use std::thread;
use super::clientinterface::{ClientInterface, ClientInterfaceSync};
use npc_engine::db::library::Managed;
+use npc_engine::db::props::NiepceProperties as Np;
use npc_engine::db::{Library, LibraryId};
use npc_engine::library::commands;
use npc_engine::library::notification::LibNotification;
use npc_engine::library::op::Op;
-use npc_engine::root::eng::NiepceProperties as Np;
use npc_fwk::base::PropertyValue;
pub struct ClientImpl {
diff --git a/niepce-main/src/libraryclient/clientinterface.rs
b/niepce-main/src/libraryclient/clientinterface.rs
index efb1462..f7d159a 100644
--- a/niepce-main/src/libraryclient/clientinterface.rs
+++ b/niepce-main/src/libraryclient/clientinterface.rs
@@ -1,7 +1,7 @@
/*
* niepce - libraryclient/clientinterface.rs
*
- * Copyright (C) 2017-2019 Hubert Figuière
+ * Copyright (C) 2017-2021 Hubert Figuière
*
* 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
@@ -20,8 +20,8 @@
use std::path::PathBuf;
use npc_engine::db::library::Managed;
+use npc_engine::db::props::NiepceProperties as Np;
use npc_engine::db::LibraryId;
-use npc_engine::root::eng::NiepceProperties as Np;
use npc_fwk::base::PropertyValue;
/// Client interface.
diff --git a/niepce-main/src/libraryclient/mod.rs b/niepce-main/src/libraryclient/mod.rs
index 1cdf702..e199381 100644
--- a/niepce-main/src/libraryclient/mod.rs
+++ b/niepce-main/src/libraryclient/mod.rs
@@ -1,7 +1,7 @@
/*
* niepce - libraryclient/mod.rs
*
- * Copyright (C) 2017-2020 Hubert Figuière
+ * Copyright (C) 2017-2021 Hubert Figuière
*
* 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
@@ -29,9 +29,9 @@ use std::sync::Arc;
use self::clientimpl::ClientImpl;
use npc_engine::db::library::Managed;
+use npc_engine::db::props::NiepceProperties as Np;
use npc_engine::db::LibraryId;
use npc_engine::library::notification::{LcChannel, LibNotification};
-use npc_engine::root::eng::NiepceProperties as Np;
use npc_fwk::base::PropertyValue;
use npc_fwk::toolkit::PortableChannel;
use npc_fwk::utils::files::FileList;
diff --git a/niepce-main/src/niepce/ui/image_list_store.rs b/niepce-main/src/niepce/ui/image_list_store.rs
index b5f090a..59ef377 100644
--- a/niepce-main/src/niepce/ui/image_list_store.rs
+++ b/niepce-main/src/niepce/ui/image_list_store.rs
@@ -1,7 +1,7 @@
/*
* niepce - niepce/ui/image_list_store.rs
*
- * Copyright (C) 2020 Hubert Figuière
+ * Copyright (C) 2020-2021 Hubert Figuière
*
* 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
@@ -31,10 +31,10 @@ use gtk_sys;
use once_cell::unsync::OnceCell;
use npc_engine::db::libfile::{FileStatus, LibFile};
+use npc_engine::db::props::np;
use npc_engine::db::LibraryId;
use npc_engine::library::notification::{LibNotification, MetadataChange};
use npc_engine::library::thumbnail_cache::ThumbnailCache;
-use npc_engine::root::eng;
use npc_fwk::base::PropertyIndex;
use npc_fwk::toolkit::gdk_utils;
use npc_fwk::PropertyValue;
@@ -101,10 +101,10 @@ impl ImageListStore {
}
fn is_property_interesting(idx: PropertyIndex) -> bool {
- return (idx == eng::NpXmpRatingProp)
- || (idx == eng::NpXmpLabelProp)
- || (idx == eng::NpTiffOrientationProp)
- || (idx == eng::NpNiepceFlagProp);
+ return (idx == np::NpXmpRatingProp)
+ || (idx == np::NpXmpLabelProp)
+ || (idx == np::NpTiffOrientationProp)
+ || (idx == np::NpNiepceFlagProp);
}
fn get_iter_from_id(&self, id: LibraryId) -> Option<>k::TreeIter> {
diff --git a/src/Makefile.am b/src/Makefile.am
index 0bb02c0..311425f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,6 +18,7 @@ RUST_SOURCES = \
@top_srcdir@/crates/npc-engine/src/db/libmetadata.rs \
@top_srcdir@/crates/npc-engine/src/db/library.rs \
@top_srcdir@/crates/npc-engine/src/db/mod.rs \
+ @top_srcdir@/crates/npc-engine/src/db/props.rs \
@top_srcdir@/crates/npc-engine/src/library/commands.rs \
@top_srcdir@/crates/npc-engine/src/library/mod.rs \
@top_srcdir@/crates/npc-engine/src/library/notification.rs \
diff --git a/src/engine/db/label.hpp b/src/engine/db/label.hpp
index f699a0a..55b4593 100644
--- a/src/engine/db/label.hpp
+++ b/src/engine/db/label.hpp
@@ -1,7 +1,7 @@
/*
* niepce - engine/db/label.hpp
*
- * Copyright (C) 2009-2013 Hubert Figuiere
+ * Copyright (C) 2009-2021 Hubert Figuière
*
* 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
@@ -27,10 +27,6 @@
namespace eng {
-
-#if RUST_BINDGEN
-class Label;
-#endif
typedef std::shared_ptr<Label> LabelPtr;
typedef std::vector<LabelPtr> LabelList;
typedef std::shared_ptr<LabelList> LabelListPtr;
diff --git a/src/engine/db/libfile.hpp b/src/engine/db/libfile.hpp
index 2ce291f..eb33dd4 100644
--- a/src/engine/db/libfile.hpp
+++ b/src/engine/db/libfile.hpp
@@ -1,7 +1,7 @@
/*
* niepce - eng/db/libfile.hpp
*
- * Copyright (C) 2007-2013 Hubert Figuiere
+ * Copyright (C) 2007-2021 Hubert Figuière
*
* 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
@@ -26,10 +26,6 @@
namespace eng {
-#if RUST_BINDGEN
-class LibFile;
-typedef int64_t library_id_t;
-#endif
typedef std::shared_ptr<LibFile> LibFilePtr;
typedef std::weak_ptr<LibFile> LibFileWeakPtr;
typedef std::list<LibFilePtr> LibFileList;
diff --git a/src/engine/db/libmetadata.cpp b/src/engine/db/libmetadata.cpp
index 7ade2ca..324506c 100644
--- a/src/engine/db/libmetadata.cpp
+++ b/src/engine/db/libmetadata.cpp
@@ -1,7 +1,7 @@
/*
* niepce - db/libmetadata.cpp
*
- * Copyright (C) 2008-2017 Hubert Figuière
+ * Copyright (C) 2008-2021 Hubert Figuière
*
* 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
@@ -17,58 +17,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <string.h>
-#include <time.h>
-
-#include <algorithm>
-#include <map>
-
-#include <exempi/xmpconsts.h>
-#include <exempi/xmperrors.h>
-
-#include "fwk/base/date.hpp"
-#include "fwk/base/debug.hpp"
-#include "fwk/utils/exempi.hpp"
-#include "fwk/utils/stringutils.hpp"
#include "libmetadata.hpp"
-#include "properties.hpp"
namespace eng {
-typedef std::map<fwk::PropertyIndex, std::pair<const char *, const char *>>
- PropsToXmpMap;
-
-/** get the mapping of properties to XMP */
-const PropsToXmpMap &props_to_xmp_map();
-
-const PropsToXmpMap &props_to_xmp_map()
-{
- static PropsToXmpMap s_props_map;
- if (s_props_map.empty()) {
-
-#define DEFINE_PROPERTY(a, b, c, d, e) \
- s_props_map.insert(std::make_pair(b, std::make_pair(c, d)));
-#include "engine/db/properties-def.hpp"
-#undef DEFINE_PROPERTY
- }
- return s_props_map;
-}
-
-IndexToXmp property_index_to_xmp(fwk::PropertyIndex index)
-{
- const PropsToXmpMap &propmap = props_to_xmp_map();
- PropsToXmpMap::const_iterator iter = propmap.find(index);
- if (iter == propmap.end()) {
- // not found
- return {nullptr, nullptr};
- }
- if (iter->second.first == NULL || iter->second.second == NULL) {
- // no XMP equivalent
- return {nullptr, nullptr};
- }
- return {iter->second.first, iter->second.second};
-}
-
fwk::PropertyBagPtr libmetadata_to_properties(const LibMetadata* meta,
const fwk::PropertySet& propset)
{
diff --git a/src/engine/db/libmetadata.hpp b/src/engine/db/libmetadata.hpp
index d32160c..5b92fbf 100644
--- a/src/engine/db/libmetadata.hpp
+++ b/src/engine/db/libmetadata.hpp
@@ -1,7 +1,7 @@
/*
* niepce - eng/db/libmetadata.hpp
*
- * Copyright (C) 2008-2017 Hubert Figuière
+ * Copyright (C) 2008-2021 Hubert Figuière
*
* 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
@@ -19,10 +19,6 @@
#pragma once
-#include <memory>
-#include <string>
-#include <vector>
-
#include "engine/db/metadata.hpp"
#include "fwk/base/propertybag.hpp"
@@ -30,17 +26,6 @@
namespace eng {
-#if RUST_BINDGEN
-class LibMetadata;
-#endif
-
-struct IndexToXmp {
- const char *ns;
- const char *property;
-};
-IndexToXmp property_index_to_xmp(fwk::PropertyIndex index);
-
-
fwk::PropertyBagPtr libmetadata_to_properties(const LibMetadata *meta,
const fwk::PropertySet &propset);
diff --git a/src/engine/db/metadata.hpp b/src/engine/db/metadata.hpp
index 8818f65..d23841d 100644
--- a/src/engine/db/metadata.hpp
+++ b/src/engine/db/metadata.hpp
@@ -1,7 +1,7 @@
/*
* niepce - eng/db/metadata.hpp
*
- * Copyright (C) 2008,2011 Hubert Figuiere
+ * Copyright (C) 2008,2011-2021 Hubert Figuière
*
* 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
@@ -95,10 +95,6 @@ enum {
/** make a metadata index with a namespace and a value */
#define MAKE_METADATA_IDX(x,y) (x<<16|y)
-/** get the NS form the metadata index */
-#define METADATA_NS(x) (x >>16)
-/** get the data from the metadata index */
-#define METADATA_DATA(x) (x & 0xffff)
}
diff --git a/src/fwk/base/colour.hpp b/src/fwk/base/colour.hpp
index 523a294..ac41387 100644
--- a/src/fwk/base/colour.hpp
+++ b/src/fwk/base/colour.hpp
@@ -26,10 +26,6 @@
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);
diff --git a/src/fwk/base/date.hpp b/src/fwk/base/date.hpp
index d6bd5bd..a544261 100644
--- a/src/fwk/base/date.hpp
+++ b/src/fwk/base/date.hpp
@@ -36,10 +36,6 @@ class Timezone;
*/
bool make_xmp_date_time(time_t t, XmpDateTime& xmp_dt);
-#if RUST_BINDGEN
-class Date;
-#endif
-
typedef std::shared_ptr<Date> DatePtr;
DatePtr date_wrap(Date*);
diff --git a/src/fwk/base/propertybag.hpp b/src/fwk/base/propertybag.hpp
index ac535f9..d3ed7ad 100644
--- a/src/fwk/base/propertybag.hpp
+++ b/src/fwk/base/propertybag.hpp
@@ -34,7 +34,6 @@ namespace fwk {
typedef uint32_t PropertyIndex;
-#if !RUST_BINDGEN
typedef std::shared_ptr<PropertyValue> PropertyValuePtr;
PropertyValuePtr property_value_new(const std::string&);
@@ -44,12 +43,6 @@ PropertyValuePtr property_value_new(const DatePtr&);
std::string property_value_get_string(const PropertyValue &value);
std::vector<std::string> property_value_get_string_array(const PropertyValue &value);
-#endif
-
-#if RUST_BINDGEN
-class PropertyBag;
-class PropertySet;
-#endif
typedef std::shared_ptr<PropertySet> PropertySetPtr;
@@ -61,7 +54,6 @@ PropertySetPtr property_set_new();
*/
typedef std::shared_ptr<PropertyBag> PropertyBagPtr;
-#if !RUST_BINDGEN
PropertyBagPtr property_bag_new();
PropertyBagPtr property_bag_wrap(PropertyBag*);
@@ -73,7 +65,6 @@ std::string property_value_get_string(const PropertyValue& v);
bool set_value_for_property(PropertyBag&, PropertyIndex idx, const PropertyValue & value);
/** return property or an empty option */
fwk::Option<PropertyValuePtr> get_value_for_property(const PropertyBag&, PropertyIndex idx);
-#endif
}
diff --git a/src/fwk/utils/exempi.hpp b/src/fwk/utils/exempi.hpp
index 93dcdae..5f84ee9 100644
--- a/src/fwk/utils/exempi.hpp
+++ b/src/fwk/utils/exempi.hpp
@@ -86,11 +86,6 @@ extern const char * UFRAW_INTEROP_NS_PREFIX;
namespace fwk {
-#if RUST_BINDGEN
-class Date;
-class ExempiManager;
-#endif
-
class XmpMeta;
typedef std::shared_ptr<ExempiManager> ExempiManagerPtr;
diff --git a/src/fwk/utils/files.hpp b/src/fwk/utils/files.hpp
index 6a3ffdc..1d3be81 100644
--- a/src/fwk/utils/files.hpp
+++ b/src/fwk/utils/files.hpp
@@ -27,15 +27,12 @@
#include <functional>
-#if !RUST_BINDGEN
#include <giomm/fileinfo.h>
-#endif
#include "rust_bindings.hpp"
namespace fwk {
-#if !RUST_BINDGEN
/** wrapper around g_dir_make_tmp() */
std::string make_tmp_dir(const std::string& base);
@@ -44,7 +41,6 @@ bool filter_ext(const Glib::RefPtr<Gio::FileInfo> & file,
const std::string & ext);
bool filter_xmp_out(const Glib::RefPtr<Gio::FileInfo> & file);
bool filter_only_media(const Glib::RefPtr<Gio::FileInfo> & file);
-#endif
typedef std::shared_ptr<ffi::FileList> FileListPtr;
diff --git a/src/rust_bindings.hpp b/src/rust_bindings.hpp
index c23c58b..ff71734 100644
--- a/src/rust_bindings.hpp
+++ b/src/rust_bindings.hpp
@@ -19,8 +19,6 @@
#pragma once
-#if !RUST_BINDGEN
-
#include <gtk/gtk.h>
#include "engine/db/properties-enum.hpp"
@@ -68,5 +66,3 @@ namespace ui {
using ffi::dialog_request_new_folder;
using ffi::dialog_confirm;
}
-
-#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]