From 028809bf833fe9610a611426a2b7140b80f8e615 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 12 Sep 2024 22:37:27 +0200 Subject: [PATCH] draft --- src/odr/file.hpp | 13 +++++++++++++ src/odr/internal/open_strategy.hpp | 15 ++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/odr/file.hpp b/src/odr/file.hpp index e3e28f4d..1070340f 100644 --- a/src/odr/file.hpp +++ b/src/odr/file.hpp @@ -97,6 +97,19 @@ enum class FileLocation { disk, }; +/// @brief Collection of decoder engines. +enum class DecoderEngine { + odr, + pdf2html_ex, + wv_ware, +}; + +/// @brief Preference for decoding files. +struct DecodePreference final { + std::vector file_type_priority; + std::vector engine_priority; +}; + /// @brief Collection of encryption states. enum class EncryptionState { unknown, diff --git a/src/odr/internal/open_strategy.hpp b/src/odr/internal/open_strategy.hpp index 1661cd0e..a18cef8a 100644 --- a/src/odr/internal/open_strategy.hpp +++ b/src/odr/internal/open_strategy.hpp @@ -6,7 +6,9 @@ namespace odr { enum class FileType; -} +enum class DecoderEngine; +struct DecodePreferences; +} // namespace odr namespace odr::internal::abstract { class File; @@ -20,11 +22,22 @@ class Path; namespace odr::internal::open_strategy { std::vector types(std::shared_ptr file); +std::vector +engines(std::shared_ptr file, FileType as); std::unique_ptr open_file(std::shared_ptr file); std::unique_ptr open_file(std::shared_ptr file, FileType as); +std::unique_ptr +open_file(std::shared_ptr file, FileType as, + DecoderEngine with); +std::unique_ptr +open_file(std::shared_ptr file, + const DecodePreferences &preferences); +std::unique_ptr +open_file(std::shared_ptr file, FileType as, + const DecodePreferences &preferences); std::unique_ptr open_document_file(std::shared_ptr file);