Skip to content

Commit 432e8f5

Browse files
committed
draft
1 parent f80f519 commit 432e8f5

18 files changed

Lines changed: 866 additions & 466 deletions

CMakeLists.txt

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ set(ODR_SOURCE_FILES
9999
"src/odr/internal/cfb/cfb_util.cpp"
100100

101101
"src/odr/internal/common/document.cpp"
102-
"src/odr/internal/common/document_element.cpp"
103102
"src/odr/internal/common/file.cpp"
104103
"src/odr/internal/common/filesystem.cpp"
105104
"src/odr/internal/common/image_file.cpp"
@@ -133,29 +132,30 @@ set(ODR_SOURCE_FILES
133132

134133
"src/odr/internal/odf/odf_crypto.cpp"
135134
"src/odr/internal/odf/odf_document.cpp"
135+
"src/odr/internal/odf/odf_element_registry.cpp"
136136
"src/odr/internal/odf/odf_file.cpp"
137137
"src/odr/internal/odf/odf_manifest.cpp"
138138
"src/odr/internal/odf/odf_meta.cpp"
139-
"src/odr/internal/odf/odf_parser.cpp"
140-
"src/odr/internal/odf/odf_style.cpp"
139+
#"src/odr/internal/odf/odf_parser.cpp"
140+
#"src/odr/internal/odf/odf_style.cpp"
141141

142142
"src/odr/internal/oldms/oldms_file.cpp"
143143

144-
"src/odr/internal/ooxml/presentation/ooxml_presentation_document.cpp"
145-
"src/odr/internal/ooxml/presentation/ooxml_presentation_element.cpp"
146-
"src/odr/internal/ooxml/presentation/ooxml_presentation_parser.cpp"
147-
"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_document.cpp"
148-
"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_element.cpp"
149-
"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_parser.cpp"
150-
"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_style.cpp"
151-
"src/odr/internal/ooxml/text/ooxml_text_document.cpp"
152-
"src/odr/internal/ooxml/text/ooxml_text_element.cpp"
153-
"src/odr/internal/ooxml/text/ooxml_text_parser.cpp"
154-
"src/odr/internal/ooxml/text/ooxml_text_style.cpp"
155-
"src/odr/internal/ooxml/ooxml_crypto.cpp"
156-
"src/odr/internal/ooxml/ooxml_file.cpp"
157-
"src/odr/internal/ooxml/ooxml_meta.cpp"
158-
"src/odr/internal/ooxml/ooxml_util.cpp"
144+
#"src/odr/internal/ooxml/presentation/ooxml_presentation_document.cpp"
145+
#"src/odr/internal/ooxml/presentation/ooxml_presentation_element.cpp"
146+
#"src/odr/internal/ooxml/presentation/ooxml_presentation_parser.cpp"
147+
#"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_document.cpp"
148+
#"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_element.cpp"
149+
#"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_parser.cpp"
150+
#"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_style.cpp"
151+
#"src/odr/internal/ooxml/text/ooxml_text_document.cpp"
152+
#"src/odr/internal/ooxml/text/ooxml_text_element.cpp"
153+
#"src/odr/internal/ooxml/text/ooxml_text_parser.cpp"
154+
#"src/odr/internal/ooxml/text/ooxml_text_style.cpp"
155+
#"src/odr/internal/ooxml/ooxml_crypto.cpp"
156+
#"src/odr/internal/ooxml/ooxml_file.cpp"
157+
#"src/odr/internal/ooxml/ooxml_meta.cpp"
158+
#"src/odr/internal/ooxml/ooxml_util.cpp"
159159

160160
"src/odr/internal/pdf/pdf_cmap.cpp"
161161
"src/odr/internal/pdf/pdf_cmap_parser.cpp"

src/odr/document.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ DocumentType Document::document_type() const noexcept {
3939
}
4040

4141
Element Document::root_element() const {
42-
return {m_impl.get(), m_impl->root_element()};
42+
return {m_impl->element_adapter(), m_impl->root_element()};
4343
}
4444

4545
Filesystem Document::as_filesystem() const {

src/odr/document_element_identifier.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <compare>
44
#include <cstdint>
5+
#include <utility>
56

67
namespace odr {
78

src/odr/internal/abstract/document.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ class Document {
4848
/// \return cursor to the root element of the document.
4949
[[nodiscard]] virtual ExtendedElementIdentifier root_element() const = 0;
5050

51-
[[nodiscard]] virtual const ElementAdapter *
52-
element_adapter(ExtendedElementIdentifier element_id) const = 0;
51+
[[nodiscard]] virtual const ElementAdapter *element_adapter() const = 0;
5352
};
5453

5554
} // namespace odr::internal::abstract

src/odr/internal/common/document.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <odr/internal/common/document.hpp>
22

33
#include <odr/document_element_identifier.hpp>
4+
#include <odr/internal/abstract/document_element.hpp>
45
#include <odr/internal/abstract/filesystem.hpp>
56

67
namespace odr::internal {
@@ -10,6 +11,8 @@ Document::Document(const FileType file_type, const DocumentType document_type,
1011
: m_file_type{file_type}, m_document_type{document_type},
1112
m_files{std::move(files)} {}
1213

14+
Document::~Document() = default;
15+
1316
FileType Document::file_type() const noexcept { return m_file_type; }
1417

1518
DocumentType Document::document_type() const noexcept {
@@ -25,9 +28,8 @@ ExtendedElementIdentifier Document::root_element() const {
2528
return m_root_element;
2629
}
2730

28-
const abstract::ElementAdapter *
29-
Document::element_adapter(ExtendedElementIdentifier) const {
30-
return m_element_adapter;
31+
const abstract::ElementAdapter *Document::element_adapter() const {
32+
return m_element_adapter.get();
3133
}
3234

3335
} // namespace odr::internal

src/odr/internal/common/document.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class Document : public abstract::Document {
1515
public:
1616
Document(FileType file_type, DocumentType document_type,
1717
std::shared_ptr<abstract::ReadableFilesystem> files);
18+
~Document() override;
1819

1920
[[nodiscard]] FileType file_type() const noexcept final;
2021
[[nodiscard]] DocumentType document_type() const noexcept final;
@@ -25,7 +26,7 @@ class Document : public abstract::Document {
2526
[[nodiscard]] ExtendedElementIdentifier root_element() const override;
2627

2728
[[nodiscard]] const abstract::ElementAdapter *
28-
element_adapter(ExtendedElementIdentifier element_id) const override;
29+
element_adapter() const override;
2930

3031
protected:
3132
FileType m_file_type;
@@ -34,7 +35,7 @@ class Document : public abstract::Document {
3435
std::shared_ptr<abstract::ReadableFilesystem> m_files;
3536

3637
ExtendedElementIdentifier m_root_element;
37-
abstract::ElementAdapter *m_element_adapter{nullptr};
38+
std::unique_ptr<abstract::ElementAdapter> m_element_adapter;
3839
};
3940

4041
} // namespace odr::internal

src/odr/internal/common/document_element.cpp

Lines changed: 0 additions & 132 deletions
This file was deleted.

src/odr/internal/common/document_element.hpp

Lines changed: 0 additions & 88 deletions
This file was deleted.

0 commit comments

Comments
 (0)