xmp_toolkit_ruby 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.clang-format +4 -0
- data/CHANGELOG.md +37 -2
- data/README.md +131 -0
- data/ext/xmp_toolkit_ruby/xmp_toolkit.cpp +117 -284
- data/ext/xmp_toolkit_ruby/xmp_toolkit.hpp +15 -26
- data/ext/xmp_toolkit_ruby/xmp_toolkit_ruby.cpp +29 -35
- data/ext/xmp_toolkit_ruby/xmp_wrapper.cpp +582 -0
- data/ext/xmp_toolkit_ruby/xmp_wrapper.hpp +35 -0
- data/lib/xmp_toolkit_ruby/namespaces.rb +1 -0
- data/lib/xmp_toolkit_ruby/version.rb +1 -1
- data/lib/xmp_toolkit_ruby/xmp_char_form.rb +45 -0
- data/lib/xmp_toolkit_ruby/xmp_file.rb +308 -0
- data/lib/xmp_toolkit_ruby/xmp_file_open_flags.rb +74 -0
- data/lib/xmp_toolkit_ruby/xmp_value.rb +16 -0
- data/lib/xmp_toolkit_ruby.rb +71 -33
- data/sig/xmp_toolkit_ruby/namespaces.rbs +119 -0
- data/sig/xmp_toolkit_ruby/xmp_char_form.rbs +17 -0
- data/sig/xmp_toolkit_ruby/xmp_file.rbs +45 -0
- data/sig/xmp_toolkit_ruby/xmp_file_format.rbs +11 -0
- data/sig/xmp_toolkit_ruby/xmp_file_handler_flags.rbs +15 -0
- data/sig/xmp_toolkit_ruby/xmp_file_open_flags.rbs +29 -0
- data/sig/xmp_toolkit_ruby/xmp_toolkit.rbs +14 -0
- data/sig/xmp_toolkit_ruby/xmp_value.rbs +19 -0
- data/sig/xmp_toolkit_ruby/xmp_wrapper.rbs +29 -0
- data/sig/xmp_toolkit_ruby.rbs +6 -1
- data/tasks/clang_format.rake +44 -0
- metadata +18 -1
@@ -0,0 +1,45 @@
|
|
1
|
+
module XmpToolkitRuby
|
2
|
+
class XmpFile
|
3
|
+
def self.register_namespace: (String namespace, String suggested_prefix) -> bool
|
4
|
+
|
5
|
+
def self.with_xmp_file: (String file_path, ?open_flags: Integer, ?plugin_path: String, ?fallback_flags: Integer, ?auto_terminate_toolkit: bool) { (XmpFile) -> void } -> void
|
6
|
+
|
7
|
+
public
|
8
|
+
|
9
|
+
def close: () -> void
|
10
|
+
|
11
|
+
def fallback_flags: () -> Integer
|
12
|
+
|
13
|
+
def file_info: () -> Hash[String, untyped]
|
14
|
+
|
15
|
+
def file_path: () -> String
|
16
|
+
|
17
|
+
def localized_property: (schema_ns: String, alt_text_name: String, generic_lang: String, specific_lang: String) -> String?
|
18
|
+
|
19
|
+
def meta: () -> Hash[String, untyped]
|
20
|
+
|
21
|
+
def open: () -> bool
|
22
|
+
|
23
|
+
def open?: () -> bool
|
24
|
+
|
25
|
+
def open_flags: () -> Integer
|
26
|
+
|
27
|
+
def packet_info: () -> Hash[String, untyped]
|
28
|
+
|
29
|
+
def property: (String namespace, String property) -> untyped
|
30
|
+
|
31
|
+
def update_localized_property: (schema_ns: String, alt_text_name: String, generic_lang: String, specific_lang: String, item_value: String, options: Hash[Symbol, untyped]) -> bool
|
32
|
+
|
33
|
+
def update_meta: (Hash[String, untyped] xmp_data, ?mode: Symbol) -> bool
|
34
|
+
|
35
|
+
def update_property: (String namespace, String property, untyped value) -> bool
|
36
|
+
|
37
|
+
def write: () -> bool
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def initialize: (String file_path, ?open_flags: Integer, ?fallback_flags: Integer) -> void
|
42
|
+
|
43
|
+
def map_handler_flags: (Integer handler_flags) -> Hash[Symbol, untyped]
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module XmpToolkitRuby
|
4
|
+
module XmpFileHandlerFlags
|
5
|
+
def self.flags_for: (Integer bitmask) -> Hash[Symbol, bool]
|
6
|
+
|
7
|
+
def self.name_for: (Integer hex_value) -> Symbol?
|
8
|
+
|
9
|
+
def self.value_for: (Symbol name) -> Integer?
|
10
|
+
|
11
|
+
FLAGS: ::Hash[Symbol, Integer]
|
12
|
+
|
13
|
+
FLAGS_BY_VALUE: ::Hash[Integer, Symbol]
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module XmpToolkitRuby
|
2
|
+
module XmpFileOpenFlags
|
3
|
+
def self.bitmask_for: (*Symbol args) -> Integer
|
4
|
+
|
5
|
+
def self.contains?: (Integer bitmask, Symbol | Integer flag) -> bool
|
6
|
+
|
7
|
+
def self.flags_for: (Integer bitmask) -> Array[Symbol]
|
8
|
+
|
9
|
+
def self.name_for: (Integer hex_value) -> Symbol?
|
10
|
+
|
11
|
+
def self.value_for: (Symbol name) -> Integer?
|
12
|
+
|
13
|
+
FLAGS: ::Hash[Symbol, Integer]
|
14
|
+
|
15
|
+
FLAGS_BY_VALUE: ::Hash[Integer, Symbol]
|
16
|
+
|
17
|
+
FORCE_GIVEN_HANDLER: ::Integer
|
18
|
+
OPEN_FOR_READ: ::Integer
|
19
|
+
OPEN_FOR_UPDATE: ::Integer
|
20
|
+
OPEN_LIMITED_SCANNING: ::Integer
|
21
|
+
OPEN_ONLY_XMP: ::Integer
|
22
|
+
OPEN_REPAIR_FILE: ::Integer
|
23
|
+
OPEN_STRICTLY: ::Integer
|
24
|
+
OPEN_USE_PACKET_SCANNING: ::Integer
|
25
|
+
OPEN_USE_SMART_HANDLER: ::Integer
|
26
|
+
OPTIMIZE_FILE_LAYOUT: ::Integer
|
27
|
+
PRESERVE_PDF_STATE: ::Integer
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module XmpToolkitRuby
|
2
|
+
module XmpToolkit
|
3
|
+
# Initialize the XMP toolkit library
|
4
|
+
# @param options Optional initialization parameters
|
5
|
+
def self.initialize_xmp: (?Hash[Symbol, untyped] options) -> bool
|
6
|
+
|
7
|
+
# Check if the XMP toolkit has been initialized
|
8
|
+
def self.initialized?: () -> bool
|
9
|
+
|
10
|
+
# Terminate the XMP toolkit library
|
11
|
+
# @return [true] when successful
|
12
|
+
def self.terminate: () -> bool
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module XmpToolkitRuby
|
2
|
+
|
3
|
+
class XmpValue
|
4
|
+
public
|
5
|
+
# Returns the type of the XMP value
|
6
|
+
def type: () -> Symbol
|
7
|
+
|
8
|
+
# Returns the actual value
|
9
|
+
def value: () -> String | Integer | Float | Boolean | Array[String] | nil
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
# Initialize a new XMP value with the given value and type
|
14
|
+
def initialize: (String | Integer | Float | Boolean | Array[String] | nil value, ?type: Symbol) -> void
|
15
|
+
|
16
|
+
# List of valid XMP value types
|
17
|
+
TYPES: ::Array[Symbol]
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module XmpToolkitRuby
|
2
|
+
class XmpWrapper
|
3
|
+
def self.register_namespace: (String namespace_uri, String suggested_prefix) -> String
|
4
|
+
|
5
|
+
public
|
6
|
+
|
7
|
+
def close: () -> void
|
8
|
+
|
9
|
+
def file_info: () -> Hash[Symbol, String]
|
10
|
+
|
11
|
+
def localized_property: (String schema_ns, String prop_name, ?String? locale, ?Symbol? options) -> String?
|
12
|
+
|
13
|
+
def meta: () -> Hash[String, Hash[String, String]]
|
14
|
+
|
15
|
+
def open: (String file_path, ?Symbol? options) -> self
|
16
|
+
|
17
|
+
def packet_info: () -> Hash[Symbol, Integer]
|
18
|
+
|
19
|
+
def property: (String schema_ns, String prop_name) -> String?
|
20
|
+
|
21
|
+
def update_localized_property: (String schema_ns, String prop_name, String value, ?String? locale, ?Symbol? options) -> void
|
22
|
+
|
23
|
+
def update_meta: (Hash[String, Hash[String, String]] metadata) -> void
|
24
|
+
|
25
|
+
def update_property: (String schema_ns, String prop_name, String value) -> void
|
26
|
+
|
27
|
+
def write: () -> Boolean
|
28
|
+
end
|
29
|
+
end
|
data/sig/xmp_toolkit_ruby.rbs
CHANGED
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "shellwords"
|
4
|
+
|
5
|
+
EXTS = %w[c cc cpp cxx h hh hpp hxx].freeze
|
6
|
+
SDK_PATH = "ext/xmp_toolkit_ruby/XMP-Toolkit-SDK/"
|
7
|
+
|
8
|
+
def clang_format_files
|
9
|
+
Dir.glob("ext/**/*.{#{EXTS.join(",")}}")
|
10
|
+
.select { |file| File.file?(file) && !file.start_with?(SDK_PATH) }
|
11
|
+
end
|
12
|
+
|
13
|
+
namespace :clang_format do
|
14
|
+
desc "Format all C/C++ source and header files in ext/ with clang-format"
|
15
|
+
task :autocorrect_all do
|
16
|
+
clang_format_files.each do |file|
|
17
|
+
puts "Formatting #{file}"
|
18
|
+
system("clang-format -i #{Shellwords.escape(file)}")
|
19
|
+
end
|
20
|
+
puts "All files in ext/ have been formatted."
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Validate that all C/C++ files in ext/ are formatted with clang-format"
|
24
|
+
task :validate do
|
25
|
+
unformatted = []
|
26
|
+
clang_format_files.each do |file|
|
27
|
+
diff = `clang-format #{Shellwords.escape(file)} | diff #{Shellwords.escape(file)} -`
|
28
|
+
unformatted << file unless diff.empty?
|
29
|
+
end
|
30
|
+
|
31
|
+
if unformatted.any?
|
32
|
+
puts "The following files are NOT properly formatted:\n\n"
|
33
|
+
unformatted.each { |f| puts " #{f}" }
|
34
|
+
puts "\nPlease run: rake clang_format:autocorrect_all"
|
35
|
+
abort("clang-format validation failed.")
|
36
|
+
else
|
37
|
+
puts "All C/C++ files in ext/ are properly formatted."
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Optional: keep your old top-level task name for compatibility
|
43
|
+
desc "Validate that all C/C++ files in ext/ are formatted with clang-format"
|
44
|
+
task clang_format: "clang_format:validate"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xmp_toolkit_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dieter S.
|
@@ -147,6 +147,7 @@ extensions:
|
|
147
147
|
- ext/xmp_toolkit_ruby/extconf.rb
|
148
148
|
extra_rdoc_files: []
|
149
149
|
files:
|
150
|
+
- ".clang-format"
|
150
151
|
- ".idea/.gitignore"
|
151
152
|
- ".rspec"
|
152
153
|
- ".rubocop.yml"
|
@@ -254,6 +255,8 @@ files:
|
|
254
255
|
- ext/xmp_toolkit_ruby/xmp_toolkit.cpp
|
255
256
|
- ext/xmp_toolkit_ruby/xmp_toolkit.hpp
|
256
257
|
- ext/xmp_toolkit_ruby/xmp_toolkit_ruby.cpp
|
258
|
+
- ext/xmp_toolkit_ruby/xmp_wrapper.cpp
|
259
|
+
- ext/xmp_toolkit_ruby/xmp_wrapper.hpp
|
257
260
|
- lib/xmp_toolkit_ruby.rb
|
258
261
|
- lib/xmp_toolkit_ruby/cli.rb
|
259
262
|
- lib/xmp_toolkit_ruby/namespaces.rb
|
@@ -324,10 +327,24 @@ files:
|
|
324
327
|
- lib/xmp_toolkit_ruby/plugins/PDF_Handler/windows/windows_x64/MiniPDFL.dll
|
325
328
|
- lib/xmp_toolkit_ruby/plugins/PDF_Handler/windows/windows_x64/PDF_Handler.xpi
|
326
329
|
- lib/xmp_toolkit_ruby/version.rb
|
330
|
+
- lib/xmp_toolkit_ruby/xmp_char_form.rb
|
331
|
+
- lib/xmp_toolkit_ruby/xmp_file.rb
|
327
332
|
- lib/xmp_toolkit_ruby/xmp_file_format.rb
|
328
333
|
- lib/xmp_toolkit_ruby/xmp_file_handler_flags.rb
|
334
|
+
- lib/xmp_toolkit_ruby/xmp_file_open_flags.rb
|
335
|
+
- lib/xmp_toolkit_ruby/xmp_value.rb
|
329
336
|
- sig/xmp_toolkit_ruby.rbs
|
337
|
+
- sig/xmp_toolkit_ruby/namespaces.rbs
|
338
|
+
- sig/xmp_toolkit_ruby/xmp_char_form.rbs
|
339
|
+
- sig/xmp_toolkit_ruby/xmp_file.rbs
|
340
|
+
- sig/xmp_toolkit_ruby/xmp_file_format.rbs
|
341
|
+
- sig/xmp_toolkit_ruby/xmp_file_handler_flags.rbs
|
342
|
+
- sig/xmp_toolkit_ruby/xmp_file_open_flags.rbs
|
343
|
+
- sig/xmp_toolkit_ruby/xmp_toolkit.rbs
|
344
|
+
- sig/xmp_toolkit_ruby/xmp_value.rbs
|
345
|
+
- sig/xmp_toolkit_ruby/xmp_wrapper.rbs
|
330
346
|
- tasks/changelog.rake
|
347
|
+
- tasks/clang_format.rake
|
331
348
|
homepage: https://github.com/dieter-medium/xmp_toolkit_ruby
|
332
349
|
licenses:
|
333
350
|
- MIT
|