Skip to content

Commit

Permalink
refactor document tree (#316)
Browse files Browse the repository at this point in the history
  • Loading branch information
andiwand authored Dec 26, 2023
1 parent 08d6aa8 commit d90b988
Show file tree
Hide file tree
Showing 128 changed files with 5,910 additions and 5,375 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
env:
CCACHE_DIR: ${{ github.workspace }}/ccache
CCACHE_MAXSIZE: 500M
CCACHE_KEY_SUFFIX: r19
CCACHE_KEY_SUFFIX: r20

jobs:
build:
Expand Down Expand Up @@ -66,9 +66,9 @@ jobs:
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: build
run: cmake --build build --config Release # `config Release` somehow necessary by windows
run: cmake --build build --config Release # `config Release` somehow necessary for windows

- name: upload binaries
uses: actions/upload-artifact@v2
Expand Down
28 changes: 12 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.12.4)

project(odr LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

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

# use ccache if available
find_program(CCACHE_FOUND ccache)
if (CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_FOUND}")
message(STATUS "using ccache ${CCACHE_FOUND}")
endif (CCACHE_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
endif ()

if (NOT DEFINED CONAN_EXPORTED)
include("cmake/conan.cmake")
Expand Down Expand Up @@ -71,8 +66,8 @@ endif ()

add_library(odr
"src/odr/document.cpp"
"src/odr/document_cursor.cpp"
"src/odr/document_element.cpp"
"src/odr/document_path.cpp"
"src/odr/exceptions.cpp"
"src/odr/file.cpp"
"src/odr/html.cpp"
Expand All @@ -91,8 +86,8 @@ add_library(odr
"src/odr/internal/cfb/cfb_impl.cpp"
"src/odr/internal/cfb/cfb_util.cpp"

"src/odr/internal/common/document_cursor.cpp"
"src/odr/internal/common/document_path.cpp"
"src/odr/internal/common/document.cpp"
"src/odr/internal/common/document_element.cpp"
"src/odr/internal/common/file.cpp"
"src/odr/internal/common/filesystem.cpp"
"src/odr/internal/common/image_file.cpp"
Expand All @@ -110,37 +105,38 @@ add_library(odr
"src/odr/internal/csv/csv_util.cpp"

"src/odr/internal/html/common.cpp"
"src/odr/internal/html/css_writer.cpp"
"src/odr/internal/html/document.cpp"
"src/odr/internal/html/document_style.cpp"
"src/odr/internal/html/document_element.cpp"
"src/odr/internal/html/html_writer.cpp"
"src/odr/internal/html/image_file.cpp"
"src/odr/internal/html/text_file.cpp"

"src/odr/internal/json/json_file.cpp"
"src/odr/internal/json/json_util.cpp"

"src/odr/internal/odf/odf_crypto.cpp"
"src/odr/internal/odf/odf_cursor.cpp"
"src/odr/internal/odf/odf_document.cpp"
"src/odr/internal/odf/odf_element.cpp"
"src/odr/internal/odf/odf_file.cpp"
"src/odr/internal/odf/odf_manifest.cpp"
"src/odr/internal/odf/odf_meta.cpp"
"src/odr/internal/odf/odf_parser.cpp"
"src/odr/internal/odf/odf_spreadsheet.cpp"
"src/odr/internal/odf/odf_style.cpp"

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

"src/odr/internal/ooxml/presentation/ooxml_presentation_cursor.cpp"
"src/odr/internal/ooxml/presentation/ooxml_presentation_document.cpp"
"src/odr/internal/ooxml/presentation/ooxml_presentation_element.cpp"
"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_cursor.cpp"
"src/odr/internal/ooxml/presentation/ooxml_presentation_parser.cpp"
"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_document.cpp"
"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_element.cpp"
"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_parser.cpp"
"src/odr/internal/ooxml/spreadsheet/ooxml_spreadsheet_style.cpp"
"src/odr/internal/ooxml/text/ooxml_text_cursor.cpp"
"src/odr/internal/ooxml/text/ooxml_text_document.cpp"
"src/odr/internal/ooxml/text/ooxml_text_element.cpp"
"src/odr/internal/ooxml/text/ooxml_text_parser.cpp"
"src/odr/internal/ooxml/text/ooxml_text_style.cpp"
"src/odr/internal/ooxml/ooxml_crypto.cpp"
"src/odr/internal/ooxml/ooxml_file.cpp"
Expand Down
99 changes: 99 additions & 0 deletions experiments/.html-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
accessibility-check: 0 (Tidy Classic)
add-meta-charset: no
add-xml-decl: no
add-xml-space: no
alt-text:
anchor-as-name: yes
ascii-chars: no
assume-xml-procins: no
bare: no
break-before-br: no
char-encoding: utf8
clean: no
coerce-endtags: no
css-prefix: c
custom-tags: no
decorate-inferred-ul: no
doctype: html5
drop-empty-elements: no
drop-empty-paras: no
drop-proprietary-attributes: no
enclose-block-text: no
enclose-text: no
error-file:
escape-cdata: no
escape-scripts: yes
fix-backslash: yes
fix-bad-comments: auto
fix-style-tags: yes
fix-uri: no
force-output: yes
gdoc: no
gnu-emacs: no
hide-comments: no
indent: auto
indent-attributes: no
indent-cdata: no
indent-spaces: 2
indent-with-tabs: no
input-encoding: utf8
input-xml: no
join-classes: no
join-styles: yes
keep-tabs: no
keep-time: no
literal-attributes: no
logical-emphasis: no
lower-literals: yes
markup: yes
merge-divs: auto
merge-emphasis: yes
merge-spans: auto
mute:
mute-id: no
ncr: yes
new-blocklevel-tags: x-odr-s
new-empty-tags:
new-inline-tags:
new-pre-tags:
newline: LF
numeric-entities: no
omit-optional-tags: no
output-bom: auto
output-encoding: utf8
output-file:
output-html: no
output-xhtml: no
output-xml: no
preserve-entities: yes
priority-attributes:
punctuation-wrap: no
quiet: no
quote-ampersand: yes
quote-marks: no
quote-nbsp: yes
repeated-attributes: keep-last
replace-color: no
show-body-only: no
show-errors: 6
show-info: yes
show-meta-change: no
show-warnings: yes
skip-nested: yes
sort-attributes: alpha
strict-tags-attributes: no
tab-size: 4
tidy-mark: no
uppercase-attributes: no
uppercase-tags: no
vertical-space: no
warn-proprietary-attributes: yes
word-2000: no
wrap: 0
wrap-asp: no
wrap-attributes: no
wrap-jste: no
wrap-php: no
wrap-script-literals: no
wrap-sections: no
write-back: no
12 changes: 5 additions & 7 deletions src/odr/document.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#include <odr/document.hpp>

#include <odr/document_cursor.hpp>
#include <odr/document_element.hpp>
#include <odr/file.hpp>

#include <odr/internal/abstract/document.hpp>
#include <odr/internal/abstract/document_cursor.hpp>
#include <odr/internal/common/path.hpp>

#include <stdexcept>
Expand All @@ -19,10 +17,10 @@ Document::Document(std::shared_ptr<internal::abstract::Document> document)
}
}

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

bool Document::savable(const bool encrypted) const noexcept {
return m_document->savable(encrypted);
return m_document->is_savable(encrypted);
}

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

DocumentCursor Document::root_element() const {
return {m_document, m_document->root_element()};
Element Document::root_element() const {
return {m_document.get(), m_document->root_element()};
}

} // namespace odr
4 changes: 2 additions & 2 deletions src/odr/document.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace odr {
enum class FileType;
enum class DocumentType;
class DocumentFile;
class DocumentCursor;
class Element;

class Document final {
public:
Expand All @@ -27,7 +27,7 @@ class Document final {
[[nodiscard]] FileType file_type() const noexcept;
[[nodiscard]] DocumentType document_type() const noexcept;

[[nodiscard]] DocumentCursor root_element() const;
[[nodiscard]] Element root_element() const;

private:
std::shared_ptr<internal::abstract::Document> m_document;
Expand Down
Loading

0 comments on commit d90b988

Please sign in to comment.