diff --git a/src/odr/file.cpp b/src/odr/file.cpp index 565fe8a5..52e8d6e9 100644 --- a/src/odr/file.cpp +++ b/src/odr/file.cpp @@ -98,6 +98,10 @@ FileCategory DecodedFile::file_category() const noexcept { FileMeta DecodedFile::file_meta() const noexcept { return m_impl->file_meta(); } +DecoderEngine DecodedFile::decoder_engine() const noexcept { + return m_impl->decoder_engine(); +} + File DecodedFile::file() const { return File(m_impl->file()); } bool DecodedFile::is_text_file() const { diff --git a/src/odr/file.hpp b/src/odr/file.hpp index 1070340f..0b9f4823 100644 --- a/src/odr/file.hpp +++ b/src/odr/file.hpp @@ -190,6 +190,7 @@ class DecodedFile { [[nodiscard]] FileType file_type() const noexcept; [[nodiscard]] FileCategory file_category() const noexcept; [[nodiscard]] FileMeta file_meta() const noexcept; + [[nodiscard]] DecoderEngine decoder_engine() const noexcept; [[nodiscard]] File file() const; diff --git a/src/odr/internal/abstract/file.hpp b/src/odr/internal/abstract/file.hpp index cd86ed54..63cbbaa9 100644 --- a/src/odr/internal/abstract/file.hpp +++ b/src/odr/internal/abstract/file.hpp @@ -38,6 +38,7 @@ class DecodedFile { [[nodiscard]] virtual FileType file_type() const noexcept = 0; [[nodiscard]] virtual FileCategory file_category() const noexcept = 0; [[nodiscard]] virtual FileMeta file_meta() const noexcept = 0; + [[nodiscard]] virtual DecoderEngine decoder_engine() const noexcept = 0; }; class TextFile : public DecodedFile { diff --git a/src/odr/internal/cfb/cfb_file.cpp b/src/odr/internal/cfb/cfb_file.cpp index 7facfc25..e1e818a2 100644 --- a/src/odr/internal/cfb/cfb_file.cpp +++ b/src/odr/internal/cfb/cfb_file.cpp @@ -22,6 +22,10 @@ FileMeta CfbFile::file_meta() const noexcept { return meta; } +DecoderEngine CfbFile::decoder_engine() const noexcept { + return DecoderEngine::odr; +} + std::shared_ptr CfbFile::archive() const { return std::make_shared(m_cfb); } diff --git a/src/odr/internal/cfb/cfb_file.hpp b/src/odr/internal/cfb/cfb_file.hpp index 35a7ac12..f5696f0e 100644 --- a/src/odr/internal/cfb/cfb_file.hpp +++ b/src/odr/internal/cfb/cfb_file.hpp @@ -26,6 +26,7 @@ class CfbFile final : public abstract::ArchiveFile { [[nodiscard]] FileType file_type() const noexcept final; [[nodiscard]] FileMeta file_meta() const noexcept final; + [[nodiscard]] DecoderEngine decoder_engine() const noexcept final; [[nodiscard]] std::shared_ptr archive() const final; diff --git a/src/odr/internal/common/image_file.cpp b/src/odr/internal/common/image_file.cpp index 2f655e9e..43f14acf 100644 --- a/src/odr/internal/common/image_file.cpp +++ b/src/odr/internal/common/image_file.cpp @@ -14,6 +14,10 @@ FileType ImageFile::file_type() const noexcept { return m_file_type; } FileMeta ImageFile::file_meta() const noexcept { return {}; } +DecoderEngine ImageFile::decoder_engine() const noexcept { + return DecoderEngine::odr; +} + std::shared_ptr ImageFile::image() const { return {}; } } // namespace odr::internal::common diff --git a/src/odr/internal/common/image_file.hpp b/src/odr/internal/common/image_file.hpp index da61e735..81024754 100644 --- a/src/odr/internal/common/image_file.hpp +++ b/src/odr/internal/common/image_file.hpp @@ -13,6 +13,7 @@ class ImageFile : public abstract::ImageFile { [[nodiscard]] FileType file_type() const noexcept final; [[nodiscard]] FileMeta file_meta() const noexcept final; + [[nodiscard]] DecoderEngine decoder_engine() const noexcept final; [[nodiscard]] std::shared_ptr image() const final; diff --git a/src/odr/internal/csv/csv_file.cpp b/src/odr/internal/csv/csv_file.cpp index 59936046..0beaa2f1 100644 --- a/src/odr/internal/csv/csv_file.cpp +++ b/src/odr/internal/csv/csv_file.cpp @@ -24,4 +24,8 @@ FileMeta CsvFile::file_meta() const noexcept { return {FileType::comma_separated_values, false, {}}; } +DecoderEngine CsvFile::decoder_engine() const noexcept { + return DecoderEngine::odr; +} + } // namespace odr::internal::csv diff --git a/src/odr/internal/csv/csv_file.hpp b/src/odr/internal/csv/csv_file.hpp index b0fadebf..00d67dd4 100644 --- a/src/odr/internal/csv/csv_file.hpp +++ b/src/odr/internal/csv/csv_file.hpp @@ -17,6 +17,7 @@ class CsvFile final : public abstract::TextFile { [[nodiscard]] FileType file_type() const noexcept final; [[nodiscard]] FileMeta file_meta() const noexcept final; + [[nodiscard]] DecoderEngine decoder_engine() const noexcept final; private: std::shared_ptr m_file; diff --git a/src/odr/internal/json/json_file.cpp b/src/odr/internal/json/json_file.cpp index f19ffca1..71b35024 100644 --- a/src/odr/internal/json/json_file.cpp +++ b/src/odr/internal/json/json_file.cpp @@ -24,4 +24,8 @@ FileMeta JsonFile::file_meta() const noexcept { return {FileType::javascript_object_notation, false, {}}; } +DecoderEngine JsonFile::decoder_engine() const noexcept { + return DecoderEngine::odr; +} + } // namespace odr::internal::json diff --git a/src/odr/internal/json/json_file.hpp b/src/odr/internal/json/json_file.hpp index 29872e23..6640d2bc 100644 --- a/src/odr/internal/json/json_file.hpp +++ b/src/odr/internal/json/json_file.hpp @@ -17,6 +17,7 @@ class JsonFile final : public abstract::TextFile { [[nodiscard]] FileType file_type() const noexcept final; [[nodiscard]] FileMeta file_meta() const noexcept final; + [[nodiscard]] DecoderEngine decoder_engine() const noexcept final; private: std::shared_ptr m_file; diff --git a/src/odr/internal/odf/odf_file.cpp b/src/odr/internal/odf/odf_file.cpp index 12cf46f9..5e85d90a 100644 --- a/src/odr/internal/odf/odf_file.cpp +++ b/src/odr/internal/odf/odf_file.cpp @@ -43,6 +43,10 @@ FileType OpenDocumentFile::file_type() const noexcept { FileMeta OpenDocumentFile::file_meta() const noexcept { return m_file_meta; } +DecoderEngine OpenDocumentFile::decoder_engine() const noexcept { + return DecoderEngine::odr; +} + DocumentType OpenDocumentFile::document_type() const { return m_file_meta.document_meta->document_type; } diff --git a/src/odr/internal/odf/odf_file.hpp b/src/odr/internal/odf/odf_file.hpp index 684ac403..8d50525e 100644 --- a/src/odr/internal/odf/odf_file.hpp +++ b/src/odr/internal/odf/odf_file.hpp @@ -28,6 +28,8 @@ class OpenDocumentFile final : public virtual abstract::DocumentFile { [[nodiscard]] FileType file_type() const noexcept final; [[nodiscard]] FileMeta file_meta() const noexcept final; + [[nodiscard]] DecoderEngine decoder_engine() const noexcept final; + [[nodiscard]] DocumentType document_type() const final; [[nodiscard]] DocumentMeta document_meta() const final; diff --git a/src/odr/internal/oldms/oldms_file.cpp b/src/odr/internal/oldms/oldms_file.cpp index 9b5a9f0f..256912be 100644 --- a/src/odr/internal/oldms/oldms_file.cpp +++ b/src/odr/internal/oldms/oldms_file.cpp @@ -62,6 +62,10 @@ FileType LegacyMicrosoftFile::file_type() const noexcept { FileMeta LegacyMicrosoftFile::file_meta() const noexcept { return m_file_meta; } +DecoderEngine LegacyMicrosoftFile::decoder_engine() const noexcept { + return DecoderEngine::odr; +} + DocumentType LegacyMicrosoftFile::document_type() const { return m_file_meta.document_meta->document_type; } diff --git a/src/odr/internal/oldms/oldms_file.hpp b/src/odr/internal/oldms/oldms_file.hpp index f3651c7e..7950b3e3 100644 --- a/src/odr/internal/oldms/oldms_file.hpp +++ b/src/odr/internal/oldms/oldms_file.hpp @@ -25,6 +25,8 @@ class LegacyMicrosoftFile final : public abstract::DocumentFile { [[nodiscard]] FileType file_type() const noexcept final; [[nodiscard]] FileMeta file_meta() const noexcept final; + [[nodiscard]] DecoderEngine decoder_engine() const noexcept final; + [[nodiscard]] DocumentType document_type() const final; [[nodiscard]] DocumentMeta document_meta() const final; diff --git a/src/odr/internal/ooxml/ooxml_file.cpp b/src/odr/internal/ooxml/ooxml_file.cpp index 2cf85092..6a1404be 100644 --- a/src/odr/internal/ooxml/ooxml_file.cpp +++ b/src/odr/internal/ooxml/ooxml_file.cpp @@ -37,6 +37,10 @@ FileType OfficeOpenXmlFile::file_type() const noexcept { FileMeta OfficeOpenXmlFile::file_meta() const noexcept { return m_file_meta; } +DecoderEngine OfficeOpenXmlFile::decoder_engine() const noexcept { + return DecoderEngine::odr; +} + DocumentType OfficeOpenXmlFile::document_type() const { return m_file_meta.document_meta->document_type; } diff --git a/src/odr/internal/ooxml/ooxml_file.hpp b/src/odr/internal/ooxml/ooxml_file.hpp index b3ab97a1..e6b420fe 100644 --- a/src/odr/internal/ooxml/ooxml_file.hpp +++ b/src/odr/internal/ooxml/ooxml_file.hpp @@ -27,6 +27,8 @@ class OfficeOpenXmlFile final : public abstract::DocumentFile { [[nodiscard]] FileType file_type() const noexcept final; [[nodiscard]] FileMeta file_meta() const noexcept final; + [[nodiscard]] DecoderEngine decoder_engine() const noexcept final; + [[nodiscard]] DocumentType document_type() const final; [[nodiscard]] DocumentMeta document_meta() const final; diff --git a/src/odr/internal/open_strategy.cpp b/src/odr/internal/open_strategy.cpp index 37df3282..fe20de88 100644 --- a/src/odr/internal/open_strategy.cpp +++ b/src/odr/internal/open_strategy.cpp @@ -22,7 +22,7 @@ namespace odr::internal { std::vector -open_strategy::types(std::shared_ptr file) { +open_strategy::types(const std::shared_ptr &file) { std::vector result; auto file_type = magic::file_type(*file); diff --git a/src/odr/internal/open_strategy.hpp b/src/odr/internal/open_strategy.hpp index a18cef8a..b6c554db 100644 --- a/src/odr/internal/open_strategy.hpp +++ b/src/odr/internal/open_strategy.hpp @@ -21,9 +21,10 @@ class Path; } // namespace odr::internal::common namespace odr::internal::open_strategy { -std::vector types(std::shared_ptr file); +std::vector +types(const std::shared_ptr &file); std::vector -engines(std::shared_ptr file, FileType as); +engines(const std::shared_ptr &file, FileType as); std::unique_ptr open_file(std::shared_ptr file); diff --git a/src/odr/internal/pdf/pdf_file.cpp b/src/odr/internal/pdf/pdf_file.cpp index 00260c0f..4227e13e 100644 --- a/src/odr/internal/pdf/pdf_file.cpp +++ b/src/odr/internal/pdf/pdf_file.cpp @@ -19,4 +19,8 @@ FileType PdfFile::file_type() const noexcept { FileMeta PdfFile::file_meta() const noexcept { return {}; } +DecoderEngine PdfFile::decoder_engine() const noexcept { + return DecoderEngine::odr; +} + } // namespace odr::internal::pdf diff --git a/src/odr/internal/pdf/pdf_file.hpp b/src/odr/internal/pdf/pdf_file.hpp index 42b751be..8b72bd37 100644 --- a/src/odr/internal/pdf/pdf_file.hpp +++ b/src/odr/internal/pdf/pdf_file.hpp @@ -14,6 +14,7 @@ class PdfFile : public abstract::DecodedFile { [[nodiscard]] FileType file_type() const noexcept final; [[nodiscard]] FileCategory file_category() const noexcept final; [[nodiscard]] FileMeta file_meta() const noexcept final; + [[nodiscard]] DecoderEngine decoder_engine() const noexcept final; private: std::shared_ptr m_file; diff --git a/src/odr/internal/svm/svm_file.cpp b/src/odr/internal/svm/svm_file.cpp index fefc604f..47db2716 100644 --- a/src/odr/internal/svm/svm_file.cpp +++ b/src/odr/internal/svm/svm_file.cpp @@ -31,6 +31,10 @@ FileMeta SvmFile::file_meta() const noexcept { return result; } +DecoderEngine SvmFile::decoder_engine() const noexcept { + return DecoderEngine::odr; +} + std::shared_ptr SvmFile::image() const { return {}; } } // namespace odr::internal::svm diff --git a/src/odr/internal/svm/svm_file.hpp b/src/odr/internal/svm/svm_file.hpp index 60e1f806..dd28cd6d 100644 --- a/src/odr/internal/svm/svm_file.hpp +++ b/src/odr/internal/svm/svm_file.hpp @@ -20,6 +20,7 @@ class SvmFile final : public abstract::ImageFile { [[nodiscard]] FileType file_type() const noexcept final; [[nodiscard]] FileMeta file_meta() const noexcept final; + [[nodiscard]] DecoderEngine decoder_engine() const noexcept final; [[nodiscard]] std::shared_ptr image() const final; diff --git a/src/odr/internal/text/text_file.cpp b/src/odr/internal/text/text_file.cpp index a6908f5d..7fc489c1 100644 --- a/src/odr/internal/text/text_file.cpp +++ b/src/odr/internal/text/text_file.cpp @@ -22,4 +22,8 @@ FileMeta TextFile::file_meta() const noexcept { return {FileType::text_file, false, {}}; } +DecoderEngine TextFile::decoder_engine() const noexcept { + return DecoderEngine::odr; +} + } // namespace odr::internal::text diff --git a/src/odr/internal/text/text_file.hpp b/src/odr/internal/text/text_file.hpp index f0e84271..69bad36b 100644 --- a/src/odr/internal/text/text_file.hpp +++ b/src/odr/internal/text/text_file.hpp @@ -18,6 +18,7 @@ class TextFile final : public abstract::TextFile { [[nodiscard]] FileType file_type() const noexcept final; [[nodiscard]] FileMeta file_meta() const noexcept final; + [[nodiscard]] DecoderEngine decoder_engine() const noexcept final; private: std::shared_ptr m_file; diff --git a/src/odr/internal/zip/zip_file.cpp b/src/odr/internal/zip/zip_file.cpp index b0fb59a7..496a986a 100644 --- a/src/odr/internal/zip/zip_file.cpp +++ b/src/odr/internal/zip/zip_file.cpp @@ -23,6 +23,10 @@ FileMeta ZipFile::file_meta() const noexcept { return meta; } +DecoderEngine ZipFile::decoder_engine() const noexcept { + return DecoderEngine::odr; +} + std::shared_ptr ZipFile::archive() const { return std::make_shared(m_zip); } diff --git a/src/odr/internal/zip/zip_file.hpp b/src/odr/internal/zip/zip_file.hpp index 6d11c195..fde6f6db 100644 --- a/src/odr/internal/zip/zip_file.hpp +++ b/src/odr/internal/zip/zip_file.hpp @@ -27,6 +27,7 @@ class ZipFile final : public abstract::ArchiveFile { [[nodiscard]] FileType file_type() const noexcept final; [[nodiscard]] FileMeta file_meta() const noexcept final; + [[nodiscard]] DecoderEngine decoder_engine() const noexcept final; [[nodiscard]] std::shared_ptr archive() const final;