Skip to content

Commit d90b988

Browse files
authored
refactor document tree (#316)
1 parent 08d6aa8 commit d90b988

128 files changed

Lines changed: 5910 additions & 5375 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build_test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ concurrency:
1313
env:
1414
CCACHE_DIR: ${{ github.workspace }}/ccache
1515
CCACHE_MAXSIZE: 500M
16-
CCACHE_KEY_SUFFIX: r19
16+
CCACHE_KEY_SUFFIX: r20
1717

1818
jobs:
1919
build:
@@ -66,9 +66,9 @@ jobs:
6666
env:
6767
CC: ${{ matrix.config.cc }}
6868
CXX: ${{ matrix.config.cxx }}
69-
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
69+
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
7070
- name: build
71-
run: cmake --build build --config Release # `config Release` somehow necessary by windows
71+
run: cmake --build build --config Release # `config Release` somehow necessary for windows
7272

7373
- name: upload binaries
7474
uses: actions/upload-artifact@v2

CMakeLists.txt

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.12.4)
22

33
project(odr LANGUAGES C CXX)
4-
set(CMAKE_CXX_STANDARD 20)
4+
set(CMAKE_CXX_STANDARD 17)
55
set(CMAKE_CXX_STANDARD_REQUIRED ON)
66
set(CMAKE_CXX_EXTENSIONS OFF)
77

@@ -23,14 +23,9 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR
2323
#set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-omit-frame-pointer")
2424
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
2525
# using Visual Studio C++
26-
endif ()
2726

28-
# use ccache if available
29-
find_program(CCACHE_FOUND ccache)
30-
if (CCACHE_FOUND)
31-
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_FOUND}")
32-
message(STATUS "using ccache ${CCACHE_FOUND}")
33-
endif (CCACHE_FOUND)
27+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
28+
endif ()
3429

3530
if (NOT DEFINED CONAN_EXPORTED)
3631
include("cmake/conan.cmake")
@@ -71,8 +66,8 @@ endif ()
7166

7267
add_library(odr
7368
"src/odr/document.cpp"
74-
"src/odr/document_cursor.cpp"
7569
"src/odr/document_element.cpp"
70+
"src/odr/document_path.cpp"
7671
"src/odr/exceptions.cpp"
7772
"src/odr/file.cpp"
7873
"src/odr/html.cpp"
@@ -91,8 +86,8 @@ add_library(odr
9186
"src/odr/internal/cfb/cfb_impl.cpp"
9287
"src/odr/internal/cfb/cfb_util.cpp"
9388

94-
"src/odr/internal/common/document_cursor.cpp"
95-
"src/odr/internal/common/document_path.cpp"
89+
"src/odr/internal/common/document.cpp"
90+
"src/odr/internal/common/document_element.cpp"
9691
"src/odr/internal/common/file.cpp"
9792
"src/odr/internal/common/filesystem.cpp"
9893
"src/odr/internal/common/image_file.cpp"
@@ -110,37 +105,38 @@ add_library(odr
110105
"src/odr/internal/csv/csv_util.cpp"
111106

112107
"src/odr/internal/html/common.cpp"
113-
"src/odr/internal/html/css_writer.cpp"
114108
"src/odr/internal/html/document.cpp"
115109
"src/odr/internal/html/document_style.cpp"
116110
"src/odr/internal/html/document_element.cpp"
111+
"src/odr/internal/html/html_writer.cpp"
117112
"src/odr/internal/html/image_file.cpp"
118113
"src/odr/internal/html/text_file.cpp"
119114

120115
"src/odr/internal/json/json_file.cpp"
121116
"src/odr/internal/json/json_util.cpp"
122117

123118
"src/odr/internal/odf/odf_crypto.cpp"
124-
"src/odr/internal/odf/odf_cursor.cpp"
125119
"src/odr/internal/odf/odf_document.cpp"
126120
"src/odr/internal/odf/odf_element.cpp"
127121
"src/odr/internal/odf/odf_file.cpp"
128122
"src/odr/internal/odf/odf_manifest.cpp"
129123
"src/odr/internal/odf/odf_meta.cpp"
124+
"src/odr/internal/odf/odf_parser.cpp"
125+
"src/odr/internal/odf/odf_spreadsheet.cpp"
130126
"src/odr/internal/odf/odf_style.cpp"
131127

132128
"src/odr/internal/oldms/oldms_file.cpp"
133129

134-
"src/odr/internal/ooxml/presentation/ooxml_presentation_cursor.cpp"
135130
"src/odr/internal/ooxml/presentation/ooxml_presentation_document.cpp"
136131
"src/odr/internal/ooxml/presentation/ooxml_presentation_element.cpp"
137-
"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_cursor.cpp"
132+
"src/odr/internal/ooxml/presentation/ooxml_presentation_parser.cpp"
138133
"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_document.cpp"
139134
"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_element.cpp"
135+
"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_parser.cpp"
140136
"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_style.cpp"
141-
"src/odr/internal/ooxml/text/ooxml_text_cursor.cpp"
142137
"src/odr/internal/ooxml/text/ooxml_text_document.cpp"
143138
"src/odr/internal/ooxml/text/ooxml_text_element.cpp"
139+
"src/odr/internal/ooxml/text/ooxml_text_parser.cpp"
144140
"src/odr/internal/ooxml/text/ooxml_text_style.cpp"
145141
"src/odr/internal/ooxml/ooxml_crypto.cpp"
146142
"src/odr/internal/ooxml/ooxml_file.cpp"

experiments/.html-tidy

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
accessibility-check: 0 (Tidy Classic)
2+
add-meta-charset: no
3+
add-xml-decl: no
4+
add-xml-space: no
5+
alt-text:
6+
anchor-as-name: yes
7+
ascii-chars: no
8+
assume-xml-procins: no
9+
bare: no
10+
break-before-br: no
11+
char-encoding: utf8
12+
clean: no
13+
coerce-endtags: no
14+
css-prefix: c
15+
custom-tags: no
16+
decorate-inferred-ul: no
17+
doctype: html5
18+
drop-empty-elements: no
19+
drop-empty-paras: no
20+
drop-proprietary-attributes: no
21+
enclose-block-text: no
22+
enclose-text: no
23+
error-file:
24+
escape-cdata: no
25+
escape-scripts: yes
26+
fix-backslash: yes
27+
fix-bad-comments: auto
28+
fix-style-tags: yes
29+
fix-uri: no
30+
force-output: yes
31+
gdoc: no
32+
gnu-emacs: no
33+
hide-comments: no
34+
indent: auto
35+
indent-attributes: no
36+
indent-cdata: no
37+
indent-spaces: 2
38+
indent-with-tabs: no
39+
input-encoding: utf8
40+
input-xml: no
41+
join-classes: no
42+
join-styles: yes
43+
keep-tabs: no
44+
keep-time: no
45+
literal-attributes: no
46+
logical-emphasis: no
47+
lower-literals: yes
48+
markup: yes
49+
merge-divs: auto
50+
merge-emphasis: yes
51+
merge-spans: auto
52+
mute:
53+
mute-id: no
54+
ncr: yes
55+
new-blocklevel-tags: x-odr-s
56+
new-empty-tags:
57+
new-inline-tags:
58+
new-pre-tags:
59+
newline: LF
60+
numeric-entities: no
61+
omit-optional-tags: no
62+
output-bom: auto
63+
output-encoding: utf8
64+
output-file:
65+
output-html: no
66+
output-xhtml: no
67+
output-xml: no
68+
preserve-entities: yes
69+
priority-attributes:
70+
punctuation-wrap: no
71+
quiet: no
72+
quote-ampersand: yes
73+
quote-marks: no
74+
quote-nbsp: yes
75+
repeated-attributes: keep-last
76+
replace-color: no
77+
show-body-only: no
78+
show-errors: 6
79+
show-info: yes
80+
show-meta-change: no
81+
show-warnings: yes
82+
skip-nested: yes
83+
sort-attributes: alpha
84+
strict-tags-attributes: no
85+
tab-size: 4
86+
tidy-mark: no
87+
uppercase-attributes: no
88+
uppercase-tags: no
89+
vertical-space: no
90+
warn-proprietary-attributes: yes
91+
word-2000: no
92+
wrap: 0
93+
wrap-asp: no
94+
wrap-attributes: no
95+
wrap-jste: no
96+
wrap-php: no
97+
wrap-script-literals: no
98+
wrap-sections: no
99+
write-back: no

src/odr/document.cpp

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

3-
#include <odr/document_cursor.hpp>
3+
#include <odr/document_element.hpp>
44
#include <odr/file.hpp>
5-
65
#include <odr/internal/abstract/document.hpp>
7-
#include <odr/internal/abstract/document_cursor.hpp>
86
#include <odr/internal/common/path.hpp>
97

108
#include <stdexcept>
@@ -19,10 +17,10 @@ Document::Document(std::shared_ptr<internal::abstract::Document> document)
1917
}
2018
}
2119

22-
bool Document::editable() const noexcept { return m_document->editable(); }
20+
bool Document::editable() const noexcept { return m_document->is_editable(); }
2321

2422
bool Document::savable(const bool encrypted) const noexcept {
25-
return m_document->savable(encrypted);
23+
return m_document->is_savable(encrypted);
2624
}
2725

2826
void Document::save(const std::string &path) const { m_document->save(path); }
@@ -40,8 +38,8 @@ DocumentType Document::document_type() const noexcept {
4038
return m_document->document_type();
4139
}
4240

43-
DocumentCursor Document::root_element() const {
44-
return {m_document, m_document->root_element()};
41+
Element Document::root_element() const {
42+
return {m_document.get(), m_document->root_element()};
4543
}
4644

4745
} // namespace odr

src/odr/document.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace odr {
1212
enum class FileType;
1313
enum class DocumentType;
1414
class DocumentFile;
15-
class DocumentCursor;
15+
class Element;
1616

1717
class Document final {
1818
public:
@@ -27,7 +27,7 @@ class Document final {
2727
[[nodiscard]] FileType file_type() const noexcept;
2828
[[nodiscard]] DocumentType document_type() const noexcept;
2929

30-
[[nodiscard]] DocumentCursor root_element() const;
30+
[[nodiscard]] Element root_element() const;
3131

3232
private:
3333
std::shared_ptr<internal::abstract::Document> m_document;

0 commit comments

Comments
 (0)