From bebb1a580577788804501e1fd2b9867e0950c6a6 Mon Sep 17 00:00:00 2001 From: Cadons <43477517+Cadons@users.noreply.github.com> Date: Wed, 11 Mar 2026 23:22:17 +0100 Subject: [PATCH] Vcpkg fixes (#5) * fix(project): update version to 1.0.0 for stable release * fix(cmake): update installation directory for CMake configuration * fix(cmake): update installation path for include directory * fix(cmake): correct path for DocraftConfig.cmake input file * fix(cmake): update include paths for source files and documentation * fix(license): add Apache 2.0 license header to source files * fix(cmake): update installation directory for include files * release workflow removed --------- Co-authored-by: cadons --- .cmake/font_header_init.cmake | 2 +- .cmake/generate_fonts.cmake | 3 +- .github/workflows/release.yml | 123 ------- CMakeLists.txt | 26 +- cmake/DocraftConfig.cmake.in | 40 +++ .../components/backend-integration.md | 2 +- doc/project-doc/craft-language.md | 2 +- doc/project-doc/users/craft-language.md | 6 +- doc/source/getting_started.rst | 12 +- docraft/CMakeLists.txt | 329 +++++++++--------- .../craft/parser/docraft_circle_parser.h | 20 -- .../craft/parser/docraft_line_parser.h | 20 -- .../craft/parser/docraft_polygon_parser.h | 20 -- .../craft/parser/docraft_shape_parser_utils.h | 12 - .../craft/parser/docraft_triangle_parser.h | 20 -- docraft/include/{ => docraft}/.gitkeep | 0 .../backend/docraft_image_rendering_backend.h | 18 +- .../backend/docraft_line_rendering_backend.h | 18 +- .../backend/docraft_page_rendering_backend.h | 20 +- .../backend/docraft_pdf_backend.h | 18 +- .../backend/docraft_rendering_backend.h | 26 +- .../backend/docraft_shape_rendering_backend.h | 22 +- .../backend/docraft_text_rendering_backend.h | 20 +- .../backend/pdf/docraft_haru_backend.h | 23 +- .../craft/docraft_craft_language_parser.h | 22 +- .../craft/docraft_craft_language_tokens.h | 18 +- .../{ => docraft}/craft/i_docraft_parser.h | 20 +- .../craft/parser/docraft_circle_parser.h | 36 ++ .../craft/parser/docraft_line_parser.h | 36 ++ .../craft/parser/docraft_parser.h | 34 +- .../craft/parser/docraft_parser_helpers.h | 26 +- .../craft/parser/docraft_polygon_parser.h | 36 ++ .../craft/parser/docraft_shape_parser_utils.h | 28 ++ .../craft/parser/docraft_triangle_parser.h | 36 ++ docraft/include/{ => docraft}/docraft_color.h | 18 +- .../include/{ => docraft}/docraft_cursor.h | 20 +- .../include/{ => docraft}/docraft_document.h | 30 +- .../{ => docraft}/docraft_document.hpp | 0 .../{ => docraft}/docraft_document_context.h | 24 +- .../{ => docraft}/docraft_document_metadata.h | 18 +- docraft/include/docraft/docraft_lib.h | 35 ++ .../generic/chain_of_responsibility_handler.h | 18 +- .../generic/docraft_font_applier.h | 18 +- .../layout/docraft_layout_engine.h | 26 +- .../handler/abstract_docraft_layout_handler.h | 24 +- .../handler/docraft_basic_layout_handler.h | 22 +- .../handler/docraft_layout_blank_line.h | 21 +- .../layout/handler/docraft_layout_handler.h | 24 +- .../handler/docraft_layout_list_handler.h | 20 +- .../handler/docraft_layout_table_handler.h | 22 +- .../handler/docraft_layout_text_handler.h | 24 +- .../docraft/model/docraft_blank_line.h | 40 +++ docraft/include/docraft/model/docraft_body.h | 36 ++ .../model/docraft_children_container_node.h | 20 +- .../{ => docraft}/model/docraft_circle.h | 24 +- .../docraft/model/docraft_clone_utils.h | 28 ++ .../include/docraft/model/docraft_footer.h | 42 +++ .../{ => docraft}/model/docraft_foreach.h | 26 +- .../include/docraft/model/docraft_header.h | 39 +++ .../{ => docraft}/model/docraft_image.h | 22 +- .../{ => docraft}/model/docraft_layout.h | 24 +- .../{ => docraft}/model/docraft_line.h | 26 +- .../{ => docraft}/model/docraft_list.h | 24 +- .../include/docraft/model/docraft_new_page.h | 42 +++ .../{ => docraft}/model/docraft_node.h | 20 +- .../docraft/model/docraft_page_format.h | 38 ++ .../{ => docraft}/model/docraft_page_number.h | 20 +- .../{ => docraft}/model/docraft_paragraph.h | 22 +- .../{ => docraft}/model/docraft_polygon.h | 26 +- .../{ => docraft}/model/docraft_position.h | 18 +- .../{ => docraft}/model/docraft_rectangle.h | 26 +- .../{ => docraft}/model/docraft_section.h | 22 +- .../{ => docraft}/model/docraft_settings.h | 22 +- .../{ => docraft}/model/docraft_table.h | 28 +- .../{ => docraft}/model/docraft_text.h | 26 +- .../{ => docraft}/model/docraft_triangle.h | 26 +- .../docraft/model/i_docraft_clonable.h | 39 +++ .../renderer/docraft_pdf_renderer.h | 34 +- .../{ => docraft}/renderer/docraft_renderer.h | 36 +- .../painter/docraft_blank_line_painter.h | 22 +- .../renderer/painter/docraft_circle_painter.h | 42 +++ .../renderer/painter/docraft_image_painter.h | 22 +- .../renderer/painter/docraft_line_painter.h | 42 +++ .../painter/docraft_polygon_painter.h | 42 +++ .../painter/docraft_rectangle_painter.h | 22 +- .../renderer/painter/docraft_table_painter.h | 22 +- .../renderer/painter/docraft_text_painter.h | 24 +- .../painter/docraft_triangle_painter.h | 42 +++ .../docraft/renderer/painter/i_painter.h | 40 +++ .../templating/docraft_template_engine.h | 18 +- .../include/docraft/utils/docraft_base64.h | 29 ++ .../utils/docraft_font_registry.h | 18 +- .../utils/docraft_font_resolver.h | 20 +- .../utils/docraft_keyword_extractor.h | 18 +- .../{ => docraft}/utils/docraft_logger.h | 18 +- .../utils/docraft_parser_utilis.h | 16 + docraft/include/docraft_lib.h | 19 - docraft/include/model/docraft_blank_line.h | 24 -- docraft/include/model/docraft_body.h | 20 -- docraft/include/model/docraft_clone_utils.h | 12 - docraft/include/model/docraft_footer.h | 26 -- docraft/include/model/docraft_header.h | 23 -- docraft/include/model/docraft_new_page.h | 26 -- docraft/include/model/docraft_page_format.h | 22 -- docraft/include/model/i_docraft_clonable.h | 23 -- .../renderer/painter/docraft_circle_painter.h | 26 -- .../renderer/painter/docraft_line_painter.h | 26 -- .../painter/docraft_polygon_painter.h | 26 -- .../painter/docraft_triangle_painter.h | 26 -- docraft/include/renderer/painter/i_painter.h | 24 -- docraft/include/utils/docraft_base64.h | 13 - .../craft/parser/docraft_blank_line_parser.cc | 12 - .../craft/parser/docraft_new_page_parser.cc | 12 - .../backend/pdf/docraft_haru_backend.cc | 20 +- .../craft/docraft_craft_language_parser.cc | 42 ++- .../craft/parser/docraft_blank_line_parser.cc | 28 ++ .../craft/parser/docraft_circle_parser.cc | 24 +- .../craft/parser/docraft_foreach_parser.cc | 22 +- .../craft/parser/docraft_image_parser.cc | 24 +- .../craft/parser/docraft_layout_parser.cc | 22 +- .../craft/parser/docraft_line_parser.cc | 24 +- .../craft/parser/docraft_list_parser.cc | 22 +- .../craft/parser/docraft_new_page_parser.cc | 28 ++ .../parser/docraft_page_number_parser.cc | 22 +- .../craft/parser/docraft_parser_helpers.cc | 18 +- .../craft/parser/docraft_polygon_parser.cc | 26 +- .../craft/parser/docraft_rectangle_parser.cc | 22 +- .../craft/parser/docraft_section_parsers.cc | 26 +- .../craft/parser/docraft_settings_parser.cc | 22 +- .../parser/docraft_shape_parser_utils.cc | 18 +- .../craft/parser/docraft_table_parser.cc | 26 +- .../craft/parser/docraft_text_parser.cc | 22 +- .../craft/parser/docraft_triangle_parser.cc | 26 +- docraft/src/{ => docraft}/docraft_color.cc | 20 +- docraft/src/{ => docraft}/docraft_cursor.cc | 18 +- docraft/src/{ => docraft}/docraft_document.cc | 28 +- .../{ => docraft}/docraft_document_context.cc | 22 +- .../generic/docraft_font_applier.cc | 28 +- .../layout/docraft_layout_engine.cc | 47 ++- .../handler/docraft_basic_layout_handler.cc | 26 +- .../handler/docraft_layout_blank_line.cc | 18 +- .../layout/handler/docraft_layout_handler.cc | 20 +- .../handler/docraft_layout_list_handler.cc | 22 +- .../handler/docraft_layout_table_handler.cc | 26 +- .../handler/docraft_layout_text_handler.cc | 26 +- docraft/src/{ => docraft}/main.cpp | 26 +- .../src/docraft/model/docraft_blank_line.cc | 34 ++ docraft/src/docraft/model/docraft_body.cc | 31 ++ .../model/docraft_children_container_node.cc | 18 +- .../src/{ => docraft}/model/docraft_circle.cc | 24 +- .../model/docraft_clone_utils.cc | 18 +- docraft/src/docraft/model/docraft_footer.cc | 36 ++ .../{ => docraft}/model/docraft_foreach.cc | 22 +- docraft/src/docraft/model/docraft_header.cc | 35 ++ .../src/{ => docraft}/model/docraft_image.cc | 20 +- .../src/{ => docraft}/model/docraft_layout.cc | 22 +- .../src/{ => docraft}/model/docraft_line.cc | 24 +- .../src/{ => docraft}/model/docraft_list.cc | 22 +- docraft/src/docraft/model/docraft_new_page.cc | 21 ++ .../src/{ => docraft}/model/docraft_node.cc | 18 +- .../model/docraft_page_number.cc | 24 +- .../src/docraft/model/docraft_paragraph.cc | 31 ++ .../{ => docraft}/model/docraft_polygon.cc | 24 +- .../{ => docraft}/model/docraft_position.cc | 20 +- .../{ => docraft}/model/docraft_rectangle.cc | 24 +- .../{ => docraft}/model/docraft_section.cc | 22 +- .../{ => docraft}/model/docraft_settings.cc | 18 +- .../src/{ => docraft}/model/docraft_table.cc | 28 +- .../src/{ => docraft}/model/docraft_text.cc | 22 +- .../{ => docraft}/model/docraft_triangle.cc | 22 +- .../renderer/docraft_pdf_renderer.cc | 38 +- .../painter/docraft_blank_line_painter.cc | 27 ++ .../painter/docraft_circle_painter.cc | 20 +- .../renderer/painter/docraft_image_painter.cc | 20 +- .../renderer/painter/docraft_line_painter.cc | 22 +- .../painter/docraft_polygon_painter.cc | 20 +- .../painter/docraft_rectangle_painter.cc | 20 +- .../renderer/painter/docraft_table_painter.cc | 25 +- .../renderer/painter/docraft_text_painter.cc | 20 +- .../painter/docraft_triangle_painter.cc | 20 +- .../templating/docraft_template_engine.cc | 46 ++- .../src/{ => docraft}/utils/docraft_base64.cc | 18 +- .../utils/docraft_font_registry.cc | 18 +- .../utils/docraft_font_resolver.cc | 18 +- .../utils/docraft_keyword_extractor.cc | 22 +- .../src/{ => docraft}/utils/docraft_logger.cc | 18 +- .../utils/docraft_parser_utilis.cc | 20 +- docraft/src/model/docraft_blank_line.cc | 18 - docraft/src/model/docraft_body.cc | 15 - docraft/src/model/docraft_footer.cc | 20 -- docraft/src/model/docraft_header.cc | 19 - docraft/src/model/docraft_new_page.cc | 5 - docraft/src/model/docraft_paragraph.cc | 15 - .../painter/docraft_blank_line_painter.cc | 11 - docraft/test/CMakeLists.txt | 54 +-- .../backend/docraft_haru_backend_test.cc | 6 +- .../docraft_craft_language_parser_test.cc | 4 +- .../craft/docraft_image_parser_test.cc | 4 +- .../craft/docraft_settings_parser_test.cc | 4 +- .../craft/docraft_shape_parser_test.cc | 22 +- .../craft/docraft_table_parser_test.cc | 4 +- .../test/{ => docraft}/docraft_color_test.cc | 2 +- .../{ => docraft}/docraft_document_test.cc | 10 +- .../generic/docraft_font_applier_test.cc | 8 +- .../layout/docraft_cursor_test.cc | 2 +- .../layout/docraft_layout_engine_test.cc | 18 +- .../docraft_layout_text_handler_test.cc | 4 +- .../layout/docraft_pagination_test.cc | 18 +- docraft/test/{ => docraft}/main.cpp | 0 .../{ => docraft}/model/docraft_clone_test.cc | 14 +- .../{ => docraft}/model/docraft_list_test.cc | 6 +- .../{ => docraft}/model/docraft_node_test.cc | 6 +- .../model/docraft_position_test.cc | 4 +- .../model/docraft_settings_test.cc | 2 +- .../model/docraft_z_index_test.cc | 2 +- .../renderer/docraft_image_painter_test.cc | 6 +- .../renderer/docraft_painter_smoke_test.cc | 36 +- .../renderer/docraft_section_margin_test.cc | 12 +- .../docraft_template_engine_test.cc | 12 +- .../utils/docraft_keyword_extractor_test.cc | 6 +- .../utils/docraft_logger_test.cc | 2 +- .../utils/docraft_mock_rendering_backend.h | 2 +- .../utils/docraft_parser_utils.cc | 2 +- 223 files changed, 3814 insertions(+), 1415 deletions(-) delete mode 100644 .github/workflows/release.yml create mode 100644 cmake/DocraftConfig.cmake.in delete mode 100644 docraft/include/craft/parser/docraft_circle_parser.h delete mode 100644 docraft/include/craft/parser/docraft_line_parser.h delete mode 100644 docraft/include/craft/parser/docraft_polygon_parser.h delete mode 100644 docraft/include/craft/parser/docraft_shape_parser_utils.h delete mode 100644 docraft/include/craft/parser/docraft_triangle_parser.h rename docraft/include/{ => docraft}/.gitkeep (100%) rename docraft/include/{ => docraft}/backend/docraft_image_rendering_backend.h (76%) rename docraft/include/{ => docraft}/backend/docraft_line_rendering_backend.h (65%) rename docraft/include/{ => docraft}/backend/docraft_page_rendering_backend.h (75%) rename docraft/include/{ => docraft}/backend/docraft_pdf_backend.h (52%) rename docraft/include/{ => docraft}/backend/docraft_rendering_backend.h (72%) rename docraft/include/{ => docraft}/backend/docraft_shape_rendering_backend.h (77%) rename docraft/include/{ => docraft}/backend/docraft_text_rendering_backend.h (78%) rename docraft/include/{ => docraft}/backend/pdf/docraft_haru_backend.h (90%) rename docraft/include/{ => docraft}/craft/docraft_craft_language_parser.h (77%) rename docraft/include/{ => docraft}/craft/docraft_craft_language_tokens.h (94%) rename docraft/include/{ => docraft}/craft/i_docraft_parser.h (53%) create mode 100644 docraft/include/docraft/craft/parser/docraft_circle_parser.h create mode 100644 docraft/include/docraft/craft/parser/docraft_line_parser.h rename docraft/include/{ => docraft}/craft/parser/docraft_parser.h (86%) rename docraft/include/{ => docraft}/craft/parser/docraft_parser_helpers.h (75%) create mode 100644 docraft/include/docraft/craft/parser/docraft_polygon_parser.h create mode 100644 docraft/include/docraft/craft/parser/docraft_shape_parser_utils.h create mode 100644 docraft/include/docraft/craft/parser/docraft_triangle_parser.h rename docraft/include/{ => docraft}/docraft_color.h (85%) rename docraft/include/{ => docraft}/docraft_cursor.h (77%) rename docraft/include/{ => docraft}/docraft_document.h (88%) rename docraft/include/{ => docraft}/docraft_document.hpp (100%) rename docraft/include/{ => docraft}/docraft_document_context.h (90%) rename docraft/include/{ => docraft}/docraft_document_metadata.h (84%) create mode 100644 docraft/include/docraft/docraft_lib.h rename docraft/include/{ => docraft}/generic/chain_of_responsibility_handler.h (57%) rename docraft/include/{ => docraft}/generic/docraft_font_applier.h (81%) rename docraft/include/{ => docraft}/layout/docraft_layout_engine.h (87%) rename docraft/include/{ => docraft}/layout/handler/abstract_docraft_layout_handler.h (68%) rename docraft/include/{ => docraft}/layout/handler/docraft_basic_layout_handler.h (61%) rename docraft/include/{ => docraft}/layout/handler/docraft_layout_blank_line.h (62%) rename docraft/include/{ => docraft}/layout/handler/docraft_layout_handler.h (59%) rename docraft/include/{ => docraft}/layout/handler/docraft_layout_list_handler.h (75%) rename docraft/include/{ => docraft}/layout/handler/docraft_layout_table_handler.h (60%) rename docraft/include/{ => docraft}/layout/handler/docraft_layout_text_handler.h (70%) create mode 100644 docraft/include/docraft/model/docraft_blank_line.h create mode 100644 docraft/include/docraft/model/docraft_body.h rename docraft/include/{ => docraft}/model/docraft_children_container_node.h (78%) rename docraft/include/{ => docraft}/model/docraft_circle.h (70%) create mode 100644 docraft/include/docraft/model/docraft_clone_utils.h create mode 100644 docraft/include/docraft/model/docraft_footer.h rename docraft/include/{ => docraft}/model/docraft_foreach.h (70%) create mode 100644 docraft/include/docraft/model/docraft_header.h rename docraft/include/{ => docraft}/model/docraft_image.h (85%) rename docraft/include/{ => docraft}/model/docraft_layout.h (75%) rename docraft/include/{ => docraft}/model/docraft_line.h (71%) rename docraft/include/{ => docraft}/model/docraft_list.h (87%) create mode 100644 docraft/include/docraft/model/docraft_new_page.h rename docraft/include/{ => docraft}/model/docraft_node.h (87%) create mode 100644 docraft/include/docraft/model/docraft_page_format.h rename docraft/include/{ => docraft}/model/docraft_page_number.h (61%) rename docraft/include/{ => docraft}/model/docraft_paragraph.h (50%) rename docraft/include/{ => docraft}/model/docraft_polygon.h (72%) rename docraft/include/{ => docraft}/model/docraft_position.h (86%) rename docraft/include/{ => docraft}/model/docraft_rectangle.h (78%) rename docraft/include/{ => docraft}/model/docraft_section.h (78%) rename docraft/include/{ => docraft}/model/docraft_settings.h (83%) rename docraft/include/{ => docraft}/model/docraft_table.h (94%) rename docraft/include/{ => docraft}/model/docraft_text.h (87%) rename docraft/include/{ => docraft}/model/docraft_triangle.h (73%) create mode 100644 docraft/include/docraft/model/i_docraft_clonable.h rename docraft/include/{ => docraft}/renderer/docraft_pdf_renderer.h (70%) rename docraft/include/{ => docraft}/renderer/docraft_renderer.h (74%) rename docraft/include/{ => docraft}/renderer/painter/docraft_blank_line_painter.h (53%) create mode 100644 docraft/include/docraft/renderer/painter/docraft_circle_painter.h rename docraft/include/{ => docraft}/renderer/painter/docraft_image_painter.h (51%) create mode 100644 docraft/include/docraft/renderer/painter/docraft_line_painter.h create mode 100644 docraft/include/docraft/renderer/painter/docraft_polygon_painter.h rename docraft/include/{ => docraft}/renderer/painter/docraft_rectangle_painter.h (51%) rename docraft/include/{ => docraft}/renderer/painter/docraft_table_painter.h (51%) rename docraft/include/{ => docraft}/renderer/painter/docraft_text_painter.h (74%) create mode 100644 docraft/include/docraft/renderer/painter/docraft_triangle_painter.h create mode 100644 docraft/include/docraft/renderer/painter/i_painter.h rename docraft/include/{ => docraft}/templating/docraft_template_engine.h (89%) create mode 100644 docraft/include/docraft/utils/docraft_base64.h rename docraft/include/{ => docraft}/utils/docraft_font_registry.h (75%) rename docraft/include/{ => docraft}/utils/docraft_font_resolver.h (78%) rename docraft/include/{ => docraft}/utils/docraft_keyword_extractor.h (73%) rename docraft/include/{ => docraft}/utils/docraft_logger.h (80%) rename docraft/include/{ => docraft}/utils/docraft_parser_utilis.h (65%) delete mode 100644 docraft/include/docraft_lib.h delete mode 100644 docraft/include/model/docraft_blank_line.h delete mode 100644 docraft/include/model/docraft_body.h delete mode 100644 docraft/include/model/docraft_clone_utils.h delete mode 100644 docraft/include/model/docraft_footer.h delete mode 100644 docraft/include/model/docraft_header.h delete mode 100644 docraft/include/model/docraft_new_page.h delete mode 100644 docraft/include/model/docraft_page_format.h delete mode 100644 docraft/include/model/i_docraft_clonable.h delete mode 100644 docraft/include/renderer/painter/docraft_circle_painter.h delete mode 100644 docraft/include/renderer/painter/docraft_line_painter.h delete mode 100644 docraft/include/renderer/painter/docraft_polygon_painter.h delete mode 100644 docraft/include/renderer/painter/docraft_triangle_painter.h delete mode 100644 docraft/include/renderer/painter/i_painter.h delete mode 100644 docraft/include/utils/docraft_base64.h delete mode 100644 docraft/src/craft/parser/docraft_blank_line_parser.cc delete mode 100644 docraft/src/craft/parser/docraft_new_page_parser.cc rename docraft/src/{ => docraft}/backend/pdf/docraft_haru_backend.cc (97%) rename docraft/src/{ => docraft}/craft/docraft_craft_language_parser.cc (96%) create mode 100644 docraft/src/docraft/craft/parser/docraft_blank_line_parser.cc rename docraft/src/{ => docraft}/craft/parser/docraft_circle_parser.cc (55%) rename docraft/src/{ => docraft}/craft/parser/docraft_foreach_parser.cc (88%) rename docraft/src/{ => docraft}/craft/parser/docraft_image_parser.cc (79%) rename docraft/src/{ => docraft}/craft/parser/docraft_layout_parser.cc (56%) rename docraft/src/{ => docraft}/craft/parser/docraft_line_parser.cc (64%) rename docraft/src/{ => docraft}/craft/parser/docraft_list_parser.cc (74%) create mode 100644 docraft/src/docraft/craft/parser/docraft_new_page_parser.cc rename docraft/src/{ => docraft}/craft/parser/docraft_page_number_parser.cc (78%) rename docraft/src/{ => docraft}/craft/parser/docraft_parser_helpers.cc (92%) rename docraft/src/{ => docraft}/craft/parser/docraft_polygon_parser.cc (59%) rename docraft/src/{ => docraft}/craft/parser/docraft_rectangle_parser.cc (73%) rename docraft/src/{ => docraft}/craft/parser/docraft_section_parsers.cc (67%) rename docraft/src/{ => docraft}/craft/parser/docraft_settings_parser.cc (89%) rename docraft/src/{ => docraft}/craft/parser/docraft_shape_parser_utils.cc (67%) rename docraft/src/{ => docraft}/craft/parser/docraft_table_parser.cc (95%) rename docraft/src/{ => docraft}/craft/parser/docraft_text_parser.cc (82%) rename docraft/src/{ => docraft}/craft/parser/docraft_triangle_parser.cc (62%) rename docraft/src/{ => docraft}/docraft_color.cc (82%) rename docraft/src/{ => docraft}/docraft_cursor.cc (65%) rename docraft/src/{ => docraft}/docraft_document.cc (93%) rename docraft/src/{ => docraft}/docraft_document_context.cc (88%) rename docraft/src/{ => docraft}/generic/docraft_font_applier.cc (91%) rename docraft/src/{ => docraft}/layout/docraft_layout_engine.cc (95%) rename docraft/src/{ => docraft}/layout/handler/docraft_basic_layout_handler.cc (75%) rename docraft/src/{ => docraft}/layout/handler/docraft_layout_blank_line.cc (63%) rename docraft/src/{ => docraft}/layout/handler/docraft_layout_handler.cc (60%) rename docraft/src/{ => docraft}/layout/handler/docraft_layout_list_handler.cc (87%) rename docraft/src/{ => docraft}/layout/handler/docraft_layout_table_handler.cc (96%) rename docraft/src/{ => docraft}/layout/handler/docraft_layout_text_handler.cc (90%) rename docraft/src/{ => docraft}/main.cpp (94%) create mode 100644 docraft/src/docraft/model/docraft_blank_line.cc create mode 100644 docraft/src/docraft/model/docraft_body.cc rename docraft/src/{ => docraft}/model/docraft_children_container_node.cc (81%) rename docraft/src/{ => docraft}/model/docraft_circle.cc (56%) rename docraft/src/{ => docraft}/model/docraft_clone_utils.cc (54%) create mode 100644 docraft/src/docraft/model/docraft_footer.cc rename docraft/src/{ => docraft}/model/docraft_foreach.cc (58%) create mode 100644 docraft/src/docraft/model/docraft_header.cc rename docraft/src/{ => docraft}/model/docraft_image.cc (80%) rename docraft/src/{ => docraft}/model/docraft_layout.cc (71%) rename docraft/src/{ => docraft}/model/docraft_line.cc (58%) rename docraft/src/{ => docraft}/model/docraft_list.cc (90%) create mode 100644 docraft/src/docraft/model/docraft_new_page.cc rename docraft/src/{ => docraft}/model/docraft_node.cc (84%) rename docraft/src/{ => docraft}/model/docraft_page_number.cc (63%) create mode 100644 docraft/src/docraft/model/docraft_paragraph.cc rename docraft/src/{ => docraft}/model/docraft_polygon.cc (61%) rename docraft/src/{ => docraft}/model/docraft_position.cc (84%) rename docraft/src/{ => docraft}/model/docraft_rectangle.cc (69%) rename docraft/src/{ => docraft}/model/docraft_section.cc (73%) rename docraft/src/{ => docraft}/model/docraft_settings.cc (73%) rename docraft/src/{ => docraft}/model/docraft_table.cc (96%) rename docraft/src/{ => docraft}/model/docraft_text.cc (84%) rename docraft/src/{ => docraft}/model/docraft_triangle.cc (63%) rename docraft/src/{ => docraft}/renderer/docraft_pdf_renderer.cc (78%) create mode 100644 docraft/src/docraft/renderer/painter/docraft_blank_line_painter.cc rename docraft/src/{ => docraft}/renderer/painter/docraft_circle_painter.cc (70%) rename docraft/src/{ => docraft}/renderer/painter/docraft_image_painter.cc (72%) rename docraft/src/{ => docraft}/renderer/painter/docraft_line_painter.cc (63%) rename docraft/src/{ => docraft}/renderer/painter/docraft_polygon_painter.cc (72%) rename docraft/src/{ => docraft}/renderer/painter/docraft_rectangle_painter.cc (75%) rename docraft/src/{ => docraft}/renderer/painter/docraft_table_painter.cc (93%) rename docraft/src/{ => docraft}/renderer/painter/docraft_text_painter.cc (86%) rename docraft/src/{ => docraft}/renderer/painter/docraft_triangle_painter.cc (72%) rename docraft/src/{ => docraft}/templating/docraft_template_engine.cc (91%) rename docraft/src/{ => docraft}/utils/docraft_base64.cc (86%) rename docraft/src/{ => docraft}/utils/docraft_font_registry.cc (75%) rename docraft/src/{ => docraft}/utils/docraft_font_resolver.cc (86%) rename docraft/src/{ => docraft}/utils/docraft_keyword_extractor.cc (90%) rename docraft/src/{ => docraft}/utils/docraft_logger.cc (82%) rename docraft/src/{ => docraft}/utils/docraft_parser_utilis.cc (81%) delete mode 100644 docraft/src/model/docraft_blank_line.cc delete mode 100644 docraft/src/model/docraft_body.cc delete mode 100644 docraft/src/model/docraft_footer.cc delete mode 100644 docraft/src/model/docraft_header.cc delete mode 100644 docraft/src/model/docraft_new_page.cc delete mode 100644 docraft/src/model/docraft_paragraph.cc delete mode 100644 docraft/src/renderer/painter/docraft_blank_line_painter.cc rename docraft/test/{ => docraft}/backend/docraft_haru_backend_test.cc (97%) rename docraft/test/{ => docraft}/craft/docraft_craft_language_parser_test.cc (98%) rename docraft/test/{ => docraft}/craft/docraft_image_parser_test.cc (92%) rename docraft/test/{ => docraft}/craft/docraft_settings_parser_test.cc (97%) rename docraft/test/{ => docraft}/craft/docraft_shape_parser_test.cc (88%) rename docraft/test/{ => docraft}/craft/docraft_table_parser_test.cc (98%) rename docraft/test/{ => docraft}/docraft_color_test.cc (96%) rename docraft/test/{ => docraft}/docraft_document_test.cc (98%) rename docraft/test/{ => docraft}/generic/docraft_font_applier_test.cc (92%) rename docraft/test/{ => docraft}/layout/docraft_cursor_test.cc (96%) rename docraft/test/{ => docraft}/layout/docraft_layout_engine_test.cc (98%) rename docraft/test/{ => docraft}/layout/docraft_layout_text_handler_test.cc (96%) rename docraft/test/{ => docraft}/layout/docraft_pagination_test.cc (91%) rename docraft/test/{ => docraft}/main.cpp (100%) rename docraft/test/{ => docraft}/model/docraft_clone_test.cc (97%) rename docraft/test/{ => docraft}/model/docraft_list_test.cc (96%) rename docraft/test/{ => docraft}/model/docraft_node_test.cc (91%) rename docraft/test/{ => docraft}/model/docraft_position_test.cc (97%) rename docraft/test/{ => docraft}/model/docraft_settings_test.cc (97%) rename docraft/test/{ => docraft}/model/docraft_z_index_test.cc (97%) rename docraft/test/{ => docraft}/renderer/docraft_image_painter_test.cc (86%) rename docraft/test/{ => docraft}/renderer/docraft_painter_smoke_test.cc (82%) rename docraft/test/{ => docraft}/renderer/docraft_section_margin_test.cc (81%) rename docraft/test/{ => docraft}/templating/docraft_template_engine_test.cc (96%) rename docraft/test/{ => docraft}/utils/docraft_keyword_extractor_test.cc (94%) rename docraft/test/{ => docraft}/utils/docraft_logger_test.cc (98%) rename docraft/test/{ => docraft}/utils/docraft_mock_rendering_backend.h (99%) rename docraft/test/{ => docraft}/utils/docraft_parser_utils.cc (98%) diff --git a/.cmake/font_header_init.cmake b/.cmake/font_header_init.cmake index cfa9726..fa2860d 100644 --- a/.cmake/font_header_init.cmake +++ b/.cmake/font_header_init.cmake @@ -4,5 +4,5 @@ endif() file(WRITE "${OUTPUT_FILE}" "/* Auto-generated fonts header */\n") file(APPEND "${OUTPUT_FILE}" "#pragma once\n") -file(APPEND "${OUTPUT_FILE}" "#include \"utils/docraft_font_registry.h\"\n\n") +file(APPEND "${OUTPUT_FILE}" "#include \"docraft/utils/docraft_font_registry.h\"\n\n") file(APPEND "${OUTPUT_FILE}" "void docraft_register_fonts() {}\n\n") \ No newline at end of file diff --git a/.cmake/generate_fonts.cmake b/.cmake/generate_fonts.cmake index bb31b6c..dd41706 100644 --- a/.cmake/generate_fonts.cmake +++ b/.cmake/generate_fonts.cmake @@ -134,8 +134,7 @@ function(generate_docraft_fonts artifact json_config_path) target_include_directories( "${artifact}" PUBLIC - "${CMAKE_CURRENT_BINARY_DIR}" + $ ) endfunction() - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index e77c679..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,123 +0,0 @@ -name: Release - -on: - push: - tags: - - 'v*' - - 'release/*' - -jobs: - create-release: - runs-on: ubuntu-latest - name: Create Release - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Get version from tag - id: tag_name - run: | - echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT - - - name: Create Release Notes - id: release_notes - run: | - { - echo "## Release ${{ steps.tag_name.outputs.version }}" - echo "" - echo "### Changes" - echo "" - echo "See [commit log](https://github.com/${{ github.repository }}/commits/${{ github.ref }})" - } > release_notes.md - cat release_notes.md - - - name: Create GitHub Release - uses: softprops/action-gh-release@v1 - with: - body_path: release_notes.project-doc - draft: false - prerelease: false - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - build-release-artifacts: - needs: create-release - strategy: - matrix: - include: - - os: ubuntu-latest - name: linux-x64 - artifact-name: docraft_tool-linux-x64 - - - os: macos-latest - name: macos-x64 - artifact-name: docraft_tool-macos-x64 - - - os: windows-latest - name: windows-x64 - artifact-name: docraft_tool-windows-x64.exe - - runs-on: ${{ matrix.os }} - name: Build Release - ${{ matrix.name }} - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install dependencies (Linux) - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y cmake ninja-build g++-14 \ - libhpdf-dev libpugixml-dev nlohmann-json3-dev libgtest-dev - - - name: Install dependencies (macOS) - if: runner.os == 'macOS' - run: | - brew install cmake ninja libharu pugixml nlohmann-json googletest - - - name: Install dependencies (Windows) - if: runner.os == 'Windows' - run: | - git clone https://github.com/microsoft/vcpkg.git - cd vcpkg - .\bootstrap-vcpkg.bat - .\vcpkg integrate install - cd .. - .\vcpkg\vcpkg install --triplet=x64-windows - - - name: Configure CMake (Linux/macOS) - if: runner.os != 'Windows' - run: | - cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF - - - name: Configure CMake (Windows) - if: runner.os == 'Windows' - run: | - cmake -S . -B build ` - -G "Visual Studio 17 2022" ` - -DCMAKE_BUILD_TYPE=Release ` - -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" ` - -DVCPKG_TARGET_TRIPLET=x64-windows ` - -DBUILD_TESTS=OFF - - - name: Build - run: | - cmake --build build --config Release -j - - - name: Prepare artifacts - run: | - mkdir -p release-artifacts - cp build/artifacts/bin/* release-artifacts/ || true - ls -la release-artifacts/ - - - name: Upload Release Assets - uses: softprops/action-gh-release@v1 - with: - files: release-artifacts/* - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - diff --git a/CMakeLists.txt b/CMakeLists.txt index 6effc1a..020ea66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,10 @@ if(DOCRAFT_LIBRARY_SOVERSION STREQUAL "") endif() # Project name and compiler -project(Docraft VERSION ${DOCRAFT_LIBRARY_VERSION} LANGUAGES CXX) +project(docraft VERSION ${DOCRAFT_LIBRARY_VERSION} LANGUAGES CXX) + +include(GNUInstallDirs) +include(CMakePackageConfigHelpers) # Set C++ standard (change if you need another version) set(CMAKE_CXX_STANDARD 23) @@ -54,9 +57,30 @@ else() endif() endif() +set(DOCRAFT_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/docraft") + #artifacts add_subdirectory(docraft) #configure docraft artifact +configure_package_config_file( + "${CMAKE_CURRENT_LIST_DIR}/cmake/DocraftConfig.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/docraftConfig.cmake" + INSTALL_DESTINATION "${DOCRAFT_INSTALL_CMAKEDIR}" +) + +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/docraftConfigVersion.cmake" + VERSION "${PROJECT_VERSION}" + COMPATIBILITY SameMajorVersion +) + +install( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/docraftConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/docraftConfigVersion.cmake" + DESTINATION "${DOCRAFT_INSTALL_CMAKEDIR}" +) + #test include(CTest) if(BUILD_TESTS) diff --git a/cmake/DocraftConfig.cmake.in b/cmake/DocraftConfig.cmake.in new file mode 100644 index 0000000..f0efed4 --- /dev/null +++ b/cmake/DocraftConfig.cmake.in @@ -0,0 +1,40 @@ +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) + +find_dependency(nlohmann_json CONFIG REQUIRED) +find_dependency(pugixml CONFIG REQUIRED) + +if(TARGET pugixml::pugixml AND NOT TARGET pugixml::static) + add_library(pugixml::static INTERFACE IMPORTED) + set_property(TARGET pugixml::static PROPERTY INTERFACE_LINK_LIBRARIES pugixml::pugixml) +elseif(TARGET pugixml::static AND NOT TARGET pugixml::pugixml) + add_library(pugixml::pugixml INTERFACE IMPORTED) + set_property(TARGET pugixml::pugixml PROPERTY INTERFACE_LINK_LIBRARIES pugixml::static) +endif() + +find_package(unofficial-libharu QUIET CONFIG) + +if(TARGET unofficial::libharu::hpdf AND NOT TARGET libharu) + add_library(libharu INTERFACE IMPORTED) + set_property(TARGET libharu PROPERTY INTERFACE_LINK_LIBRARIES unofficial::libharu::hpdf) +elseif(NOT TARGET unofficial::libharu::hpdf) + find_library(DOCRAFT_LIBHARU_LIBRARY NAMES hpdf libhpdf) + find_path(DOCRAFT_LIBHARU_INCLUDE_DIR NAMES hpdf.h) + + if(DOCRAFT_LIBHARU_LIBRARY AND DOCRAFT_LIBHARU_INCLUDE_DIR) + add_library(libharu UNKNOWN IMPORTED) + set_target_properties(libharu PROPERTIES + IMPORTED_LOCATION "${DOCRAFT_LIBHARU_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${DOCRAFT_LIBHARU_INCLUDE_DIR}" + ) + + add_library(unofficial::libharu::hpdf INTERFACE IMPORTED) + set_property(TARGET unofficial::libharu::hpdf PROPERTY INTERFACE_LINK_LIBRARIES libharu) + else() + message(FATAL_ERROR "docraft requires libharu (target unofficial::libharu::hpdf or library hpdf).") + endif() +endif() + +include("${CMAKE_CURRENT_LIST_DIR}/docraftTargets.cmake") +check_required_components(docraft) diff --git a/doc/project-doc/contributors/components/backend-integration.md b/doc/project-doc/contributors/components/backend-integration.md index 3c732ee..72ffd06 100644 --- a/doc/project-doc/contributors/components/backend-integration.md +++ b/doc/project-doc/contributors/components/backend-integration.md @@ -41,7 +41,7 @@ For libraries/projects outside the Docraft repo, the supported high-level path i Example: ```cpp -#include "craft/docraft_craft_language_parser.h" +#include "docraft/craft/docraft_craft_language_parser.h" #include "my_backend/my_rendering_backend.h" void render_with_external_backend(const std::string &craft_path) { diff --git a/doc/project-doc/craft-language.md b/doc/project-doc/craft-language.md index 68c6629..a8377de 100644 --- a/doc/project-doc/craft-language.md +++ b/doc/project-doc/craft-language.md @@ -211,7 +211,7 @@ Example: ```cpp #include "docraft_document.h" -#include "model/docraft_text.h" +#include "docraft/model/docraft_text.h" docraft::DocraftDocument doc("Q1 Report"); doc.add_node(std::make_shared( diff --git a/doc/project-doc/users/craft-language.md b/doc/project-doc/users/craft-language.md index a55d9f0..8dd9a45 100644 --- a/doc/project-doc/users/craft-language.md +++ b/doc/project-doc/users/craft-language.md @@ -23,7 +23,7 @@ To render a `.craft` file, your application must use: Minimal usage: ```cpp -#include "craft/docraft_craft_language_parser.h" +#include "docraft/craft/docraft_craft_language_parser.h" int main() { docraft::craft::DocraftCraftLanguageParser parser; @@ -149,7 +149,7 @@ Example `.craft` snippet: C++ data binding example: ```cpp -#include "templating/docraft_template_engine.h" +#include "docraft/templating/docraft_template_engine.h" auto engine = std::make_shared(); engine->add_template_variable("invoice_number", "INV-2026-0008"); @@ -202,7 +202,7 @@ document->set_document_metadata(metadata); ### 5.3 Auto-keyword extraction from C++ ```cpp -#include "utils/docraft_keyword_extractor.h" +#include "docraft/utils/docraft_keyword_extractor.h" docraft::utils::DocraftKeywordExtractor::Config config; config.max_keywords = 10; diff --git a/doc/source/getting_started.rst b/doc/source/getting_started.rst index d5b8f34..0df7059 100644 --- a/doc/source/getting_started.rst +++ b/doc/source/getting_started.rst @@ -38,8 +38,8 @@ Build a document entirely from C++ without any ``.craft`` file: .. code-block:: cpp #include "docraft_document.h" - #include "model/docraft_text.h" - #include "model/docraft_body.h" + #include "docraft/model/docraft_text.h" + #include "docraft/model/docraft_body.h" int main() { // 1. Create a document @@ -92,7 +92,7 @@ Parse and render it from C++: .. code-block:: cpp - #include "craft/docraft_craft_language_parser.h" + #include "docraft/craft/docraft_craft_language_parser.h" int main() { docraft::craft::DocraftCraftLanguageParser parser; @@ -118,8 +118,8 @@ Inject runtime data into a ``.craft`` template: .. code-block:: cpp - #include "craft/docraft_craft_language_parser.h" - #include "templating/docraft_template_engine.h" + #include "docraft/craft/docraft_craft_language_parser.h" + #include "docraft/templating/docraft_template_engine.h" int main() { docraft::craft::DocraftCraftLanguageParser parser; @@ -187,7 +187,7 @@ Register external TTF fonts at runtime: .. code-block:: cpp - #include "utils/docraft_font_registry.h" + #include "docraft/utils/docraft_font_registry.h" auto& registry = docraft::utils::DocraftFontRegistry::instance(); registry.register_font("MyFont", "fonts/MyFont-Regular.ttf"); diff --git a/docraft/CMakeLists.txt b/docraft/CMakeLists.txt index fb81a6e..77027dd 100644 --- a/docraft/CMakeLists.txt +++ b/docraft/CMakeLists.txt @@ -1,154 +1,154 @@ include(${CMAKE_CURRENT_LIST_DIR}/../.cmake/generate_fonts.cmake) set(DOCRAFT_SOURCES - src/model/docraft_node.cc - include/model/docraft_node.h - src/model/docraft_clone_utils.cc - include/model/docraft_clone_utils.h - include/model/i_docraft_clonable.h - src/model/docraft_section.cc - include/model/docraft_section.h - src/model/docraft_body.cc - include/model/docraft_body.h - src/model/docraft_text.cc - include/model/docraft_text.h - src/model/docraft_page_number.cc - include/model/docraft_page_number.h - src/model/docraft_new_page.cc - include/model/docraft_new_page.h - src/docraft_document.cc - include/docraft_document.h - src/docraft_document_context.cc - include/docraft_document_context.h - src/docraft_cursor.cc - include/docraft_cursor.h - src/docraft_color.cc - include/docraft_color.h - include/renderer/docraft_renderer.h - src/renderer/docraft_pdf_renderer.cc - include/renderer/docraft_pdf_renderer.h - src/renderer/painter/docraft_text_painter.cc - include/renderer/painter/docraft_text_painter.h - include/renderer/painter/i_painter.h - src/layout/docraft_layout_engine.cc - include/layout/docraft_layout_engine.h - src/layout/handler/docraft_layout_text_handler.cc - include/layout/handler/docraft_layout_text_handler.h - include/generic/chain_of_responsibility_handler.h - include/layout/handler/abstract_docraft_layout_handler.h - src/generic/docraft_font_applier.cc - include/generic/docraft_font_applier.h - src/model/docraft_header.cc - include/model/docraft_header.h - src/model/docraft_paragraph.cc - include/model/docraft_paragraph.h - src/model/docraft_layout.cc - include/model/docraft_layout.h - src/model/docraft_list.cc - include/model/docraft_list.h - src/layout/handler/docraft_layout_handler.cc - include/layout/handler/docraft_layout_handler.h - src/layout/handler/docraft_layout_list_handler.cc - include/layout/handler/docraft_layout_list_handler.h - src/model/docraft_children_container_node.cc - include/model/docraft_children_container_node.h - include/backend/docraft_pdf_backend.h - include/backend/docraft_text_rendering_backend.h - include/backend/docraft_line_rendering_backend.h - include/backend/docraft_shape_rendering_backend.h - include/backend/docraft_image_rendering_backend.h - include/backend/docraft_page_rendering_backend.h - include/backend/docraft_rendering_backend.h - src/model/docraft_image.cc - include/model/docraft_image.h - src/renderer/painter/docraft_image_painter.cc - include/renderer/painter/docraft_image_painter.h - src/layout/handler/docraft_basic_layout_handler.cc - include/layout/handler/docraft_basic_layout_handler.h - src/model/docraft_footer.cc - include/model/docraft_footer.h - src/model/docraft_table.cc - include/model/docraft_table.h - src/renderer/painter/docraft_table_painter.cc - include/renderer/painter/docraft_table_painter.h - src/layout/handler/docraft_layout_table_handler.cc - include/layout/handler/docraft_layout_table_handler.h - include/utils/docraft_font_registry.h - src/model/docraft_rectangle.cc - include/model/docraft_rectangle.h - src/model/docraft_circle.cc - include/model/docraft_circle.h - src/model/docraft_triangle.cc - include/model/docraft_triangle.h - src/model/docraft_line.cc - include/model/docraft_line.h - src/model/docraft_polygon.cc - include/model/docraft_polygon.h - src/renderer/painter/docraft_rectangle_painter.cc - include/renderer/painter/docraft_rectangle_painter.h - src/renderer/painter/docraft_circle_painter.cc - include/renderer/painter/docraft_circle_painter.h - src/renderer/painter/docraft_triangle_painter.cc - include/renderer/painter/docraft_triangle_painter.h - src/renderer/painter/docraft_line_painter.cc - include/renderer/painter/docraft_line_painter.h - src/renderer/painter/docraft_polygon_painter.cc - include/renderer/painter/docraft_polygon_painter.h - src/model/docraft_blank_line.cc - include/model/docraft_blank_line.h - src/layout/handler/docraft_layout_blank_line.cc - include/layout/handler/docraft_layout_blank_line.h - src/renderer/painter/docraft_blank_line_painter.cc - include/renderer/painter/docraft_blank_line_painter.h - src/craft/docraft_craft_language_parser.cc - include/craft/docraft_craft_language_parser.h - include/craft/i_docraft_parser.h - src/craft/parser/docraft_parser_helpers.cc - src/craft/parser/docraft_rectangle_parser.cc - src/craft/parser/docraft_section_parsers.cc - src/craft/parser/docraft_text_parser.cc - src/craft/parser/docraft_page_number_parser.cc - src/craft/parser/docraft_image_parser.cc - src/craft/parser/docraft_table_parser.cc - src/craft/parser/docraft_layout_parser.cc - src/craft/parser/docraft_list_parser.cc - src/craft/parser/docraft_blank_line_parser.cc - src/craft/parser/docraft_new_page_parser.cc - src/craft/parser/docraft_circle_parser.cc - src/craft/parser/docraft_triangle_parser.cc - src/craft/parser/docraft_line_parser.cc - src/craft/parser/docraft_polygon_parser.cc - src/craft/parser/docraft_shape_parser_utils.cc - src/craft/parser/docraft_settings_parser.cc - include/craft/parser/docraft_parser.h - include/craft/parser/docraft_circle_parser.h - include/craft/parser/docraft_triangle_parser.h - include/craft/parser/docraft_line_parser.h - include/craft/parser/docraft_polygon_parser.h - include/craft/parser/docraft_shape_parser_utils.h - include/craft/docraft_craft_language_tokens.h - src/utils/docraft_logger.cc - src/utils/docraft_base64.cc - src/utils/docraft_font_resolver.cc - src/utils/docraft_keyword_extractor.cc - src/utils/docraft_font_registry.cc - src/utils/docraft_parser_utilis.cc - include/utils/docraft_logger.h - include/utils/docraft_base64.h - include/utils/docraft_keyword_extractor.h - include/utils/docraft_parser_utilis.h - include/model/docraft_position.h - src/model/docraft_position.cc - src/backend/pdf/docraft_haru_backend.cc - include/backend/pdf/docraft_haru_backend.h - src/model/docraft_settings.cc - include/model/docraft_settings.h - include/model/docraft_page_format.h - src/templating/docraft_template_engine.cc - include/templating/docraft_template_engine.h - src/model/docraft_foreach.cc - include/model/docraft_foreach.h - src/craft/parser/docraft_foreach_parser.cc + src/docraft/model/docraft_node.cc + include/docraft/model/docraft_node.h + src/docraft/model/docraft_clone_utils.cc + include/docraft/model/docraft_clone_utils.h + include/docraft/model/i_docraft_clonable.h + src/docraft/model/docraft_section.cc + include/docraft/model/docraft_section.h + src/docraft/model/docraft_body.cc + include/docraft/model/docraft_body.h + src/docraft/model/docraft_text.cc + include/docraft/model/docraft_text.h + src/docraft/model/docraft_page_number.cc + include/docraft/model/docraft_page_number.h + src/docraft/model/docraft_new_page.cc + include/docraft/model/docraft_new_page.h + src/docraft/docraft_document.cc + include/docraft/docraft_document.h + src/docraft/docraft_document_context.cc + include/docraft/docraft_document_context.h + src/docraft/docraft_cursor.cc + include/docraft/docraft_cursor.h + src/docraft/docraft_color.cc + include/docraft/docraft_color.h + include/docraft/renderer/docraft_renderer.h + src/docraft/renderer/docraft_pdf_renderer.cc + include/docraft/renderer/docraft_pdf_renderer.h + src/docraft/renderer/painter/docraft_text_painter.cc + include/docraft/renderer/painter/docraft_text_painter.h + include/docraft/renderer/painter/i_painter.h + src/docraft/layout/docraft_layout_engine.cc + include/docraft/layout/docraft_layout_engine.h + src/docraft/layout/handler/docraft_layout_text_handler.cc + include/docraft/layout/handler/docraft_layout_text_handler.h + include/docraft/generic/chain_of_responsibility_handler.h + include/docraft/layout/handler/abstract_docraft_layout_handler.h + src/docraft/generic/docraft_font_applier.cc + include/docraft/generic/docraft_font_applier.h + src/docraft/model/docraft_header.cc + include/docraft/model/docraft_header.h + src/docraft/model/docraft_paragraph.cc + include/docraft/model/docraft_paragraph.h + src/docraft/model/docraft_layout.cc + include/docraft/model/docraft_layout.h + src/docraft/model/docraft_list.cc + include/docraft/model/docraft_list.h + src/docraft/layout/handler/docraft_layout_handler.cc + include/docraft/layout/handler/docraft_layout_handler.h + src/docraft/layout/handler/docraft_layout_list_handler.cc + include/docraft/layout/handler/docraft_layout_list_handler.h + src/docraft/model/docraft_children_container_node.cc + include/docraft/model/docraft_children_container_node.h + include/docraft/backend/docraft_pdf_backend.h + include/docraft/backend/docraft_text_rendering_backend.h + include/docraft/backend/docraft_line_rendering_backend.h + include/docraft/backend/docraft_shape_rendering_backend.h + include/docraft/backend/docraft_image_rendering_backend.h + include/docraft/backend/docraft_page_rendering_backend.h + include/docraft/backend/docraft_rendering_backend.h + src/docraft/model/docraft_image.cc + include/docraft/model/docraft_image.h + src/docraft/renderer/painter/docraft_image_painter.cc + include/docraft/renderer/painter/docraft_image_painter.h + src/docraft/layout/handler/docraft_basic_layout_handler.cc + include/docraft/layout/handler/docraft_basic_layout_handler.h + src/docraft/model/docraft_footer.cc + include/docraft/model/docraft_footer.h + src/docraft/model/docraft_table.cc + include/docraft/model/docraft_table.h + src/docraft/renderer/painter/docraft_table_painter.cc + include/docraft/renderer/painter/docraft_table_painter.h + src/docraft/layout/handler/docraft_layout_table_handler.cc + include/docraft/layout/handler/docraft_layout_table_handler.h + include/docraft/utils/docraft_font_registry.h + src/docraft/model/docraft_rectangle.cc + include/docraft/model/docraft_rectangle.h + src/docraft/model/docraft_circle.cc + include/docraft/model/docraft_circle.h + src/docraft/model/docraft_triangle.cc + include/docraft/model/docraft_triangle.h + src/docraft/model/docraft_line.cc + include/docraft/model/docraft_line.h + src/docraft/model/docraft_polygon.cc + include/docraft/model/docraft_polygon.h + src/docraft/renderer/painter/docraft_rectangle_painter.cc + include/docraft/renderer/painter/docraft_rectangle_painter.h + src/docraft/renderer/painter/docraft_circle_painter.cc + include/docraft/renderer/painter/docraft_circle_painter.h + src/docraft/renderer/painter/docraft_triangle_painter.cc + include/docraft/renderer/painter/docraft_triangle_painter.h + src/docraft/renderer/painter/docraft_line_painter.cc + include/docraft/renderer/painter/docraft_line_painter.h + src/docraft/renderer/painter/docraft_polygon_painter.cc + include/docraft/renderer/painter/docraft_polygon_painter.h + src/docraft/model/docraft_blank_line.cc + include/docraft/model/docraft_blank_line.h + src/docraft/layout/handler/docraft_layout_blank_line.cc + include/docraft/layout/handler/docraft_layout_blank_line.h + src/docraft/renderer/painter/docraft_blank_line_painter.cc + include/docraft/renderer/painter/docraft_blank_line_painter.h + src/docraft/craft/docraft_craft_language_parser.cc + include/docraft/craft/docraft_craft_language_parser.h + include/docraft/craft/i_docraft_parser.h + src/docraft/craft/parser/docraft_parser_helpers.cc + src/docraft/craft/parser/docraft_rectangle_parser.cc + src/docraft/craft/parser/docraft_section_parsers.cc + src/docraft/craft/parser/docraft_text_parser.cc + src/docraft/craft/parser/docraft_page_number_parser.cc + src/docraft/craft/parser/docraft_image_parser.cc + src/docraft/craft/parser/docraft_table_parser.cc + src/docraft/craft/parser/docraft_layout_parser.cc + src/docraft/craft/parser/docraft_list_parser.cc + src/docraft/craft/parser/docraft_blank_line_parser.cc + src/docraft/craft/parser/docraft_new_page_parser.cc + src/docraft/craft/parser/docraft_circle_parser.cc + src/docraft/craft/parser/docraft_triangle_parser.cc + src/docraft/craft/parser/docraft_line_parser.cc + src/docraft/craft/parser/docraft_polygon_parser.cc + src/docraft/craft/parser/docraft_shape_parser_utils.cc + src/docraft/craft/parser/docraft_settings_parser.cc + include/docraft/craft/parser/docraft_parser.h + include/docraft/craft/parser/docraft_circle_parser.h + include/docraft/craft/parser/docraft_triangle_parser.h + include/docraft/craft/parser/docraft_line_parser.h + include/docraft/craft/parser/docraft_polygon_parser.h + include/docraft/craft/parser/docraft_shape_parser_utils.h + include/docraft/craft/docraft_craft_language_tokens.h + src/docraft/utils/docraft_logger.cc + src/docraft/utils/docraft_base64.cc + src/docraft/utils/docraft_font_resolver.cc + src/docraft/utils/docraft_keyword_extractor.cc + src/docraft/utils/docraft_font_registry.cc + src/docraft/utils/docraft_parser_utilis.cc + include/docraft/utils/docraft_logger.h + include/docraft/utils/docraft_base64.h + include/docraft/utils/docraft_keyword_extractor.h + include/docraft/utils/docraft_parser_utilis.h + include/docraft/model/docraft_position.h + src/docraft/model/docraft_position.cc + src/docraft/backend/pdf/docraft_haru_backend.cc + include/docraft/backend/pdf/docraft_haru_backend.h + src/docraft/model/docraft_settings.cc + include/docraft/model/docraft_settings.h + include/docraft/model/docraft_page_format.h + src/docraft/templating/docraft_template_engine.cc + include/docraft/templating/docraft_template_engine.h + src/docraft/model/docraft_foreach.cc + include/docraft/model/docraft_foreach.h + src/docraft/craft/parser/docraft_foreach_parser.cc ) set(DOCRAFT_LIBRARY_TYPE STATIC) if(BUILD_SHARED_LIB) @@ -157,6 +157,7 @@ endif() add_library(docraft ${DOCRAFT_LIBRARY_TYPE} ${DOCRAFT_SOURCES} ) +add_library(docraft::docraft ALIAS docraft) configure_artifact_version(docraft ${PROJECT_VERSION}) configure_artifact_soversion(docraft ${PROJECT_VERSION_MAJOR}) @@ -172,7 +173,7 @@ if(BUILD_SHARED_LIB) endif() generate_docraft_fonts(docraft "${CMAKE_CURRENT_SOURCE_DIR}/fonts.json") -add_executable(docraft_tool src/main.cpp) +add_executable(docraft_tool src/docraft/main.cpp) #declare define in the c++ code to export version target_compile_definitions(docraft_tool PRIVATE DOCRAFT_VERSION="${DOCRAFT_LIBRARY_VERSION}") configure_artifact_version(docraft_tool ${PROJECT_VERSION}) @@ -186,21 +187,31 @@ endif() target_link_libraries(docraft PUBLIC ${PUGIXML_TARGET} nlohmann_json::nlohmann_json ${LIBHARU_TARGET}) target_link_libraries(docraft_tool PRIVATE docraft) -target_include_directories(docraft PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) -target_include_directories(docraft PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include) +target_include_directories(docraft + PUBLIC + $#include dir for the build tree (for generated headers) + $#include dir for the build tree + $#include dir for the install tree +) #install rules install(TARGETS docraft EXPORT docraftTargets - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin - INCLUDES DESTINATION include + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) install(TARGETS docraft_tool - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) +install( + EXPORT docraftTargets + FILE docraftTargets.cmake + NAMESPACE docraft:: + DESTINATION "${DOCRAFT_INSTALL_CMAKEDIR}" ) -install(DIRECTORY include/ DESTINATION include) \ No newline at end of file +install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/docraft/include/craft/parser/docraft_circle_parser.h b/docraft/include/craft/parser/docraft_circle_parser.h deleted file mode 100644 index a69ae42..0000000 --- a/docraft/include/craft/parser/docraft_circle_parser.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "docraft_lib.h" - -#include "craft/i_docraft_parser.h" - -namespace docraft::craft::parser { - /** - * @brief Parser for circle nodes. - */ - class DOCRAFT_LIB DocraftCircleParser : public IDocraftParser { - public: - /** - * @brief Parses a circle XML node. - * @param craft_language_source XML node. - * @return Parsed circle node. - */ - std::shared_ptr parse(const pugi::xml_node &craft_language_source) override; - }; -} // docraft::craft::parser diff --git a/docraft/include/craft/parser/docraft_line_parser.h b/docraft/include/craft/parser/docraft_line_parser.h deleted file mode 100644 index c75c520..0000000 --- a/docraft/include/craft/parser/docraft_line_parser.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "docraft_lib.h" - -#include "craft/i_docraft_parser.h" - -namespace docraft::craft::parser { - /** - * @brief Parser for line nodes. - */ - class DOCRAFT_LIB DocraftLineParser : public IDocraftParser { - public: - /** - * @brief Parses a line XML node. - * @param craft_language_source XML node. - * @return Parsed line node. - */ - std::shared_ptr parse(const pugi::xml_node &craft_language_source) override; - }; -} // docraft::craft::parser diff --git a/docraft/include/craft/parser/docraft_polygon_parser.h b/docraft/include/craft/parser/docraft_polygon_parser.h deleted file mode 100644 index b87d973..0000000 --- a/docraft/include/craft/parser/docraft_polygon_parser.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "docraft_lib.h" - -#include "craft/i_docraft_parser.h" - -namespace docraft::craft::parser { - /** - * @brief Parser for polygon nodes. - */ - class DOCRAFT_LIB DocraftPolygonParser : public IDocraftParser { - public: - /** - * @brief Parses a polygon XML node. - * @param craft_language_source XML node. - * @return Parsed polygon node. - */ - std::shared_ptr parse(const pugi::xml_node &craft_language_source) override; - }; -} // docraft::craft::parser diff --git a/docraft/include/craft/parser/docraft_shape_parser_utils.h b/docraft/include/craft/parser/docraft_shape_parser_utils.h deleted file mode 100644 index 5dbdea4..0000000 --- a/docraft/include/craft/parser/docraft_shape_parser_utils.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "model/docraft_position.h" - -namespace docraft::craft::parser::detail { - std::vector parse_points_attribute(const pugi::xml_node &node, const char *attr_name); -} diff --git a/docraft/include/craft/parser/docraft_triangle_parser.h b/docraft/include/craft/parser/docraft_triangle_parser.h deleted file mode 100644 index c92fd9f..0000000 --- a/docraft/include/craft/parser/docraft_triangle_parser.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "docraft_lib.h" - -#include "craft/i_docraft_parser.h" - -namespace docraft::craft::parser { - /** - * @brief Parser for triangle nodes. - */ - class DOCRAFT_LIB DocraftTriangleParser : public IDocraftParser { - public: - /** - * @brief Parses a triangle XML node. - * @param craft_language_source XML node. - * @return Parsed triangle node. - */ - std::shared_ptr parse(const pugi::xml_node &craft_language_source) override; - }; -} // docraft::craft::parser diff --git a/docraft/include/.gitkeep b/docraft/include/docraft/.gitkeep similarity index 100% rename from docraft/include/.gitkeep rename to docraft/include/docraft/.gitkeep diff --git a/docraft/include/backend/docraft_image_rendering_backend.h b/docraft/include/docraft/backend/docraft_image_rendering_backend.h similarity index 76% rename from docraft/include/backend/docraft_image_rendering_backend.h rename to docraft/include/docraft/backend/docraft_image_rendering_backend.h index dc9cdf1..9006d1b 100644 --- a/docraft/include/backend/docraft_image_rendering_backend.h +++ b/docraft/include/docraft/backend/docraft_image_rendering_backend.h @@ -1,6 +1,22 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include #include diff --git a/docraft/include/backend/docraft_line_rendering_backend.h b/docraft/include/docraft/backend/docraft_line_rendering_backend.h similarity index 65% rename from docraft/include/backend/docraft_line_rendering_backend.h rename to docraft/include/docraft/backend/docraft_line_rendering_backend.h index 28d34c4..96173b3 100644 --- a/docraft/include/backend/docraft_line_rendering_backend.h +++ b/docraft/include/docraft/backend/docraft_line_rendering_backend.h @@ -1,6 +1,22 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" namespace docraft::backend { /** diff --git a/docraft/include/backend/docraft_page_rendering_backend.h b/docraft/include/docraft/backend/docraft_page_rendering_backend.h similarity index 75% rename from docraft/include/backend/docraft_page_rendering_backend.h rename to docraft/include/docraft/backend/docraft_page_rendering_backend.h index db666a8..90962e3 100644 --- a/docraft/include/backend/docraft_page_rendering_backend.h +++ b/docraft/include/docraft/backend/docraft_page_rendering_backend.h @@ -1,9 +1,25 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include -#include "model/docraft_page_format.h" +#include "docraft/model/docraft_page_format.h" namespace docraft::backend { /** diff --git a/docraft/include/backend/docraft_pdf_backend.h b/docraft/include/docraft/backend/docraft_pdf_backend.h similarity index 52% rename from docraft/include/backend/docraft_pdf_backend.h rename to docraft/include/docraft/backend/docraft_pdf_backend.h index a83278b..66f38fb 100644 --- a/docraft/include/backend/docraft_pdf_backend.h +++ b/docraft/include/docraft/backend/docraft_pdf_backend.h @@ -1,6 +1,22 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include namespace docraft::backend { diff --git a/docraft/include/backend/docraft_rendering_backend.h b/docraft/include/docraft/backend/docraft_rendering_backend.h similarity index 72% rename from docraft/include/backend/docraft_rendering_backend.h rename to docraft/include/docraft/backend/docraft_rendering_backend.h index cc3087f..87ae6e4 100644 --- a/docraft/include/backend/docraft_rendering_backend.h +++ b/docraft/include/docraft/backend/docraft_rendering_backend.h @@ -1,12 +1,28 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include -#include "backend/docraft_image_rendering_backend.h" -#include "backend/docraft_page_rendering_backend.h" -#include "backend/docraft_shape_rendering_backend.h" -#include "backend/docraft_text_rendering_backend.h" +#include "docraft/backend/docraft_image_rendering_backend.h" +#include "docraft/backend/docraft_page_rendering_backend.h" +#include "docraft/backend/docraft_shape_rendering_backend.h" +#include "docraft/backend/docraft_text_rendering_backend.h" namespace docraft { class DocraftDocumentMetadata; diff --git a/docraft/include/backend/docraft_shape_rendering_backend.h b/docraft/include/docraft/backend/docraft_shape_rendering_backend.h similarity index 77% rename from docraft/include/backend/docraft_shape_rendering_backend.h rename to docraft/include/docraft/backend/docraft_shape_rendering_backend.h index 25abe05..a0179cd 100644 --- a/docraft/include/backend/docraft_shape_rendering_backend.h +++ b/docraft/include/docraft/backend/docraft_shape_rendering_backend.h @@ -1,11 +1,27 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include -#include "backend/docraft_line_rendering_backend.h" -#include "model/docraft_position.h" +#include "docraft/backend/docraft_line_rendering_backend.h" +#include "docraft/model/docraft_position.h" namespace docraft::backend { /** diff --git a/docraft/include/backend/docraft_text_rendering_backend.h b/docraft/include/docraft/backend/docraft_text_rendering_backend.h similarity index 78% rename from docraft/include/backend/docraft_text_rendering_backend.h rename to docraft/include/docraft/backend/docraft_text_rendering_backend.h index c49cb4c..3266440 100644 --- a/docraft/include/backend/docraft_text_rendering_backend.h +++ b/docraft/include/docraft/backend/docraft_text_rendering_backend.h @@ -1,9 +1,25 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include -#include "backend/docraft_line_rendering_backend.h" +#include "docraft/backend/docraft_line_rendering_backend.h" namespace docraft::backend { /** diff --git a/docraft/include/backend/pdf/docraft_haru_backend.h b/docraft/include/docraft/backend/pdf/docraft_haru_backend.h similarity index 90% rename from docraft/include/backend/pdf/docraft_haru_backend.h rename to docraft/include/docraft/backend/pdf/docraft_haru_backend.h index 68d9ab5..5dcd9a3 100644 --- a/docraft/include/backend/pdf/docraft_haru_backend.h +++ b/docraft/include/docraft/backend/pdf/docraft_haru_backend.h @@ -1,14 +1,29 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include #include #include #include -#include "backend/docraft_rendering_backend.h" -#include "docraft_document_metadata.h" -#include "model/docraft_position.h" +#include "docraft/backend/docraft_rendering_backend.h" +#include "docraft/model/docraft_position.h" namespace docraft::backend::pdf { /** diff --git a/docraft/include/craft/docraft_craft_language_parser.h b/docraft/include/docraft/craft/docraft_craft_language_parser.h similarity index 77% rename from docraft/include/craft/docraft_craft_language_parser.h rename to docraft/include/docraft/craft/docraft_craft_language_parser.h index 407913f..ece521c 100644 --- a/docraft/include/craft/docraft_craft_language_parser.h +++ b/docraft/include/docraft/craft/docraft_craft_language_parser.h @@ -1,11 +1,27 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include #include -#include "docraft_document.h" -#include "i_docraft_parser.h" +#include "docraft/docraft_document.h" +#include "docraft/craft/i_docraft_parser.h" #include #include diff --git a/docraft/include/craft/docraft_craft_language_tokens.h b/docraft/include/docraft/craft/docraft_craft_language_tokens.h similarity index 94% rename from docraft/include/craft/docraft_craft_language_tokens.h rename to docraft/include/docraft/craft/docraft_craft_language_tokens.h index 2ed3020..7eb172e 100644 --- a/docraft/include/craft/docraft_craft_language_tokens.h +++ b/docraft/include/docraft/craft/docraft_craft_language_tokens.h @@ -1,3 +1,19 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include using string = std::string_view; @@ -63,7 +79,7 @@ namespace docraft::craft { constexpr string kSubtitle = "Subtitle"; constexpr string kHTitle = "HTitle"; constexpr string kVTitle = "VTitle"; - constexpr string kLayout = "Layout"; + constexpr string kLayout = "layout"; constexpr string kBlankLine = "Blank"; constexpr string kRectangle = "Rectangle"; constexpr string kCircle = "Circle"; diff --git a/docraft/include/craft/i_docraft_parser.h b/docraft/include/docraft/craft/i_docraft_parser.h similarity index 53% rename from docraft/include/craft/i_docraft_parser.h rename to docraft/include/docraft/craft/i_docraft_parser.h index 0c8e632..a0ba9d4 100644 --- a/docraft/include/craft/i_docraft_parser.h +++ b/docraft/include/docraft/craft/i_docraft_parser.h @@ -1,9 +1,25 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include -#include "model/docraft_node.h" +#include "docraft/model/docraft_node.h" namespace docraft::craft { /** diff --git a/docraft/include/docraft/craft/parser/docraft_circle_parser.h b/docraft/include/docraft/craft/parser/docraft_circle_parser.h new file mode 100644 index 0000000..00bd036 --- /dev/null +++ b/docraft/include/docraft/craft/parser/docraft_circle_parser.h @@ -0,0 +1,36 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "docraft/docraft_lib.h" + +#include "docraft/craft/i_docraft_parser.h" + +namespace docraft::craft::parser { + /** + * @brief Parser for circle nodes. + */ + class DOCRAFT_LIB DocraftCircleParser : public IDocraftParser { + public: + /** + * @brief Parses a circle XML node. + * @param craft_language_source XML node. + * @return Parsed circle node. + */ + std::shared_ptr parse(const pugi::xml_node &craft_language_source) override; + }; +} // docraft::craft::parser diff --git a/docraft/include/docraft/craft/parser/docraft_line_parser.h b/docraft/include/docraft/craft/parser/docraft_line_parser.h new file mode 100644 index 0000000..a506116 --- /dev/null +++ b/docraft/include/docraft/craft/parser/docraft_line_parser.h @@ -0,0 +1,36 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "docraft/docraft_lib.h" + +#include "docraft/craft/i_docraft_parser.h" + +namespace docraft::craft::parser { + /** + * @brief Parser for line nodes. + */ + class DOCRAFT_LIB DocraftLineParser : public IDocraftParser { + public: + /** + * @brief Parses a line XML node. + * @param craft_language_source XML node. + * @return Parsed line node. + */ + std::shared_ptr parse(const pugi::xml_node &craft_language_source) override; + }; +} // docraft::craft::parser diff --git a/docraft/include/craft/parser/docraft_parser.h b/docraft/include/docraft/craft/parser/docraft_parser.h similarity index 86% rename from docraft/include/craft/parser/docraft_parser.h rename to docraft/include/docraft/craft/parser/docraft_parser.h index 5a69e44..af6322e 100644 --- a/docraft/include/craft/parser/docraft_parser.h +++ b/docraft/include/docraft/craft/parser/docraft_parser.h @@ -1,14 +1,30 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" -#include "craft/docraft_craft_language_parser.h" -#include "craft/i_docraft_parser.h" -#include "craft/parser/docraft_circle_parser.h" -#include "craft/parser/docraft_line_parser.h" -#include "craft/parser/docraft_polygon_parser.h" -#include "craft/parser/docraft_triangle_parser.h" -#include "model/docraft_rectangle.h" -#include "model/docraft_settings.h" +#include "docraft/docraft_lib.h" +#include "docraft/craft/docraft_craft_language_parser.h" +#include "docraft/craft/i_docraft_parser.h" +#include "docraft/craft/parser/docraft_circle_parser.h" +#include "docraft/craft/parser/docraft_line_parser.h" +#include "docraft/craft/parser/docraft_polygon_parser.h" +#include "docraft/craft/parser/docraft_triangle_parser.h" +#include "docraft/model/docraft_rectangle.h" +#include "docraft/model/docraft_settings.h" namespace docraft::craft::parser { /** diff --git a/docraft/include/craft/parser/docraft_parser_helpers.h b/docraft/include/docraft/craft/parser/docraft_parser_helpers.h similarity index 75% rename from docraft/include/craft/parser/docraft_parser_helpers.h rename to docraft/include/docraft/craft/parser/docraft_parser_helpers.h index e57a85b..edec663 100644 --- a/docraft/include/craft/parser/docraft_parser_helpers.h +++ b/docraft/include/docraft/craft/parser/docraft_parser_helpers.h @@ -1,12 +1,28 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include -#include "craft/docraft_craft_language_tokens.h" -#include "docraft_color.h" -#include "model/docraft_node.h" -#include "model/docraft_section.h" -#include "model/docraft_settings.h" +#include "docraft/craft/docraft_craft_language_tokens.h" +#include "docraft/docraft_color.h" +#include "docraft/model/docraft_node.h" +#include "docraft/model/docraft_section.h" +#include "docraft/model/docraft_settings.h" namespace docraft::craft::parser::detail { /** diff --git a/docraft/include/docraft/craft/parser/docraft_polygon_parser.h b/docraft/include/docraft/craft/parser/docraft_polygon_parser.h new file mode 100644 index 0000000..e4bc04e --- /dev/null +++ b/docraft/include/docraft/craft/parser/docraft_polygon_parser.h @@ -0,0 +1,36 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "docraft/docraft_lib.h" + +#include "docraft/craft/i_docraft_parser.h" + +namespace docraft::craft::parser { + /** + * @brief Parser for polygon nodes. + */ + class DOCRAFT_LIB DocraftPolygonParser : public IDocraftParser { + public: + /** + * @brief Parses a polygon XML node. + * @param craft_language_source XML node. + * @return Parsed polygon node. + */ + std::shared_ptr parse(const pugi::xml_node &craft_language_source) override; + }; +} // docraft::craft::parser diff --git a/docraft/include/docraft/craft/parser/docraft_shape_parser_utils.h b/docraft/include/docraft/craft/parser/docraft_shape_parser_utils.h new file mode 100644 index 0000000..1034cd5 --- /dev/null +++ b/docraft/include/docraft/craft/parser/docraft_shape_parser_utils.h @@ -0,0 +1,28 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include + +#include + +#include "docraft/model/docraft_position.h" + +namespace docraft::craft::parser::detail { + std::vector parse_points_attribute(const pugi::xml_node &node, const char *attr_name); +} diff --git a/docraft/include/docraft/craft/parser/docraft_triangle_parser.h b/docraft/include/docraft/craft/parser/docraft_triangle_parser.h new file mode 100644 index 0000000..c92bfac --- /dev/null +++ b/docraft/include/docraft/craft/parser/docraft_triangle_parser.h @@ -0,0 +1,36 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "docraft/docraft_lib.h" + +#include "docraft/craft/i_docraft_parser.h" + +namespace docraft::craft::parser { + /** + * @brief Parser for triangle nodes. + */ + class DOCRAFT_LIB DocraftTriangleParser : public IDocraftParser { + public: + /** + * @brief Parses a triangle XML node. + * @param craft_language_source XML node. + * @return Parsed triangle node. + */ + std::shared_ptr parse(const pugi::xml_node &craft_language_source) override; + }; +} // docraft::craft::parser diff --git a/docraft/include/docraft_color.h b/docraft/include/docraft/docraft_color.h similarity index 85% rename from docraft/include/docraft_color.h rename to docraft/include/docraft/docraft_color.h index 881087f..3b97524 100644 --- a/docraft/include/docraft_color.h +++ b/docraft/include/docraft/docraft_color.h @@ -1,6 +1,22 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include namespace docraft { diff --git a/docraft/include/docraft_cursor.h b/docraft/include/docraft/docraft_cursor.h similarity index 77% rename from docraft/include/docraft_cursor.h rename to docraft/include/docraft/docraft_cursor.h index dec1649..afc732e 100644 --- a/docraft/include/docraft_cursor.h +++ b/docraft/include/docraft/docraft_cursor.h @@ -1,9 +1,25 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include -#include "model/docraft_position.h" +#include "docraft/model/docraft_position.h" namespace docraft { diff --git a/docraft/include/docraft_document.h b/docraft/include/docraft/docraft_document.h similarity index 88% rename from docraft/include/docraft_document.h rename to docraft/include/docraft/docraft_document.h index 259b96b..a2b9943 100644 --- a/docraft/include/docraft_document.h +++ b/docraft/include/docraft/docraft_document.h @@ -1,16 +1,32 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include #include #include -#include "docraft_document_context.h" -#include "docraft_document_metadata.h" -#include "model/docraft_node.h" -#include "model/docraft_settings.h" -#include "templating/docraft_template_engine.h" -#include "utils/docraft_keyword_extractor.h" +#include "docraft/docraft_document_context.h" +#include "docraft/docraft_document_metadata.h" +#include "docraft/model/docraft_node.h" +#include "docraft/model/docraft_settings.h" +#include "docraft/templating/docraft_template_engine.h" +#include "docraft/utils/docraft_keyword_extractor.h" namespace docraft { enum class DocraftDomTraverseOp { diff --git a/docraft/include/docraft_document.hpp b/docraft/include/docraft/docraft_document.hpp similarity index 100% rename from docraft/include/docraft_document.hpp rename to docraft/include/docraft/docraft_document.hpp diff --git a/docraft/include/docraft_document_context.h b/docraft/include/docraft/docraft_document_context.h similarity index 90% rename from docraft/include/docraft_document_context.h rename to docraft/include/docraft/docraft_document_context.h index 596871f..be7e10f 100644 --- a/docraft/include/docraft_document_context.h +++ b/docraft/include/docraft/docraft_document_context.h @@ -1,12 +1,28 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include #include "docraft_cursor.h" -#include "backend/docraft_rendering_backend.h" -#include "generic/docraft_font_applier.h" -#include "model/docraft_page_format.h" +#include "docraft/backend/docraft_rendering_backend.h" +#include "docraft/generic/docraft_font_applier.h" +#include "docraft/model/docraft_page_format.h" namespace docraft { namespace renderer { diff --git a/docraft/include/docraft_document_metadata.h b/docraft/include/docraft/docraft_document_metadata.h similarity index 84% rename from docraft/include/docraft_document_metadata.h rename to docraft/include/docraft/docraft_document_metadata.h index 12a341b..0d67c39 100644 --- a/docraft/include/docraft_document_metadata.h +++ b/docraft/include/docraft/docraft_document_metadata.h @@ -1,6 +1,22 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include #include diff --git a/docraft/include/docraft/docraft_lib.h b/docraft/include/docraft/docraft_lib.h new file mode 100644 index 0000000..0d20e78 --- /dev/null +++ b/docraft/include/docraft/docraft_lib.h @@ -0,0 +1,35 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#if defined(_WIN32) || defined(__CYGWIN__) +#if defined(DOCRAFT_BUILD_SHARED_LIB) +#define DOCRAFT_LIB __declspec(dllexport) +#elif defined(DOCRAFT_USE_SHARED_LIB) +#define DOCRAFT_LIB __declspec(dllimport) +#else +#define DOCRAFT_LIB +#endif +#elif defined(__GNUC__) && __GNUC__ >= 4 +#if defined(DOCRAFT_BUILD_SHARED_LIB) +#define DOCRAFT_LIB __attribute__((visibility("default"))) +#else +#define DOCRAFT_LIB +#endif +#else +#define DOCRAFT_LIB +#endif diff --git a/docraft/include/generic/chain_of_responsibility_handler.h b/docraft/include/docraft/generic/chain_of_responsibility_handler.h similarity index 57% rename from docraft/include/generic/chain_of_responsibility_handler.h rename to docraft/include/docraft/generic/chain_of_responsibility_handler.h index 554253d..e0d4094 100644 --- a/docraft/include/generic/chain_of_responsibility_handler.h +++ b/docraft/include/docraft/generic/chain_of_responsibility_handler.h @@ -1,6 +1,22 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include namespace docraft { diff --git a/docraft/include/generic/docraft_font_applier.h b/docraft/include/docraft/generic/docraft_font_applier.h similarity index 81% rename from docraft/include/generic/docraft_font_applier.h rename to docraft/include/docraft/generic/docraft_font_applier.h index 2ad28ba..381c318 100644 --- a/docraft/include/generic/docraft_font_applier.h +++ b/docraft/include/docraft/generic/docraft_font_applier.h @@ -1,6 +1,22 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include #include #include diff --git a/docraft/include/layout/docraft_layout_engine.h b/docraft/include/docraft/layout/docraft_layout_engine.h similarity index 87% rename from docraft/include/layout/docraft_layout_engine.h rename to docraft/include/docraft/layout/docraft_layout_engine.h index 52c50b2..87f7e97 100644 --- a/docraft/include/layout/docraft_layout_engine.h +++ b/docraft/include/docraft/layout/docraft_layout_engine.h @@ -1,14 +1,30 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + // C++ #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include #include -#include "docraft_cursor.h" -#include "generic/chain_of_responsibility_handler.h" -#include "model/docraft_node.h" -#include "model/docraft_section.h" +#include "docraft/docraft_cursor.h" +#include "docraft/generic/chain_of_responsibility_handler.h" +#include "docraft/model/docraft_node.h" +#include "docraft/model/docraft_section.h" namespace docraft::layout { namespace handler { diff --git a/docraft/include/layout/handler/abstract_docraft_layout_handler.h b/docraft/include/docraft/layout/handler/abstract_docraft_layout_handler.h similarity index 68% rename from docraft/include/layout/handler/abstract_docraft_layout_handler.h rename to docraft/include/docraft/layout/handler/abstract_docraft_layout_handler.h index 0b251ff..544d2be 100644 --- a/docraft/include/layout/handler/abstract_docraft_layout_handler.h +++ b/docraft/include/docraft/layout/handler/abstract_docraft_layout_handler.h @@ -1,11 +1,27 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include -#include "docraft_document_context.h" -#include "model/docraft_node.h" -#include "generic/chain_of_responsibility_handler.h" +#include "docraft/docraft_document_context.h" +#include "docraft/model/docraft_node.h" +#include "docraft/generic/chain_of_responsibility_handler.h" namespace docraft::layout::handler { template diff --git a/docraft/include/layout/handler/docraft_basic_layout_handler.h b/docraft/include/docraft/layout/handler/docraft_basic_layout_handler.h similarity index 61% rename from docraft/include/layout/handler/docraft_basic_layout_handler.h rename to docraft/include/docraft/layout/handler/docraft_basic_layout_handler.h index b7aad84..57b6d9f 100644 --- a/docraft/include/layout/handler/docraft_basic_layout_handler.h +++ b/docraft/include/docraft/layout/handler/docraft_basic_layout_handler.h @@ -1,9 +1,25 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include "abstract_docraft_layout_handler.h" -#include "model/docraft_layout.h" -#include "model/docraft_node.h" +#include "docraft/model/docraft_layout.h" +#include "docraft/model/docraft_node.h" namespace docraft::layout::handler { /** diff --git a/docraft/include/layout/handler/docraft_layout_blank_line.h b/docraft/include/docraft/layout/handler/docraft_layout_blank_line.h similarity index 62% rename from docraft/include/layout/handler/docraft_layout_blank_line.h rename to docraft/include/docraft/layout/handler/docraft_layout_blank_line.h index 9671ad2..33dd0ee 100644 --- a/docraft/include/layout/handler/docraft_layout_blank_line.h +++ b/docraft/include/docraft/layout/handler/docraft_layout_blank_line.h @@ -1,9 +1,24 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include "abstract_docraft_layout_handler.h" -#include "generic/chain_of_responsibility_handler.h" -#include "model/docraft_blank_line.h" +#include "docraft/model/docraft_blank_line.h" namespace docraft::layout::handler { /** diff --git a/docraft/include/layout/handler/docraft_layout_handler.h b/docraft/include/docraft/layout/handler/docraft_layout_handler.h similarity index 59% rename from docraft/include/layout/handler/docraft_layout_handler.h rename to docraft/include/docraft/layout/handler/docraft_layout_handler.h index c7db872..d1866e1 100644 --- a/docraft/include/layout/handler/docraft_layout_handler.h +++ b/docraft/include/docraft/layout/handler/docraft_layout_handler.h @@ -1,10 +1,26 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include "abstract_docraft_layout_handler.h" -#include "generic/chain_of_responsibility_handler.h" -#include "model/docraft_layout.h" -#include "model/docraft_node.h" +#include "docraft/generic/chain_of_responsibility_handler.h" +#include "docraft/model/docraft_layout.h" +#include "docraft/model/docraft_node.h" namespace docraft::layout::handler { /** diff --git a/docraft/include/layout/handler/docraft_layout_list_handler.h b/docraft/include/docraft/layout/handler/docraft_layout_list_handler.h similarity index 75% rename from docraft/include/layout/handler/docraft_layout_list_handler.h rename to docraft/include/docraft/layout/handler/docraft_layout_list_handler.h index c1ed1d2..a659685 100644 --- a/docraft/include/layout/handler/docraft_layout_list_handler.h +++ b/docraft/include/docraft/layout/handler/docraft_layout_list_handler.h @@ -1,11 +1,27 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include #include "abstract_docraft_layout_handler.h" -#include "model/docraft_list.h" +#include "docraft/model/docraft_list.h" namespace docraft::layout::handler { /** diff --git a/docraft/include/layout/handler/docraft_layout_table_handler.h b/docraft/include/docraft/layout/handler/docraft_layout_table_handler.h similarity index 60% rename from docraft/include/layout/handler/docraft_layout_table_handler.h rename to docraft/include/docraft/layout/handler/docraft_layout_table_handler.h index c21c6e3..9b2e5e9 100644 --- a/docraft/include/layout/handler/docraft_layout_table_handler.h +++ b/docraft/include/docraft/layout/handler/docraft_layout_table_handler.h @@ -1,9 +1,25 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include "abstract_docraft_layout_handler.h" -#include "generic/chain_of_responsibility_handler.h" -#include "model/docraft_table.h" +#include "docraft/generic/chain_of_responsibility_handler.h" +#include "docraft/model/docraft_table.h" namespace docraft::layout::handler { /** diff --git a/docraft/include/layout/handler/docraft_layout_text_handler.h b/docraft/include/docraft/layout/handler/docraft_layout_text_handler.h similarity index 70% rename from docraft/include/layout/handler/docraft_layout_text_handler.h rename to docraft/include/docraft/layout/handler/docraft_layout_text_handler.h index 08b2ad2..ee90db0 100644 --- a/docraft/include/layout/handler/docraft_layout_text_handler.h +++ b/docraft/include/docraft/layout/handler/docraft_layout_text_handler.h @@ -1,10 +1,26 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include "abstract_docraft_layout_handler.h" -#include "generic/chain_of_responsibility_handler.h" -#include "model/docraft_layout.h" -#include "model/docraft_text.h" +#include "docraft/generic/chain_of_responsibility_handler.h" +#include "docraft/model/docraft_layout.h" +#include "docraft/model/docraft_text.h" namespace docraft::layout::handler { /** diff --git a/docraft/include/docraft/model/docraft_blank_line.h b/docraft/include/docraft/model/docraft_blank_line.h new file mode 100644 index 0000000..b88adb5 --- /dev/null +++ b/docraft/include/docraft/model/docraft_blank_line.h @@ -0,0 +1,40 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "docraft/docraft_lib.h" +#include "docraft/model/docraft_node.h" +#include "docraft/model/i_docraft_clonable.h" + +namespace docraft::model { + /** + * @brief Blank line node used to add vertical spacing in flow layout. + */ + class DOCRAFT_LIB DocraftBlankLine : public DocraftNode, public IDocraftClonable { + public: + using DocraftNode::DocraftNode; + /** + * @brief Draws the blank line using the provided context. + */ + void draw(const std::shared_ptr &context) override; + /** + * @brief Clones the blank line node. + * @return Shared pointer to the cloned node. + */ + std::shared_ptr clone() const override; + }; +} // docraft diff --git a/docraft/include/docraft/model/docraft_body.h b/docraft/include/docraft/model/docraft_body.h new file mode 100644 index 0000000..39a20ec --- /dev/null +++ b/docraft/include/docraft/model/docraft_body.h @@ -0,0 +1,36 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "docraft/docraft_lib.h" +#include "docraft/model/docraft_section.h" + +namespace docraft::model { + /** + * @brief Body section of the document. + */ + class DOCRAFT_LIB DocraftBody : public DocraftSection{ + public: + using DocraftSection::DocraftSection; + ~DocraftBody() override = default; + /** + * @brief Clones the body node and its children. + * @return Shared pointer to the cloned node. + */ + std::shared_ptr clone() const override; + }; +} // docraft diff --git a/docraft/include/model/docraft_children_container_node.h b/docraft/include/docraft/model/docraft_children_container_node.h similarity index 78% rename from docraft/include/model/docraft_children_container_node.h rename to docraft/include/docraft/model/docraft_children_container_node.h index 802fc15..5e3ea4c 100644 --- a/docraft/include/model/docraft_children_container_node.h +++ b/docraft/include/docraft/model/docraft_children_container_node.h @@ -1,7 +1,23 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" -#include "docraft_node.h" +#include "docraft/docraft_lib.h" +#include "docraft/model/docraft_node.h" #include namespace docraft::model { /** diff --git a/docraft/include/model/docraft_circle.h b/docraft/include/docraft/model/docraft_circle.h similarity index 70% rename from docraft/include/model/docraft_circle.h rename to docraft/include/docraft/model/docraft_circle.h index 8eb7466..78ad456 100644 --- a/docraft/include/model/docraft_circle.h +++ b/docraft/include/docraft/model/docraft_circle.h @@ -1,10 +1,26 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" -#include "docraft_color.h" -#include "docraft_node.h" -#include "model/i_docraft_clonable.h" +#include "docraft/docraft_color.h" +#include "docraft/model/docraft_node.h" +#include "docraft/model/i_docraft_clonable.h" namespace docraft::model { /** diff --git a/docraft/include/docraft/model/docraft_clone_utils.h b/docraft/include/docraft/model/docraft_clone_utils.h new file mode 100644 index 0000000..b6a5257 --- /dev/null +++ b/docraft/include/docraft/model/docraft_clone_utils.h @@ -0,0 +1,28 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include + +#include "docraft/model/docraft_node.h" +#include "docraft/model/i_docraft_clonable.h" + +namespace docraft::model { + std::shared_ptr clone_node(const std::shared_ptr &node); + std::vector> clone_nodes(const std::vector> &nodes); +} // namespace docraft::model diff --git a/docraft/include/docraft/model/docraft_footer.h b/docraft/include/docraft/model/docraft_footer.h new file mode 100644 index 0000000..4e5c7bc --- /dev/null +++ b/docraft/include/docraft/model/docraft_footer.h @@ -0,0 +1,42 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "docraft/docraft_lib.h" +#include + +#include "docraft/docraft_document_context.h" +#include "docraft/model/docraft_section.h" + +namespace docraft::model { + /** + * @brief Footer section of the document. + */ + class DOCRAFT_LIB DocraftFooter : public DocraftSection { + public: + /** + * @brief Creates a footer section with default margins. + */ + DocraftFooter(); + ~DocraftFooter() override = default; + /** + * @brief Clones the footer node and its children. + * @return Shared pointer to the cloned node. + */ + std::shared_ptr clone() const override; + }; +} // docraft diff --git a/docraft/include/model/docraft_foreach.h b/docraft/include/docraft/model/docraft_foreach.h similarity index 70% rename from docraft/include/model/docraft_foreach.h rename to docraft/include/docraft/model/docraft_foreach.h index 834a90f..5091d6b 100644 --- a/docraft/include/model/docraft_foreach.h +++ b/docraft/include/docraft/model/docraft_foreach.h @@ -1,14 +1,30 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" -#include "docraft_children_container_node.h" -#include "docraft_node.h" -#include "model/i_docraft_clonable.h" +#include "docraft/docraft_lib.h" +#include "docraft/model/docraft_children_container_node.h" +#include "docraft/model/docraft_node.h" +#include "docraft/model/i_docraft_clonable.h" namespace docraft::model { /** * @brief Represents a foreach loop in the document, allowing for dynamic generation of content based on a collection of items. - * The foreach node should have a "model" attribute that specifies the collection to iterate over, + * The foreach node should have a "docraft/model" attribute that specifies the collection to iterate over, * and its children will be rendered for each item in the collection with template variables available for the current item. */ class DOCRAFT_LIB DocraftForeach : public DocraftChildrenContainerNode, public IDocraftClonable { diff --git a/docraft/include/docraft/model/docraft_header.h b/docraft/include/docraft/model/docraft_header.h new file mode 100644 index 0000000..186c145 --- /dev/null +++ b/docraft/include/docraft/model/docraft_header.h @@ -0,0 +1,39 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "docraft/docraft_lib.h" +#include "docraft/model/docraft_section.h" + +namespace docraft::model { + /** + * @brief Header section of the document. + */ + class DOCRAFT_LIB DocraftHeader : public DocraftSection { + public: + /** + * @brief Creates a header section with default margins. + */ + DocraftHeader(); + ~DocraftHeader() override = default; + /** + * @brief Clones the header node and its children. + * @return Shared pointer to the cloned node. + */ + std::shared_ptr clone() const override; + }; +} diff --git a/docraft/include/model/docraft_image.h b/docraft/include/docraft/model/docraft_image.h similarity index 85% rename from docraft/include/model/docraft_image.h rename to docraft/include/docraft/model/docraft_image.h index dfd64be..e92cb69 100644 --- a/docraft/include/model/docraft_image.h +++ b/docraft/include/docraft/model/docraft_image.h @@ -1,10 +1,26 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include -#include "model/docraft_node.h" -#include "model/i_docraft_clonable.h" +#include "docraft/model/docraft_node.h" +#include "docraft/model/i_docraft_clonable.h" namespace docraft::model { /** diff --git a/docraft/include/model/docraft_layout.h b/docraft/include/docraft/model/docraft_layout.h similarity index 75% rename from docraft/include/model/docraft_layout.h rename to docraft/include/docraft/model/docraft_layout.h index 54be05c..41a7b43 100644 --- a/docraft/include/model/docraft_layout.h +++ b/docraft/include/docraft/model/docraft_layout.h @@ -1,9 +1,25 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" -#include "docraft_children_container_node.h" -#include "model/i_docraft_clonable.h" -#include "docraft_node.h" +#include "docraft/docraft_lib.h" +#include "docraft/model/docraft_children_container_node.h" +#include "docraft/model/i_docraft_clonable.h" +#include "docraft/model/docraft_node.h" namespace docraft::model { /** diff --git a/docraft/include/model/docraft_line.h b/docraft/include/docraft/model/docraft_line.h similarity index 71% rename from docraft/include/model/docraft_line.h rename to docraft/include/docraft/model/docraft_line.h index 033dd9e..514f371 100644 --- a/docraft/include/model/docraft_line.h +++ b/docraft/include/docraft/model/docraft_line.h @@ -1,11 +1,27 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" -#include "docraft_color.h" -#include "docraft_node.h" -#include "model/docraft_position.h" -#include "model/i_docraft_clonable.h" +#include "docraft/docraft_color.h" +#include "docraft/model/docraft_node.h" +#include "docraft/model/docraft_position.h" +#include "docraft/model/i_docraft_clonable.h" namespace docraft::model { /** diff --git a/docraft/include/model/docraft_list.h b/docraft/include/docraft/model/docraft_list.h similarity index 87% rename from docraft/include/model/docraft_list.h rename to docraft/include/docraft/model/docraft_list.h index 184befa..246b9a8 100644 --- a/docraft/include/model/docraft_list.h +++ b/docraft/include/docraft/model/docraft_list.h @@ -1,14 +1,30 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include #include #include -#include "model/docraft_children_container_node.h" -#include "model/i_docraft_clonable.h" -#include "model/docraft_text.h" +#include "docraft/model/docraft_children_container_node.h" +#include "docraft/model/i_docraft_clonable.h" +#include "docraft/model/docraft_text.h" namespace docraft::model { /** diff --git a/docraft/include/docraft/model/docraft_new_page.h b/docraft/include/docraft/model/docraft_new_page.h new file mode 100644 index 0000000..4491ec0 --- /dev/null +++ b/docraft/include/docraft/model/docraft_new_page.h @@ -0,0 +1,42 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "docraft/docraft_lib.h" + +#include "docraft/model/docraft_node.h" +#include "i_docraft_clonable.h" + +namespace docraft::model { + /** + * @brief Represents a manual page break in the document. + */ + class DOCRAFT_LIB DocraftNewPage : public DocraftNode, public IDocraftClonable { + public: + using DocraftNode::DocraftNode; + DocraftNewPage() = default; + ~DocraftNewPage() override = default; + + void draw(const std::shared_ptr &/*context*/) override { + // Layout engine handles page breaks; no rendering needed. + } + + std::shared_ptr clone() const override { + return std::make_shared(*this); + } + }; +} // docraft diff --git a/docraft/include/model/docraft_node.h b/docraft/include/docraft/model/docraft_node.h similarity index 87% rename from docraft/include/model/docraft_node.h rename to docraft/include/docraft/model/docraft_node.h index a45994c..ee70532 100644 --- a/docraft/include/model/docraft_node.h +++ b/docraft/include/docraft/model/docraft_node.h @@ -1,9 +1,25 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include -#include "docraft_document_context.h" +#include "docraft/docraft_document_context.h" #include "docraft_position.h" namespace docraft::model { diff --git a/docraft/include/docraft/model/docraft_page_format.h b/docraft/include/docraft/model/docraft_page_format.h new file mode 100644 index 0000000..818f856 --- /dev/null +++ b/docraft/include/docraft/model/docraft_page_format.h @@ -0,0 +1,38 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +namespace docraft::model { + /** + * @brief Supported page sizes. + */ + enum class DocraftPageSize { + kA4, + kA3, + kA5, + kLetter, + kLegal + }; + + /** + * @brief Page orientation. + */ + enum class DocraftPageOrientation { + kPortrait, + kLandscape + }; +} // namespace docraft::model diff --git a/docraft/include/model/docraft_page_number.h b/docraft/include/docraft/model/docraft_page_number.h similarity index 61% rename from docraft/include/model/docraft_page_number.h rename to docraft/include/docraft/model/docraft_page_number.h index f511bb8..f4fe14a 100644 --- a/docraft/include/model/docraft_page_number.h +++ b/docraft/include/docraft/model/docraft_page_number.h @@ -1,8 +1,24 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" -#include "docraft_text.h" +#include "docraft/model/docraft_text.h" namespace docraft::model { /** diff --git a/docraft/include/model/docraft_paragraph.h b/docraft/include/docraft/model/docraft_paragraph.h similarity index 50% rename from docraft/include/model/docraft_paragraph.h rename to docraft/include/docraft/model/docraft_paragraph.h index 37a0462..ce55ed3 100644 --- a/docraft/include/model/docraft_paragraph.h +++ b/docraft/include/docraft/model/docraft_paragraph.h @@ -1,8 +1,24 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" -#include "docraft_section.h" -#include "model/i_docraft_clonable.h" +#include "docraft/docraft_lib.h" +#include "docraft/model/docraft_section.h" +#include "docraft/model/i_docraft_clonable.h" namespace docraft::model { /** diff --git a/docraft/include/model/docraft_polygon.h b/docraft/include/docraft/model/docraft_polygon.h similarity index 72% rename from docraft/include/model/docraft_polygon.h rename to docraft/include/docraft/model/docraft_polygon.h index 68d25b1..7261cb4 100644 --- a/docraft/include/model/docraft_polygon.h +++ b/docraft/include/docraft/model/docraft_polygon.h @@ -1,13 +1,29 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include -#include "docraft_color.h" -#include "docraft_node.h" -#include "model/docraft_position.h" -#include "model/i_docraft_clonable.h" +#include "docraft/docraft_color.h" +#include "docraft/model/docraft_node.h" +#include "docraft/model/docraft_position.h" +#include "docraft/model/i_docraft_clonable.h" namespace docraft::model { /** diff --git a/docraft/include/model/docraft_position.h b/docraft/include/docraft/model/docraft_position.h similarity index 86% rename from docraft/include/model/docraft_position.h rename to docraft/include/docraft/model/docraft_position.h index 4b75a69..47360d7 100644 --- a/docraft/include/model/docraft_position.h +++ b/docraft/include/docraft/model/docraft_position.h @@ -1,6 +1,22 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include namespace docraft::model { diff --git a/docraft/include/model/docraft_rectangle.h b/docraft/include/docraft/model/docraft_rectangle.h similarity index 78% rename from docraft/include/model/docraft_rectangle.h rename to docraft/include/docraft/model/docraft_rectangle.h index a4ec4c7..d71762a 100644 --- a/docraft/include/model/docraft_rectangle.h +++ b/docraft/include/docraft/model/docraft_rectangle.h @@ -1,10 +1,26 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" -#include "docraft_children_container_node.h" -#include "docraft_color.h" -#include "model/i_docraft_clonable.h" -#include "docraft_node.h" +#include "docraft/docraft_lib.h" +#include "docraft/model/docraft_children_container_node.h" +#include "docraft/docraft_color.h" +#include "docraft/model/i_docraft_clonable.h" +#include "docraft/model/docraft_node.h" namespace docraft::model { /** diff --git a/docraft/include/model/docraft_section.h b/docraft/include/docraft/model/docraft_section.h similarity index 78% rename from docraft/include/model/docraft_section.h rename to docraft/include/docraft/model/docraft_section.h index 9dd5af0..8f101de 100644 --- a/docraft/include/model/docraft_section.h +++ b/docraft/include/docraft/model/docraft_section.h @@ -1,9 +1,25 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" -#include "docraft_rectangle.h" -#include "model/docraft_children_container_node.h" +#include "docraft/model/docraft_rectangle.h" +#include "docraft/model/docraft_children_container_node.h" namespace docraft::model { /** diff --git a/docraft/include/model/docraft_settings.h b/docraft/include/docraft/model/docraft_settings.h similarity index 83% rename from docraft/include/model/docraft_settings.h rename to docraft/include/docraft/model/docraft_settings.h index 89e1b6b..ca5fe7c 100644 --- a/docraft/include/model/docraft_settings.h +++ b/docraft/include/docraft/model/docraft_settings.h @@ -1,10 +1,26 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include #include -#include "model/docraft_node.h" -#include "model/docraft_page_format.h" +#include "docraft/model/docraft_node.h" +#include "docraft/model/docraft_page_format.h" namespace docraft::model { namespace setting { diff --git a/docraft/include/model/docraft_table.h b/docraft/include/docraft/model/docraft_table.h similarity index 94% rename from docraft/include/model/docraft_table.h rename to docraft/include/docraft/model/docraft_table.h index cec7b11..61924b6 100644 --- a/docraft/include/model/docraft_table.h +++ b/docraft/include/docraft/model/docraft_table.h @@ -1,12 +1,28 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include -#include "docraft_text.h" -#include "docraft_color.h" -#include "model/docraft_children_container_node.h" -#include "model/docraft_layout.h" -#include "model/i_docraft_clonable.h" +#include "docraft/model/docraft_text.h" +#include "docraft/docraft_color.h" +#include "docraft/model/docraft_children_container_node.h" +#include "docraft/model/docraft_layout.h" +#include "docraft/model/i_docraft_clonable.h" namespace docraft::model { enum class DocraftModelType { diff --git a/docraft/include/model/docraft_text.h b/docraft/include/docraft/model/docraft_text.h similarity index 87% rename from docraft/include/model/docraft_text.h rename to docraft/include/docraft/model/docraft_text.h index 3d11180..c7735b2 100644 --- a/docraft/include/model/docraft_text.h +++ b/docraft/include/docraft/model/docraft_text.h @@ -1,14 +1,30 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include #include #include -#include "docraft_children_container_node.h" -#include "docraft_color.h" -#include "docraft_node.h" -#include "model/i_docraft_clonable.h" +#include "docraft/model/docraft_children_container_node.h" +#include "docraft/docraft_color.h" +#include "docraft/model/docraft_node.h" +#include "docraft/model/i_docraft_clonable.h" namespace docraft::model { /** diff --git a/docraft/include/model/docraft_triangle.h b/docraft/include/docraft/model/docraft_triangle.h similarity index 73% rename from docraft/include/model/docraft_triangle.h rename to docraft/include/docraft/model/docraft_triangle.h index 5940213..828bfd3 100644 --- a/docraft/include/model/docraft_triangle.h +++ b/docraft/include/docraft/model/docraft_triangle.h @@ -1,13 +1,29 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include -#include "docraft_color.h" -#include "docraft_node.h" -#include "model/docraft_position.h" -#include "model/i_docraft_clonable.h" +#include "docraft/docraft_color.h" +#include "docraft/model/docraft_node.h" +#include "docraft/model/docraft_position.h" +#include "docraft/model/i_docraft_clonable.h" namespace docraft::model { /** diff --git a/docraft/include/docraft/model/i_docraft_clonable.h b/docraft/include/docraft/model/i_docraft_clonable.h new file mode 100644 index 0000000..486d679 --- /dev/null +++ b/docraft/include/docraft/model/i_docraft_clonable.h @@ -0,0 +1,39 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "docraft/docraft_lib.h" + +#include + +namespace docraft::model { + class DocraftNode; + + /** + * @brief Interface for clonable Docraft nodes. + * Nodes that implement this interface can be cloned, which is useful for templating and other operations that require copying nodes. + */ + class DOCRAFT_LIB IDocraftClonable { + public: + virtual ~IDocraftClonable() = default; + /** + * @brief Creates a deep copy of the node. + * @return A shared pointer to the cloned node. + */ + virtual std::shared_ptr clone() const = 0; + }; +} // namespace docraft::model diff --git a/docraft/include/renderer/docraft_pdf_renderer.h b/docraft/include/docraft/renderer/docraft_pdf_renderer.h similarity index 70% rename from docraft/include/renderer/docraft_pdf_renderer.h rename to docraft/include/docraft/renderer/docraft_pdf_renderer.h index 5b7f2f8..a87003d 100644 --- a/docraft/include/renderer/docraft_pdf_renderer.h +++ b/docraft/include/docraft/renderer/docraft_pdf_renderer.h @@ -1,14 +1,30 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" -#include "model/docraft_circle.h" -#include "model/docraft_image.h" -#include "model/docraft_line.h" -#include "model/docraft_polygon.h" -#include "model/docraft_rectangle.h" -#include "model/docraft_table.h" -#include "model/docraft_triangle.h" -#include "renderer/docraft_renderer.h" +#include "docraft/docraft_lib.h" +#include "docraft/model/docraft_circle.h" +#include "docraft/model/docraft_image.h" +#include "docraft/model/docraft_line.h" +#include "docraft/model/docraft_polygon.h" +#include "docraft/model/docraft_rectangle.h" +#include "docraft/model/docraft_table.h" +#include "docraft/model/docraft_triangle.h" +#include "docraft/renderer/docraft_renderer.h" namespace docraft::renderer { /** diff --git a/docraft/include/renderer/docraft_renderer.h b/docraft/include/docraft/renderer/docraft_renderer.h similarity index 74% rename from docraft/include/renderer/docraft_renderer.h rename to docraft/include/docraft/renderer/docraft_renderer.h index 97333ab..17413b2 100644 --- a/docraft/include/renderer/docraft_renderer.h +++ b/docraft/include/docraft/renderer/docraft_renderer.h @@ -1,17 +1,33 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include -#include "model/docraft_blank_line.h" -#include "model/docraft_circle.h" -#include "model/docraft_image.h" -#include "model/docraft_line.h" -#include "model/docraft_polygon.h" -#include "model/docraft_rectangle.h" -#include "model/docraft_section.h" -#include "model/docraft_table.h" -#include "model/docraft_triangle.h" +#include "docraft/model/docraft_blank_line.h" +#include "docraft/model/docraft_circle.h" +#include "docraft/model/docraft_image.h" +#include "docraft/model/docraft_line.h" +#include "docraft/model/docraft_polygon.h" +#include "docraft/model/docraft_rectangle.h" +#include "docraft/model/docraft_section.h" +#include "docraft/model/docraft_table.h" +#include "docraft/model/docraft_triangle.h" namespace docraft::renderer { /** diff --git a/docraft/include/renderer/painter/docraft_blank_line_painter.h b/docraft/include/docraft/renderer/painter/docraft_blank_line_painter.h similarity index 53% rename from docraft/include/renderer/painter/docraft_blank_line_painter.h rename to docraft/include/docraft/renderer/painter/docraft_blank_line_painter.h index 0b36237..5f28f06 100644 --- a/docraft/include/renderer/painter/docraft_blank_line_painter.h +++ b/docraft/include/docraft/renderer/painter/docraft_blank_line_painter.h @@ -1,8 +1,24 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" -#include "i_painter.h" -#include "model/docraft_blank_line.h" +#include "docraft/docraft_lib.h" +#include "docraft/renderer/painter/i_painter.h" +#include "docraft/model/docraft_blank_line.h" namespace docraft::renderer::painter { /** diff --git a/docraft/include/docraft/renderer/painter/docraft_circle_painter.h b/docraft/include/docraft/renderer/painter/docraft_circle_painter.h new file mode 100644 index 0000000..6689c65 --- /dev/null +++ b/docraft/include/docraft/renderer/painter/docraft_circle_painter.h @@ -0,0 +1,42 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "docraft/docraft_lib.h" +#include "docraft/model/docraft_circle.h" +#include "docraft/renderer/painter/i_painter.h" + +namespace docraft::renderer::painter { + /** + * @brief Painter that draws DocraftCircle nodes. + */ + class DOCRAFT_LIB DocraftCirclePainter : public IPainter { + public: + /** + * @brief Creates a circle painter bound to the circle node. + * @param circle_node Circle node. + */ + explicit DocraftCirclePainter(const model::DocraftCircle &circle_node); + /** + * @brief Draws the circle using the provided context. + * @param context Document context. + */ + void draw(const std::shared_ptr &context) override; + private: + model::DocraftCircle circle_node_; + }; +} // docraft::renderer::painter diff --git a/docraft/include/renderer/painter/docraft_image_painter.h b/docraft/include/docraft/renderer/painter/docraft_image_painter.h similarity index 51% rename from docraft/include/renderer/painter/docraft_image_painter.h rename to docraft/include/docraft/renderer/painter/docraft_image_painter.h index e914ef6..0f8be51 100644 --- a/docraft/include/renderer/painter/docraft_image_painter.h +++ b/docraft/include/docraft/renderer/painter/docraft_image_painter.h @@ -1,8 +1,24 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" -#include "i_painter.h" -#include "model/docraft_image.h" +#include "docraft/docraft_lib.h" +#include "docraft/renderer/painter/i_painter.h" +#include "docraft/model/docraft_image.h" namespace docraft::renderer::painter { diff --git a/docraft/include/docraft/renderer/painter/docraft_line_painter.h b/docraft/include/docraft/renderer/painter/docraft_line_painter.h new file mode 100644 index 0000000..57defc5 --- /dev/null +++ b/docraft/include/docraft/renderer/painter/docraft_line_painter.h @@ -0,0 +1,42 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "docraft/docraft_lib.h" +#include "docraft/model/docraft_line.h" +#include "docraft/renderer/painter/i_painter.h" + +namespace docraft::renderer::painter { + /** + * @brief Painter that draws DocraftLine nodes. + */ + class DOCRAFT_LIB DocraftLinePainter : public IPainter { + public: + /** + * @brief Creates a line painter bound to the line node. + * @param line_node Line node. + */ + explicit DocraftLinePainter(const model::DocraftLine &line_node); + /** + * @brief Draws the line using the provided context. + * @param context Document context. + */ + void draw(const std::shared_ptr &context) override; + private: + model::DocraftLine line_node_; + }; +} // docraft::renderer::painter diff --git a/docraft/include/docraft/renderer/painter/docraft_polygon_painter.h b/docraft/include/docraft/renderer/painter/docraft_polygon_painter.h new file mode 100644 index 0000000..ac9f5f3 --- /dev/null +++ b/docraft/include/docraft/renderer/painter/docraft_polygon_painter.h @@ -0,0 +1,42 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "docraft/docraft_lib.h" +#include "docraft/model/docraft_polygon.h" +#include "docraft/renderer/painter/i_painter.h" + +namespace docraft::renderer::painter { + /** + * @brief Painter that draws DocraftPolygon nodes. + */ + class DOCRAFT_LIB DocraftPolygonPainter : public IPainter { + public: + /** + * @brief Creates a polygon painter bound to the polygon node. + * @param polygon_node Polygon node. + */ + explicit DocraftPolygonPainter(const model::DocraftPolygon &polygon_node); + /** + * @brief Draws the polygon using the provided context. + * @param context Document context. + */ + void draw(const std::shared_ptr &context) override; + private: + model::DocraftPolygon polygon_node_; + }; +} // docraft::renderer::painter diff --git a/docraft/include/renderer/painter/docraft_rectangle_painter.h b/docraft/include/docraft/renderer/painter/docraft_rectangle_painter.h similarity index 51% rename from docraft/include/renderer/painter/docraft_rectangle_painter.h rename to docraft/include/docraft/renderer/painter/docraft_rectangle_painter.h index 0a0fda4..f6a0f32 100644 --- a/docraft/include/renderer/painter/docraft_rectangle_painter.h +++ b/docraft/include/docraft/renderer/painter/docraft_rectangle_painter.h @@ -1,8 +1,24 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" -#include "model/docraft_rectangle.h" -#include "renderer/painter/i_painter.h" +#include "docraft/docraft_lib.h" +#include "docraft/model/docraft_rectangle.h" +#include "docraft/renderer/painter/i_painter.h" namespace docraft::renderer::painter { /** diff --git a/docraft/include/renderer/painter/docraft_table_painter.h b/docraft/include/docraft/renderer/painter/docraft_table_painter.h similarity index 51% rename from docraft/include/renderer/painter/docraft_table_painter.h rename to docraft/include/docraft/renderer/painter/docraft_table_painter.h index 6e81d39..db447e5 100644 --- a/docraft/include/renderer/painter/docraft_table_painter.h +++ b/docraft/include/docraft/renderer/painter/docraft_table_painter.h @@ -1,8 +1,24 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" -#include "i_painter.h" -#include "model/docraft_table.h" +#include "docraft/docraft_lib.h" +#include "docraft/renderer/painter/i_painter.h" +#include "docraft/model/docraft_table.h" namespace docraft::renderer::painter { /** diff --git a/docraft/include/renderer/painter/docraft_text_painter.h b/docraft/include/docraft/renderer/painter/docraft_text_painter.h similarity index 74% rename from docraft/include/renderer/painter/docraft_text_painter.h rename to docraft/include/docraft/renderer/painter/docraft_text_painter.h index ba2d2d6..57ac959 100644 --- a/docraft/include/renderer/painter/docraft_text_painter.h +++ b/docraft/include/docraft/renderer/painter/docraft_text_painter.h @@ -1,11 +1,27 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include -#include "backend/docraft_text_rendering_backend.h" +#include "docraft/backend/docraft_text_rendering_backend.h" -#include "model/docraft_text.h" -#include "renderer/painter/i_painter.h" +#include "docraft/model/docraft_text.h" +#include "docraft/renderer/painter/i_painter.h" namespace docraft::renderer::painter { /** diff --git a/docraft/include/docraft/renderer/painter/docraft_triangle_painter.h b/docraft/include/docraft/renderer/painter/docraft_triangle_painter.h new file mode 100644 index 0000000..ce78edb --- /dev/null +++ b/docraft/include/docraft/renderer/painter/docraft_triangle_painter.h @@ -0,0 +1,42 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "docraft/docraft_lib.h" +#include "docraft/model/docraft_triangle.h" +#include "docraft/renderer/painter/i_painter.h" + +namespace docraft::renderer::painter { + /** + * @brief Painter that draws DocraftTriangle nodes. + */ + class DOCRAFT_LIB DocraftTrianglePainter : public IPainter { + public: + /** + * @brief Creates a triangle painter bound to the triangle node. + * @param triangle_node Triangle node. + */ + explicit DocraftTrianglePainter(const model::DocraftTriangle &triangle_node); + /** + * @brief Draws the triangle using the provided context. + * @param context Document context. + */ + void draw(const std::shared_ptr &context) override; + private: + model::DocraftTriangle triangle_node_; + }; +} // docraft::renderer::painter diff --git a/docraft/include/docraft/renderer/painter/i_painter.h b/docraft/include/docraft/renderer/painter/i_painter.h new file mode 100644 index 0000000..faf7c29 --- /dev/null +++ b/docraft/include/docraft/renderer/painter/i_painter.h @@ -0,0 +1,40 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "docraft/docraft_lib.h" +#include + +#include "docraft/docraft_document_context.h" + +namespace docraft::renderer::painter { + /** + * @brief Interface for painter classes responsible for drawing elements onto a PDF context. + */ + class DOCRAFT_LIB IPainter { + public: + /** + * @brief Virtual destructor. + */ + virtual ~IPainter() = default; + /** + * @brief Draws the element using the provided document context. + * @param context Document context providing backend access and state. + */ + virtual void draw(const std::shared_ptr &context) = 0; + }; +} // docraft diff --git a/docraft/include/templating/docraft_template_engine.h b/docraft/include/docraft/templating/docraft_template_engine.h similarity index 89% rename from docraft/include/templating/docraft_template_engine.h rename to docraft/include/docraft/templating/docraft_template_engine.h index 5882bd3..8a5eca9 100644 --- a/docraft/include/templating/docraft_template_engine.h +++ b/docraft/include/docraft/templating/docraft_template_engine.h @@ -1,6 +1,22 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include #include #include diff --git a/docraft/include/docraft/utils/docraft_base64.h b/docraft/include/docraft/utils/docraft_base64.h new file mode 100644 index 0000000..035508e --- /dev/null +++ b/docraft/include/docraft/utils/docraft_base64.h @@ -0,0 +1,29 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once +#include +#include + +namespace docraft::utils { + /** + * @brief Decodes a base64 string into raw bytes. + * @param input Base64 string (no data URI prefix). + * @return Decoded bytes. + * @throws std::invalid_argument if the input is not valid base64. + */ + std::vector decode_base64(std::string_view input); +} diff --git a/docraft/include/utils/docraft_font_registry.h b/docraft/include/docraft/utils/docraft_font_registry.h similarity index 75% rename from docraft/include/utils/docraft_font_registry.h rename to docraft/include/docraft/utils/docraft_font_registry.h index 3cf3b3b..8b0beb1 100644 --- a/docraft/include/utils/docraft_font_registry.h +++ b/docraft/include/docraft/utils/docraft_font_registry.h @@ -1,6 +1,22 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include #include #include diff --git a/docraft/include/utils/docraft_font_resolver.h b/docraft/include/docraft/utils/docraft_font_resolver.h similarity index 78% rename from docraft/include/utils/docraft_font_resolver.h rename to docraft/include/docraft/utils/docraft_font_resolver.h index 1b20b40..31dc37d 100644 --- a/docraft/include/utils/docraft_font_resolver.h +++ b/docraft/include/docraft/utils/docraft_font_resolver.h @@ -1,11 +1,27 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include #include #include -#include "model/docraft_text.h" +#include "docraft/model/docraft_text.h" namespace docraft::utils { /** diff --git a/docraft/include/utils/docraft_keyword_extractor.h b/docraft/include/docraft/utils/docraft_keyword_extractor.h similarity index 73% rename from docraft/include/utils/docraft_keyword_extractor.h rename to docraft/include/docraft/utils/docraft_keyword_extractor.h index c2a4226..c7c8b9f 100644 --- a/docraft/include/utils/docraft_keyword_extractor.h +++ b/docraft/include/docraft/utils/docraft_keyword_extractor.h @@ -1,6 +1,22 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include #include diff --git a/docraft/include/utils/docraft_logger.h b/docraft/include/docraft/utils/docraft_logger.h similarity index 80% rename from docraft/include/utils/docraft_logger.h rename to docraft/include/docraft/utils/docraft_logger.h index c109c68..727f0bd 100644 --- a/docraft/include/utils/docraft_logger.h +++ b/docraft/include/docraft/utils/docraft_logger.h @@ -1,6 +1,22 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -#include "docraft_lib.h" +#include "docraft/docraft_lib.h" #include namespace docraft::utils { /** diff --git a/docraft/include/utils/docraft_parser_utilis.h b/docraft/include/docraft/utils/docraft_parser_utilis.h similarity index 65% rename from docraft/include/utils/docraft_parser_utilis.h rename to docraft/include/docraft/utils/docraft_parser_utilis.h index 633399f..7c9155f 100644 --- a/docraft/include/utils/docraft_parser_utilis.h +++ b/docraft/include/docraft/utils/docraft_parser_utilis.h @@ -1,3 +1,19 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include #include diff --git a/docraft/include/docraft_lib.h b/docraft/include/docraft_lib.h deleted file mode 100644 index 9985c31..0000000 --- a/docraft/include/docraft_lib.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#if defined(_WIN32) || defined(__CYGWIN__) -#if defined(DOCRAFT_BUILD_SHARED_LIB) -#define DOCRAFT_LIB __declspec(dllexport) -#elif defined(DOCRAFT_USE_SHARED_LIB) -#define DOCRAFT_LIB __declspec(dllimport) -#else -#define DOCRAFT_LIB -#endif -#elif defined(__GNUC__) && __GNUC__ >= 4 -#if defined(DOCRAFT_BUILD_SHARED_LIB) -#define DOCRAFT_LIB __attribute__((visibility("default"))) -#else -#define DOCRAFT_LIB -#endif -#else -#define DOCRAFT_LIB -#endif diff --git a/docraft/include/model/docraft_blank_line.h b/docraft/include/model/docraft_blank_line.h deleted file mode 100644 index c7431b8..0000000 --- a/docraft/include/model/docraft_blank_line.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include "docraft_lib.h" -#include "docraft_node.h" -#include "model/i_docraft_clonable.h" - -namespace docraft::model { - /** - * @brief Blank line node used to add vertical spacing in flow layout. - */ - class DOCRAFT_LIB DocraftBlankLine : public DocraftNode, public IDocraftClonable { - public: - using DocraftNode::DocraftNode; - /** - * @brief Draws the blank line using the provided context. - */ - void draw(const std::shared_ptr &context) override; - /** - * @brief Clones the blank line node. - * @return Shared pointer to the cloned node. - */ - std::shared_ptr clone() const override; - }; -} // docraft diff --git a/docraft/include/model/docraft_body.h b/docraft/include/model/docraft_body.h deleted file mode 100644 index ae87dd2..0000000 --- a/docraft/include/model/docraft_body.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "docraft_lib.h" -#include "model/docraft_section.h" - -namespace docraft::model { - /** - * @brief Body section of the document. - */ - class DOCRAFT_LIB DocraftBody : public DocraftSection{ - public: - using DocraftSection::DocraftSection; - ~DocraftBody() override = default; - /** - * @brief Clones the body node and its children. - * @return Shared pointer to the cloned node. - */ - std::shared_ptr clone() const override; - }; -} // docraft diff --git a/docraft/include/model/docraft_clone_utils.h b/docraft/include/model/docraft_clone_utils.h deleted file mode 100644 index 1394150..0000000 --- a/docraft/include/model/docraft_clone_utils.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include -#include - -#include "model/docraft_node.h" -#include "model/i_docraft_clonable.h" - -namespace docraft::model { - std::shared_ptr clone_node(const std::shared_ptr &node); - std::vector> clone_nodes(const std::vector> &nodes); -} // namespace docraft::model diff --git a/docraft/include/model/docraft_footer.h b/docraft/include/model/docraft_footer.h deleted file mode 100644 index e7bcb26..0000000 --- a/docraft/include/model/docraft_footer.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include "docraft_lib.h" -#include - -#include "docraft_document_context.h" -#include "model/docraft_section.h" - -namespace docraft::model { - /** - * @brief Footer section of the document. - */ - class DOCRAFT_LIB DocraftFooter : public DocraftSection { - public: - /** - * @brief Creates a footer section with default margins. - */ - DocraftFooter(); - ~DocraftFooter() override = default; - /** - * @brief Clones the footer node and its children. - * @return Shared pointer to the cloned node. - */ - std::shared_ptr clone() const override; - }; -} // docraft diff --git a/docraft/include/model/docraft_header.h b/docraft/include/model/docraft_header.h deleted file mode 100644 index 5d323ef..0000000 --- a/docraft/include/model/docraft_header.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include "docraft_lib.h" -#include "docraft_section.h" - -namespace docraft::model { - /** - * @brief Header section of the document. - */ - class DOCRAFT_LIB DocraftHeader : public DocraftSection { - public: - /** - * @brief Creates a header section with default margins. - */ - DocraftHeader(); - ~DocraftHeader() override = default; - /** - * @brief Clones the header node and its children. - * @return Shared pointer to the cloned node. - */ - std::shared_ptr clone() const override; - }; -} diff --git a/docraft/include/model/docraft_new_page.h b/docraft/include/model/docraft_new_page.h deleted file mode 100644 index 8a18b5f..0000000 --- a/docraft/include/model/docraft_new_page.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include "docraft_lib.h" - -#include "docraft_node.h" -#include "model/i_docraft_clonable.h" - -namespace docraft::model { - /** - * @brief Represents a manual page break in the document. - */ - class DOCRAFT_LIB DocraftNewPage : public DocraftNode, public IDocraftClonable { - public: - using DocraftNode::DocraftNode; - DocraftNewPage() = default; - ~DocraftNewPage() override = default; - - void draw(const std::shared_ptr &/*context*/) override { - // Layout engine handles page breaks; no rendering needed. - } - - std::shared_ptr clone() const override { - return std::make_shared(*this); - } - }; -} // docraft diff --git a/docraft/include/model/docraft_page_format.h b/docraft/include/model/docraft_page_format.h deleted file mode 100644 index fd01bc4..0000000 --- a/docraft/include/model/docraft_page_format.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -namespace docraft::model { - /** - * @brief Supported page sizes. - */ - enum class DocraftPageSize { - kA4, - kA3, - kA5, - kLetter, - kLegal - }; - - /** - * @brief Page orientation. - */ - enum class DocraftPageOrientation { - kPortrait, - kLandscape - }; -} // namespace docraft::model diff --git a/docraft/include/model/i_docraft_clonable.h b/docraft/include/model/i_docraft_clonable.h deleted file mode 100644 index f6be1d9..0000000 --- a/docraft/include/model/i_docraft_clonable.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include "docraft_lib.h" - -#include - -namespace docraft::model { - class DocraftNode; - - /** - * @brief Interface for clonable Docraft nodes. - * Nodes that implement this interface can be cloned, which is useful for templating and other operations that require copying nodes. - */ - class DOCRAFT_LIB IDocraftClonable { - public: - virtual ~IDocraftClonable() = default; - /** - * @brief Creates a deep copy of the node. - * @return A shared pointer to the cloned node. - */ - virtual std::shared_ptr clone() const = 0; - }; -} // namespace docraft::model diff --git a/docraft/include/renderer/painter/docraft_circle_painter.h b/docraft/include/renderer/painter/docraft_circle_painter.h deleted file mode 100644 index d6ddc75..0000000 --- a/docraft/include/renderer/painter/docraft_circle_painter.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include "docraft_lib.h" -#include "model/docraft_circle.h" -#include "renderer/painter/i_painter.h" - -namespace docraft::renderer::painter { - /** - * @brief Painter that draws DocraftCircle nodes. - */ - class DOCRAFT_LIB DocraftCirclePainter : public IPainter { - public: - /** - * @brief Creates a circle painter bound to the circle node. - * @param circle_node Circle node. - */ - explicit DocraftCirclePainter(const model::DocraftCircle &circle_node); - /** - * @brief Draws the circle using the provided context. - * @param context Document context. - */ - void draw(const std::shared_ptr &context) override; - private: - model::DocraftCircle circle_node_; - }; -} // docraft::renderer::painter diff --git a/docraft/include/renderer/painter/docraft_line_painter.h b/docraft/include/renderer/painter/docraft_line_painter.h deleted file mode 100644 index 388325e..0000000 --- a/docraft/include/renderer/painter/docraft_line_painter.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include "docraft_lib.h" -#include "model/docraft_line.h" -#include "renderer/painter/i_painter.h" - -namespace docraft::renderer::painter { - /** - * @brief Painter that draws DocraftLine nodes. - */ - class DOCRAFT_LIB DocraftLinePainter : public IPainter { - public: - /** - * @brief Creates a line painter bound to the line node. - * @param line_node Line node. - */ - explicit DocraftLinePainter(const model::DocraftLine &line_node); - /** - * @brief Draws the line using the provided context. - * @param context Document context. - */ - void draw(const std::shared_ptr &context) override; - private: - model::DocraftLine line_node_; - }; -} // docraft::renderer::painter diff --git a/docraft/include/renderer/painter/docraft_polygon_painter.h b/docraft/include/renderer/painter/docraft_polygon_painter.h deleted file mode 100644 index 6e982ef..0000000 --- a/docraft/include/renderer/painter/docraft_polygon_painter.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include "docraft_lib.h" -#include "model/docraft_polygon.h" -#include "renderer/painter/i_painter.h" - -namespace docraft::renderer::painter { - /** - * @brief Painter that draws DocraftPolygon nodes. - */ - class DOCRAFT_LIB DocraftPolygonPainter : public IPainter { - public: - /** - * @brief Creates a polygon painter bound to the polygon node. - * @param polygon_node Polygon node. - */ - explicit DocraftPolygonPainter(const model::DocraftPolygon &polygon_node); - /** - * @brief Draws the polygon using the provided context. - * @param context Document context. - */ - void draw(const std::shared_ptr &context) override; - private: - model::DocraftPolygon polygon_node_; - }; -} // docraft::renderer::painter diff --git a/docraft/include/renderer/painter/docraft_triangle_painter.h b/docraft/include/renderer/painter/docraft_triangle_painter.h deleted file mode 100644 index ba2646d..0000000 --- a/docraft/include/renderer/painter/docraft_triangle_painter.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include "docraft_lib.h" -#include "model/docraft_triangle.h" -#include "renderer/painter/i_painter.h" - -namespace docraft::renderer::painter { - /** - * @brief Painter that draws DocraftTriangle nodes. - */ - class DOCRAFT_LIB DocraftTrianglePainter : public IPainter { - public: - /** - * @brief Creates a triangle painter bound to the triangle node. - * @param triangle_node Triangle node. - */ - explicit DocraftTrianglePainter(const model::DocraftTriangle &triangle_node); - /** - * @brief Draws the triangle using the provided context. - * @param context Document context. - */ - void draw(const std::shared_ptr &context) override; - private: - model::DocraftTriangle triangle_node_; - }; -} // docraft::renderer::painter diff --git a/docraft/include/renderer/painter/i_painter.h b/docraft/include/renderer/painter/i_painter.h deleted file mode 100644 index c446a84..0000000 --- a/docraft/include/renderer/painter/i_painter.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include "docraft_lib.h" -#include - -#include "docraft_document_context.h" - -namespace docraft::renderer::painter { - /** - * @brief Interface for painter classes responsible for drawing elements onto a PDF context. - */ - class DOCRAFT_LIB IPainter { - public: - /** - * @brief Virtual destructor. - */ - virtual ~IPainter() = default; - /** - * @brief Draws the element using the provided document context. - * @param context Document context providing backend access and state. - */ - virtual void draw(const std::shared_ptr &context) = 0; - }; -} // docraft diff --git a/docraft/include/utils/docraft_base64.h b/docraft/include/utils/docraft_base64.h deleted file mode 100644 index cfe4adc..0000000 --- a/docraft/include/utils/docraft_base64.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once -#include -#include - -namespace docraft::utils { - /** - * @brief Decodes a base64 string into raw bytes. - * @param input Base64 string (no data URI prefix). - * @return Decoded bytes. - * @throws std::invalid_argument if the input is not valid base64. - */ - std::vector decode_base64(std::string_view input); -} diff --git a/docraft/src/craft/parser/docraft_blank_line_parser.cc b/docraft/src/craft/parser/docraft_blank_line_parser.cc deleted file mode 100644 index a181e6b..0000000 --- a/docraft/src/craft/parser/docraft_blank_line_parser.cc +++ /dev/null @@ -1,12 +0,0 @@ -#include "craft/parser/docraft_parser.h" - -#include "craft/parser/docraft_parser_helpers.h" -#include "model/docraft_blank_line.h" - -namespace docraft::craft::parser { - std::shared_ptr DocraftBlackLineParser::parse(const pugi::xml_node &craft_language_source) { - auto blank = std::make_shared(); - detail::configure_docraft_node_attributes(blank, craft_language_source); - return blank; - } -} diff --git a/docraft/src/craft/parser/docraft_new_page_parser.cc b/docraft/src/craft/parser/docraft_new_page_parser.cc deleted file mode 100644 index 7596c3d..0000000 --- a/docraft/src/craft/parser/docraft_new_page_parser.cc +++ /dev/null @@ -1,12 +0,0 @@ -#include "craft/parser/docraft_parser.h" - -#include "craft/parser/docraft_parser_helpers.h" -#include "model/docraft_new_page.h" - -namespace docraft::craft::parser { - std::shared_ptr DocraftNewPageParser::parse(const pugi::xml_node &craft_language_source) { - auto page_break = std::make_shared(); - detail::configure_docraft_node_attributes(page_break, craft_language_source); - return page_break; - } -} // namespace docraft::craft::parser diff --git a/docraft/src/backend/pdf/docraft_haru_backend.cc b/docraft/src/docraft/backend/pdf/docraft_haru_backend.cc similarity index 97% rename from docraft/src/backend/pdf/docraft_haru_backend.cc rename to docraft/src/docraft/backend/pdf/docraft_haru_backend.cc index fab4310..f2fc47d 100644 --- a/docraft/src/backend/pdf/docraft_haru_backend.cc +++ b/docraft/src/docraft/backend/pdf/docraft_haru_backend.cc @@ -1,4 +1,20 @@ -#include "backend/pdf/docraft_haru_backend.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/backend/pdf/docraft_haru_backend.h" #include #include @@ -9,6 +25,8 @@ #include +#include "docraft/docraft_document_metadata.h" + namespace { struct HPDFErrorMap { std::unordered_map map; diff --git a/docraft/src/craft/docraft_craft_language_parser.cc b/docraft/src/docraft/craft/docraft_craft_language_parser.cc similarity index 96% rename from docraft/src/craft/docraft_craft_language_parser.cc rename to docraft/src/docraft/craft/docraft_craft_language_parser.cc index a29f7b2..8dee52a 100644 --- a/docraft/src/craft/docraft_craft_language_parser.cc +++ b/docraft/src/docraft/craft/docraft_craft_language_parser.cc @@ -1,5 +1,21 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + // cpp -#include "craft/docraft_craft_language_parser.h" +#include "docraft/craft/docraft_craft_language_parser.h" #include #include @@ -13,18 +29,18 @@ #include #include -#include "craft/docraft_craft_language_tokens.h" -#include "craft/parser/docraft_parser.h" -#include "model/docraft_header.h" -#include "model/docraft_body.h" -#include "model/docraft_footer.h" -#include "model/docraft_children_container_node.h" -#include "model/docraft_foreach.h" -#include "model/docraft_list.h" -#include "model/docraft_new_page.h" -#include "model/docraft_text.h" -#include "utils/docraft_keyword_extractor.h" -#include "utils/docraft_logger.h" +#include "docraft/craft/docraft_craft_language_tokens.h" +#include "docraft/craft/parser/docraft_parser.h" +#include "docraft/model/docraft_header.h" +#include "docraft/model/docraft_body.h" +#include "docraft/model/docraft_footer.h" +#include "docraft/model/docraft_children_container_node.h" +#include "docraft/model/docraft_foreach.h" +#include "docraft/model/docraft_list.h" +#include "docraft/model/docraft_new_page.h" +#include "docraft/model/docraft_text.h" +#include "docraft/utils/docraft_keyword_extractor.h" +#include "docraft/utils/docraft_logger.h" namespace { struct DocraftAutoKeywordConfig { diff --git a/docraft/src/docraft/craft/parser/docraft_blank_line_parser.cc b/docraft/src/docraft/craft/parser/docraft_blank_line_parser.cc new file mode 100644 index 0000000..dd69f2e --- /dev/null +++ b/docraft/src/docraft/craft/parser/docraft_blank_line_parser.cc @@ -0,0 +1,28 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/craft/parser/docraft_parser.h" + +#include "docraft/craft/parser/docraft_parser_helpers.h" +#include "docraft/model/docraft_blank_line.h" + +namespace docraft::craft::parser { + std::shared_ptr DocraftBlackLineParser::parse(const pugi::xml_node &craft_language_source) { + auto blank = std::make_shared(); + detail::configure_docraft_node_attributes(blank, craft_language_source); + return blank; + } +} diff --git a/docraft/src/craft/parser/docraft_circle_parser.cc b/docraft/src/docraft/craft/parser/docraft_circle_parser.cc similarity index 55% rename from docraft/src/craft/parser/docraft_circle_parser.cc rename to docraft/src/docraft/craft/parser/docraft_circle_parser.cc index 5e2b5bd..faec2fc 100644 --- a/docraft/src/craft/parser/docraft_circle_parser.cc +++ b/docraft/src/docraft/craft/parser/docraft_circle_parser.cc @@ -1,8 +1,24 @@ -#include "craft/parser/docraft_circle_parser.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -#include "craft/docraft_craft_language_tokens.h" -#include "craft/parser/docraft_parser_helpers.h" -#include "model/docraft_circle.h" +#include "docraft/craft/parser/docraft_circle_parser.h" + +#include "docraft/craft/docraft_craft_language_tokens.h" +#include "docraft/craft/parser/docraft_parser_helpers.h" +#include "docraft/model/docraft_circle.h" namespace docraft::craft::parser { std::shared_ptr DocraftCircleParser::parse(const pugi::xml_node &craft_language_source) { diff --git a/docraft/src/craft/parser/docraft_foreach_parser.cc b/docraft/src/docraft/craft/parser/docraft_foreach_parser.cc similarity index 88% rename from docraft/src/craft/parser/docraft_foreach_parser.cc rename to docraft/src/docraft/craft/parser/docraft_foreach_parser.cc index 0c7d9bb..c9ac65d 100644 --- a/docraft/src/craft/parser/docraft_foreach_parser.cc +++ b/docraft/src/docraft/craft/parser/docraft_foreach_parser.cc @@ -1,11 +1,27 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include #include #include #include -#include "craft/parser/docraft_parser.h" -#include "model/docraft_foreach.h" -#include "craft/docraft_craft_language_tokens.h" +#include "docraft/craft/parser/docraft_parser.h" +#include "docraft/model/docraft_foreach.h" +#include "docraft/craft/docraft_craft_language_tokens.h" namespace docraft::craft::parser { namespace { diff --git a/docraft/src/craft/parser/docraft_image_parser.cc b/docraft/src/docraft/craft/parser/docraft_image_parser.cc similarity index 79% rename from docraft/src/craft/parser/docraft_image_parser.cc rename to docraft/src/docraft/craft/parser/docraft_image_parser.cc index 7ee61db..6256b2d 100644 --- a/docraft/src/craft/parser/docraft_image_parser.cc +++ b/docraft/src/docraft/craft/parser/docraft_image_parser.cc @@ -1,8 +1,24 @@ -#include "craft/parser/docraft_parser.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -#include "craft/parser/docraft_parser_helpers.h" -#include "model/docraft_image.h" -#include "utils/docraft_base64.h" +#include "docraft/craft/parser/docraft_parser.h" + +#include "docraft/craft/parser/docraft_parser_helpers.h" +#include "docraft/model/docraft_image.h" +#include "docraft/utils/docraft_base64.h" #include diff --git a/docraft/src/craft/parser/docraft_layout_parser.cc b/docraft/src/docraft/craft/parser/docraft_layout_parser.cc similarity index 56% rename from docraft/src/craft/parser/docraft_layout_parser.cc rename to docraft/src/docraft/craft/parser/docraft_layout_parser.cc index 075050c..b674b5d 100644 --- a/docraft/src/craft/parser/docraft_layout_parser.cc +++ b/docraft/src/docraft/craft/parser/docraft_layout_parser.cc @@ -1,7 +1,23 @@ -#include "craft/parser/docraft_parser.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -#include "craft/parser/docraft_parser_helpers.h" -#include "model/docraft_layout.h" +#include "docraft/craft/parser/docraft_parser.h" + +#include "docraft/craft/parser/docraft_parser_helpers.h" +#include "docraft/model/docraft_layout.h" namespace docraft::craft::parser { std::shared_ptr DocraftLayoutParser::parse(const pugi::xml_node &craft_language_source) { diff --git a/docraft/src/craft/parser/docraft_line_parser.cc b/docraft/src/docraft/craft/parser/docraft_line_parser.cc similarity index 64% rename from docraft/src/craft/parser/docraft_line_parser.cc rename to docraft/src/docraft/craft/parser/docraft_line_parser.cc index 2efab64..307b7ef 100644 --- a/docraft/src/craft/parser/docraft_line_parser.cc +++ b/docraft/src/docraft/craft/parser/docraft_line_parser.cc @@ -1,8 +1,24 @@ -#include "craft/parser/docraft_line_parser.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -#include "craft/docraft_craft_language_tokens.h" -#include "craft/parser/docraft_parser_helpers.h" -#include "model/docraft_line.h" +#include "docraft/craft/parser/docraft_line_parser.h" + +#include "docraft/craft/docraft_craft_language_tokens.h" +#include "docraft/craft/parser/docraft_parser_helpers.h" +#include "docraft/model/docraft_line.h" namespace docraft::craft::parser { std::shared_ptr DocraftLineParser::parse(const pugi::xml_node &craft_language_source) { diff --git a/docraft/src/craft/parser/docraft_list_parser.cc b/docraft/src/docraft/craft/parser/docraft_list_parser.cc similarity index 74% rename from docraft/src/craft/parser/docraft_list_parser.cc rename to docraft/src/docraft/craft/parser/docraft_list_parser.cc index 59eecc5..203a412 100644 --- a/docraft/src/craft/parser/docraft_list_parser.cc +++ b/docraft/src/docraft/craft/parser/docraft_list_parser.cc @@ -1,7 +1,23 @@ -#include "craft/parser/docraft_parser.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -#include "craft/parser/docraft_parser_helpers.h" -#include "model/docraft_list.h" +#include "docraft/craft/parser/docraft_parser.h" + +#include "docraft/craft/parser/docraft_parser_helpers.h" +#include "docraft/model/docraft_list.h" namespace docraft::craft::parser { std::shared_ptr DocraftListParser::parse(const pugi::xml_node &craft_language_source) { diff --git a/docraft/src/docraft/craft/parser/docraft_new_page_parser.cc b/docraft/src/docraft/craft/parser/docraft_new_page_parser.cc new file mode 100644 index 0000000..e4266db --- /dev/null +++ b/docraft/src/docraft/craft/parser/docraft_new_page_parser.cc @@ -0,0 +1,28 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/craft/parser/docraft_parser.h" + +#include "docraft/craft/parser/docraft_parser_helpers.h" +#include "docraft/model/docraft_new_page.h" + +namespace docraft::craft::parser { + std::shared_ptr DocraftNewPageParser::parse(const pugi::xml_node &craft_language_source) { + auto page_break = std::make_shared(); + detail::configure_docraft_node_attributes(page_break, craft_language_source); + return page_break; + } +} // namespace docraft::craft::parser diff --git a/docraft/src/craft/parser/docraft_page_number_parser.cc b/docraft/src/docraft/craft/parser/docraft_page_number_parser.cc similarity index 78% rename from docraft/src/craft/parser/docraft_page_number_parser.cc rename to docraft/src/docraft/craft/parser/docraft_page_number_parser.cc index e24bdbf..04c410e 100644 --- a/docraft/src/craft/parser/docraft_page_number_parser.cc +++ b/docraft/src/docraft/craft/parser/docraft_page_number_parser.cc @@ -1,7 +1,23 @@ -#include "craft/parser/docraft_parser.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -#include "craft/parser/docraft_parser_helpers.h" -#include "model/docraft_page_number.h" +#include "docraft/craft/parser/docraft_parser.h" + +#include "docraft/craft/parser/docraft_parser_helpers.h" +#include "docraft/model/docraft_page_number.h" namespace docraft::craft::parser { std::shared_ptr DocraftPageNumberParser::parse(const pugi::xml_node &craft_language_source) { diff --git a/docraft/src/craft/parser/docraft_parser_helpers.cc b/docraft/src/docraft/craft/parser/docraft_parser_helpers.cc similarity index 92% rename from docraft/src/craft/parser/docraft_parser_helpers.cc rename to docraft/src/docraft/craft/parser/docraft_parser_helpers.cc index 87a8007..aa9a575 100644 --- a/docraft/src/craft/parser/docraft_parser_helpers.cc +++ b/docraft/src/docraft/craft/parser/docraft_parser_helpers.cc @@ -1,4 +1,20 @@ -#include "craft/parser/docraft_parser_helpers.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/craft/parser/docraft_parser_helpers.h" #include #include diff --git a/docraft/src/craft/parser/docraft_polygon_parser.cc b/docraft/src/docraft/craft/parser/docraft_polygon_parser.cc similarity index 59% rename from docraft/src/craft/parser/docraft_polygon_parser.cc rename to docraft/src/docraft/craft/parser/docraft_polygon_parser.cc index 77abbd4..58fe187 100644 --- a/docraft/src/craft/parser/docraft_polygon_parser.cc +++ b/docraft/src/docraft/craft/parser/docraft_polygon_parser.cc @@ -1,9 +1,25 @@ -#include "craft/parser/docraft_polygon_parser.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -#include "craft/docraft_craft_language_tokens.h" -#include "craft/parser/docraft_parser_helpers.h" -#include "craft/parser/docraft_shape_parser_utils.h" -#include "model/docraft_polygon.h" +#include "docraft/craft/parser/docraft_polygon_parser.h" + +#include "docraft/craft/docraft_craft_language_tokens.h" +#include "docraft/craft/parser/docraft_parser_helpers.h" +#include "docraft/craft/parser/docraft_shape_parser_utils.h" +#include "docraft/model/docraft_polygon.h" namespace docraft::craft::parser { std::shared_ptr DocraftPolygonParser::parse(const pugi::xml_node &craft_language_source) { diff --git a/docraft/src/craft/parser/docraft_rectangle_parser.cc b/docraft/src/docraft/craft/parser/docraft_rectangle_parser.cc similarity index 73% rename from docraft/src/craft/parser/docraft_rectangle_parser.cc rename to docraft/src/docraft/craft/parser/docraft_rectangle_parser.cc index d730a3e..100bfc9 100644 --- a/docraft/src/craft/parser/docraft_rectangle_parser.cc +++ b/docraft/src/docraft/craft/parser/docraft_rectangle_parser.cc @@ -1,7 +1,23 @@ -#include "craft/parser/docraft_parser.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -#include "craft/parser/docraft_parser_helpers.h" -#include "model/docraft_rectangle.h" +#include "docraft/craft/parser/docraft_parser.h" + +#include "docraft/craft/parser/docraft_parser_helpers.h" +#include "docraft/model/docraft_rectangle.h" namespace docraft::craft::parser { void DocraftRectangleParser::apply_attributes_to(const std::shared_ptr &from, diff --git a/docraft/src/craft/parser/docraft_section_parsers.cc b/docraft/src/docraft/craft/parser/docraft_section_parsers.cc similarity index 67% rename from docraft/src/craft/parser/docraft_section_parsers.cc rename to docraft/src/docraft/craft/parser/docraft_section_parsers.cc index 516aa80..8c48985 100644 --- a/docraft/src/craft/parser/docraft_section_parsers.cc +++ b/docraft/src/docraft/craft/parser/docraft_section_parsers.cc @@ -1,9 +1,25 @@ -#include "craft/parser/docraft_parser.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -#include "craft/parser/docraft_parser_helpers.h" -#include "model/docraft_body.h" -#include "model/docraft_footer.h" -#include "model/docraft_header.h" +#include "docraft/craft/parser/docraft_parser.h" + +#include "docraft/craft/parser/docraft_parser_helpers.h" +#include "docraft/model/docraft_body.h" +#include "docraft/model/docraft_footer.h" +#include "docraft/model/docraft_header.h" namespace docraft::craft::parser { std::shared_ptr DocraftHeaderParser::parse(const pugi::xml_node &craft_language_source) { diff --git a/docraft/src/craft/parser/docraft_settings_parser.cc b/docraft/src/docraft/craft/parser/docraft_settings_parser.cc similarity index 89% rename from docraft/src/craft/parser/docraft_settings_parser.cc rename to docraft/src/docraft/craft/parser/docraft_settings_parser.cc index 8eadbad..f74e20f 100644 --- a/docraft/src/craft/parser/docraft_settings_parser.cc +++ b/docraft/src/docraft/craft/parser/docraft_settings_parser.cc @@ -1,7 +1,23 @@ -#include "craft/parser/docraft_parser.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -#include "craft/parser/docraft_parser_helpers.h" -#include "model/docraft_settings.h" +#include "docraft/craft/parser/docraft_parser.h" + +#include "docraft/craft/parser/docraft_parser_helpers.h" +#include "docraft/model/docraft_settings.h" namespace docraft::craft::parser { namespace { diff --git a/docraft/src/craft/parser/docraft_shape_parser_utils.cc b/docraft/src/docraft/craft/parser/docraft_shape_parser_utils.cc similarity index 67% rename from docraft/src/craft/parser/docraft_shape_parser_utils.cc rename to docraft/src/docraft/craft/parser/docraft_shape_parser_utils.cc index 3c3ca3e..779db34 100644 --- a/docraft/src/craft/parser/docraft_shape_parser_utils.cc +++ b/docraft/src/docraft/craft/parser/docraft_shape_parser_utils.cc @@ -1,4 +1,20 @@ -#include "craft/parser/docraft_shape_parser_utils.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/craft/parser/docraft_shape_parser_utils.h" #include #include diff --git a/docraft/src/craft/parser/docraft_table_parser.cc b/docraft/src/docraft/craft/parser/docraft_table_parser.cc similarity index 95% rename from docraft/src/craft/parser/docraft_table_parser.cc rename to docraft/src/docraft/craft/parser/docraft_table_parser.cc index 552af55..8f49504 100644 --- a/docraft/src/craft/parser/docraft_table_parser.cc +++ b/docraft/src/docraft/craft/parser/docraft_table_parser.cc @@ -1,11 +1,27 @@ -#include "craft/parser/docraft_parser.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/craft/parser/docraft_parser.h" #include -#include "craft/parser/docraft_parser_helpers.h" -#include "model/docraft_image.h" -#include "model/docraft_table.h" -#include "model/docraft_text.h" +#include "docraft/craft/parser/docraft_parser_helpers.h" +#include "docraft/model/docraft_image.h" +#include "docraft/model/docraft_table.h" +#include "docraft/model/docraft_text.h" namespace docraft::craft::parser { std::shared_ptr DocraftTableParser::parse(const pugi::xml_node &craft_language_source) { diff --git a/docraft/src/craft/parser/docraft_text_parser.cc b/docraft/src/docraft/craft/parser/docraft_text_parser.cc similarity index 82% rename from docraft/src/craft/parser/docraft_text_parser.cc rename to docraft/src/docraft/craft/parser/docraft_text_parser.cc index d8e7bae..ff5a237 100644 --- a/docraft/src/craft/parser/docraft_text_parser.cc +++ b/docraft/src/docraft/craft/parser/docraft_text_parser.cc @@ -1,7 +1,23 @@ -#include "craft/parser/docraft_parser.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -#include "craft/parser/docraft_parser_helpers.h" -#include "model/docraft_text.h" +#include "docraft/craft/parser/docraft_parser.h" + +#include "docraft/craft/parser/docraft_parser_helpers.h" +#include "docraft/model/docraft_text.h" namespace docraft::craft::parser { std::shared_ptr DocraftTextParser::parse(const pugi::xml_node &craft_language_source) { diff --git a/docraft/src/craft/parser/docraft_triangle_parser.cc b/docraft/src/docraft/craft/parser/docraft_triangle_parser.cc similarity index 62% rename from docraft/src/craft/parser/docraft_triangle_parser.cc rename to docraft/src/docraft/craft/parser/docraft_triangle_parser.cc index 3886d9f..b64f350 100644 --- a/docraft/src/craft/parser/docraft_triangle_parser.cc +++ b/docraft/src/docraft/craft/parser/docraft_triangle_parser.cc @@ -1,11 +1,27 @@ -#include "craft/parser/docraft_triangle_parser.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/craft/parser/docraft_triangle_parser.h" #include -#include "craft/docraft_craft_language_tokens.h" -#include "craft/parser/docraft_parser_helpers.h" -#include "craft/parser/docraft_shape_parser_utils.h" -#include "model/docraft_triangle.h" +#include "docraft/craft/docraft_craft_language_tokens.h" +#include "docraft/craft/parser/docraft_parser_helpers.h" +#include "docraft/craft/parser/docraft_shape_parser_utils.h" +#include "docraft/model/docraft_triangle.h" namespace docraft::craft::parser { std::shared_ptr DocraftTriangleParser::parse(const pugi::xml_node &craft_language_source) { diff --git a/docraft/src/docraft_color.cc b/docraft/src/docraft/docraft_color.cc similarity index 82% rename from docraft/src/docraft_color.cc rename to docraft/src/docraft/docraft_color.cc index fd2a662..ff78341 100644 --- a/docraft/src/docraft_color.cc +++ b/docraft/src/docraft/docraft_color.cc @@ -1,11 +1,27 @@ -#include "docraft_color.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/docraft_color.h" #include #include #include #include -#include "utils/docraft_parser_utilis.h" +#include "docraft/utils/docraft_parser_utilis.h" namespace docraft { void DocraftColor::convert_known_color(ColorName name) { diff --git a/docraft/src/docraft_cursor.cc b/docraft/src/docraft/docraft_cursor.cc similarity index 65% rename from docraft/src/docraft_cursor.cc rename to docraft/src/docraft/docraft_cursor.cc index 4951046..2146cf6 100644 --- a/docraft/src/docraft_cursor.cc +++ b/docraft/src/docraft/docraft_cursor.cc @@ -1,4 +1,20 @@ -#include "docraft_cursor.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/docraft_cursor.h" #include namespace docraft { diff --git a/docraft/src/docraft_document.cc b/docraft/src/docraft/docraft_document.cc similarity index 93% rename from docraft/src/docraft_document.cc rename to docraft/src/docraft/docraft_document.cc index 931cca7..bb5a2c9 100644 --- a/docraft/src/docraft_document.cc +++ b/docraft/src/docraft/docraft_document.cc @@ -1,4 +1,20 @@ -#include "docraft_document.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/docraft_document.h" #include #include @@ -11,11 +27,11 @@ #include #include -#include "layout/docraft_layout_engine.h" -#include "layout/handler/docraft_layout_handler.h" -#include "renderer/docraft_pdf_renderer.h" -#include "utils/docraft_font_registry.h" -#include "utils/docraft_logger.h" +#include "docraft/layout/docraft_layout_engine.h" +#include "docraft/layout/handler/docraft_layout_handler.h" +#include "docraft/renderer/docraft_pdf_renderer.h" +#include "docraft/utils/docraft_font_registry.h" +#include "docraft/utils/docraft_logger.h" namespace docraft { namespace { diff --git a/docraft/src/docraft_document_context.cc b/docraft/src/docraft/docraft_document_context.cc similarity index 88% rename from docraft/src/docraft_document_context.cc rename to docraft/src/docraft/docraft_document_context.cc index fec450c..38bdf2d 100644 --- a/docraft/src/docraft_document_context.cc +++ b/docraft/src/docraft/docraft_document_context.cc @@ -1,5 +1,21 @@ -#include "docraft_document_context.h" -#include "backend/pdf/docraft_haru_backend.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/docraft_document_context.h" +#include "docraft/backend/pdf/docraft_haru_backend.h" namespace docraft { DocraftDocumentContext::DocraftDocumentContext() { @@ -82,7 +98,7 @@ namespace docraft { std::shared_ptr DocraftDocumentContext::renderer() { if (!renderer_) { - throw std::runtime_error("Renderer not set in DocraftPDFContext"); + throw std::runtime_error("docraft/renderer not set in DocraftPDFContext"); } return renderer_; } diff --git a/docraft/src/generic/docraft_font_applier.cc b/docraft/src/docraft/generic/docraft_font_applier.cc similarity index 91% rename from docraft/src/generic/docraft_font_applier.cc rename to docraft/src/docraft/generic/docraft_font_applier.cc index cd638d9..0620ce8 100644 --- a/docraft/src/generic/docraft_font_applier.cc +++ b/docraft/src/docraft/generic/docraft_font_applier.cc @@ -1,16 +1,32 @@ -#include "generic/docraft_font_applier.h" -#include "docraft_document_context.h" -#include "model/docraft_text.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/generic/docraft_font_applier.h" +#include "docraft/docraft_document_context.h" +#include "docraft/model/docraft_text.h" #include #include #include #include #include -#include "utils/docraft_font_registry.h" -#include "utils/docraft_font_resolver.h" +#include "docraft/utils/docraft_font_registry.h" +#include "docraft/utils/docraft_font_resolver.h" #include "fonts.h" -#include "utils/docraft_logger.h" +#include "docraft/utils/docraft_logger.h" namespace docraft::generic { namespace { diff --git a/docraft/src/layout/docraft_layout_engine.cc b/docraft/src/docraft/layout/docraft_layout_engine.cc similarity index 95% rename from docraft/src/layout/docraft_layout_engine.cc rename to docraft/src/docraft/layout/docraft_layout_engine.cc index 84f09d0..72e9c47 100644 --- a/docraft/src/layout/docraft_layout_engine.cc +++ b/docraft/src/docraft/layout/docraft_layout_engine.cc @@ -1,24 +1,39 @@ -#include "layout/docraft_layout_engine.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/layout/docraft_layout_engine.h" #include #include #include -#include "layout/handler/docraft_basic_layout_handler.h" -#include "layout/handler/docraft_layout_blank_line.h" -#include "layout/handler/docraft_layout_handler.h" -#include "layout/handler/docraft_layout_list_handler.h" -#include "layout/handler/docraft_layout_table_handler.h" -#include "layout/handler/docraft_layout_text_handler.h" - -#include "model/docraft_header.h" -#include "model/docraft_body.h" -#include "model/docraft_footer.h" -#include "model/docraft_list.h" -#include "model/docraft_table.h" -#include "model/docraft_foreach.h" -#include "model/docraft_new_page.h" -#include "utils/docraft_logger.h" +#include "docraft/layout/handler/docraft_basic_layout_handler.h" +#include "docraft/layout/handler/docraft_layout_blank_line.h" +#include "docraft/layout/handler/docraft_layout_handler.h" +#include "docraft/layout/handler/docraft_layout_list_handler.h" +#include "docraft/layout/handler/docraft_layout_table_handler.h" +#include "docraft/layout/handler/docraft_layout_text_handler.h" + +#include "docraft/model/docraft_header.h" +#include "docraft/model/docraft_body.h" +#include "docraft/model/docraft_footer.h" +#include "docraft/model/docraft_list.h" +#include "docraft/model/docraft_table.h" +#include "docraft/model/docraft_foreach.h" +#include "docraft/model/docraft_new_page.h" namespace { /** diff --git a/docraft/src/layout/handler/docraft_basic_layout_handler.cc b/docraft/src/docraft/layout/handler/docraft_basic_layout_handler.cc similarity index 75% rename from docraft/src/layout/handler/docraft_basic_layout_handler.cc rename to docraft/src/docraft/layout/handler/docraft_basic_layout_handler.cc index 3c2d99d..02c86f1 100644 --- a/docraft/src/layout/handler/docraft_basic_layout_handler.cc +++ b/docraft/src/docraft/layout/handler/docraft_basic_layout_handler.cc @@ -1,11 +1,27 @@ -#include "layout/handler/docraft_basic_layout_handler.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/layout/handler/docraft_basic_layout_handler.h" #include -#include "layout/docraft_layout_engine.h" -#include "model/docraft_layout.h" -#include "model/docraft_rectangle.h" -#include "model/docraft_section.h" +#include "docraft/layout/docraft_layout_engine.h" +#include "docraft/model/docraft_layout.h" +#include "docraft/model/docraft_rectangle.h" +#include "docraft/model/docraft_section.h" namespace docraft::layout::handler { void DocraftBasicLayoutHandler::compute(const std::shared_ptr &node, diff --git a/docraft/src/layout/handler/docraft_layout_blank_line.cc b/docraft/src/docraft/layout/handler/docraft_layout_blank_line.cc similarity index 63% rename from docraft/src/layout/handler/docraft_layout_blank_line.cc rename to docraft/src/docraft/layout/handler/docraft_layout_blank_line.cc index a1336ae..d7bf4d0 100644 --- a/docraft/src/layout/handler/docraft_layout_blank_line.cc +++ b/docraft/src/docraft/layout/handler/docraft_layout_blank_line.cc @@ -1,4 +1,20 @@ -#include "layout/handler/docraft_layout_blank_line.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/layout/handler/docraft_layout_blank_line.h" namespace docraft::layout::handler { void DocraftLayoutBlankLine::compute(const std::shared_ptr &node, diff --git a/docraft/src/layout/handler/docraft_layout_handler.cc b/docraft/src/docraft/layout/handler/docraft_layout_handler.cc similarity index 60% rename from docraft/src/layout/handler/docraft_layout_handler.cc rename to docraft/src/docraft/layout/handler/docraft_layout_handler.cc index 7806f24..96663c8 100644 --- a/docraft/src/layout/handler/docraft_layout_handler.cc +++ b/docraft/src/docraft/layout/handler/docraft_layout_handler.cc @@ -1,7 +1,23 @@ -#include "layout/handler/docraft_layout_handler.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/layout/handler/docraft_layout_handler.h" #include -#include "layout/docraft_layout_engine.h" +#include "docraft/layout/docraft_layout_engine.h" #define PADDING 20.0F namespace docraft::layout::handler { diff --git a/docraft/src/layout/handler/docraft_layout_list_handler.cc b/docraft/src/docraft/layout/handler/docraft_layout_list_handler.cc similarity index 87% rename from docraft/src/layout/handler/docraft_layout_list_handler.cc rename to docraft/src/docraft/layout/handler/docraft_layout_list_handler.cc index e0d2041..7fa4eb7 100644 --- a/docraft/src/layout/handler/docraft_layout_list_handler.cc +++ b/docraft/src/docraft/layout/handler/docraft_layout_list_handler.cc @@ -1,10 +1,26 @@ -#include "layout/handler/docraft_layout_list_handler.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/layout/handler/docraft_layout_list_handler.h" #include #include -#include "generic/docraft_font_applier.h" -#include "model/docraft_text.h" +#include "docraft/generic/docraft_font_applier.h" +#include "docraft/model/docraft_text.h" namespace docraft::layout::handler { void DocraftLayoutListHandler::compute(const std::shared_ptr &node, diff --git a/docraft/src/layout/handler/docraft_layout_table_handler.cc b/docraft/src/docraft/layout/handler/docraft_layout_table_handler.cc similarity index 96% rename from docraft/src/layout/handler/docraft_layout_table_handler.cc rename to docraft/src/docraft/layout/handler/docraft_layout_table_handler.cc index b2ca83f..59b684d 100644 --- a/docraft/src/layout/handler/docraft_layout_table_handler.cc +++ b/docraft/src/docraft/layout/handler/docraft_layout_table_handler.cc @@ -1,14 +1,30 @@ -#include "layout/handler/docraft_layout_table_handler.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/layout/handler/docraft_layout_table_handler.h" #include #include #include #include -#include "layout/docraft_layout_engine.h" -#include "model/docraft_layout.h" -#include "model/docraft_text.h" -#include "utils/docraft_logger.h" +#include "docraft/layout/docraft_layout_engine.h" +#include "docraft/model/docraft_layout.h" +#include "docraft/model/docraft_text.h" +#include "docraft/utils/docraft_logger.h" namespace docraft::layout::handler { namespace { diff --git a/docraft/src/layout/handler/docraft_layout_text_handler.cc b/docraft/src/docraft/layout/handler/docraft_layout_text_handler.cc similarity index 90% rename from docraft/src/layout/handler/docraft_layout_text_handler.cc rename to docraft/src/docraft/layout/handler/docraft_layout_text_handler.cc index 3cfc60d..475e986 100644 --- a/docraft/src/layout/handler/docraft_layout_text_handler.cc +++ b/docraft/src/docraft/layout/handler/docraft_layout_text_handler.cc @@ -1,13 +1,29 @@ -#include "layout/handler/docraft_layout_text_handler.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/layout/handler/docraft_layout_text_handler.h" #include #include #include -#include "generic/docraft_font_applier.h" -#include "model/docraft_layout.h" -#include "model/docraft_page_number.h" -#include "utils/docraft_logger.h" +#include "docraft/generic/docraft_font_applier.h" +#include "docraft/model/docraft_layout.h" +#include "docraft/model/docraft_page_number.h" +#include "docraft/utils/docraft_logger.h" namespace docraft::layout::handler { diff --git a/docraft/src/main.cpp b/docraft/src/docraft/main.cpp similarity index 94% rename from docraft/src/main.cpp rename to docraft/src/docraft/main.cpp index f63b928..3a373f3 100644 --- a/docraft/src/main.cpp +++ b/docraft/src/docraft/main.cpp @@ -1,3 +1,19 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include #include #include @@ -10,11 +26,11 @@ #include #include -#include "craft/docraft_craft_language_parser.h" -#include "docraft_document.h" -#include "templating/docraft_template_engine.h" +#include "docraft/craft/docraft_craft_language_parser.h" +#include "docraft/docraft_document.h" +#include "docraft/templating/docraft_template_engine.h" #include "nlohmann/json.hpp" -#include "utils/docraft_logger.h" +#include "docraft/utils/docraft_logger.h" using json = nlohmann::json; @@ -303,7 +319,7 @@ int main(int argc, char *argv[]) { const CliOptions options = parse_args(argc, argv); if (!std::filesystem::exists(options.craft_file)) { - throw std::runtime_error("Craft file not found: " + options.craft_file.string()); + throw std::runtime_error("docraft/craft file not found: " + options.craft_file.string()); } docraft::craft::DocraftCraftLanguageParser parser; diff --git a/docraft/src/docraft/model/docraft_blank_line.cc b/docraft/src/docraft/model/docraft_blank_line.cc new file mode 100644 index 0000000..8a1d08c --- /dev/null +++ b/docraft/src/docraft/model/docraft_blank_line.cc @@ -0,0 +1,34 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_blank_line.h" + +#include + +#include "docraft/renderer/docraft_renderer.h" + +namespace docraft::model { + void DocraftBlankLine::draw(const std::shared_ptr &context) { + // An empty line does not render anything, but we can log its presence if needed + context->renderer()->render_blank_line(*this); + // std::cout << "Drawing an empty line at position (" << x() << ", " << y() << ")\n"; + + } + + std::shared_ptr DocraftBlankLine::clone() const { + return std::make_shared(*this); + } +} // docraft diff --git a/docraft/src/docraft/model/docraft_body.cc b/docraft/src/docraft/model/docraft_body.cc new file mode 100644 index 0000000..11f43d6 --- /dev/null +++ b/docraft/src/docraft/model/docraft_body.cc @@ -0,0 +1,31 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_body.h" + +#include "docraft/model/docraft_clone_utils.h" + +namespace docraft::model{ + + std::shared_ptr DocraftBody::clone() const { + auto copy = std::make_shared(*this); + copy->clear_children(); + for (const auto &child : children()) { + copy->add_child(clone_node(child)); + } + return copy; + } +} // docraft diff --git a/docraft/src/model/docraft_children_container_node.cc b/docraft/src/docraft/model/docraft_children_container_node.cc similarity index 81% rename from docraft/src/model/docraft_children_container_node.cc rename to docraft/src/docraft/model/docraft_children_container_node.cc index 5aa3663..137b61e 100644 --- a/docraft/src/model/docraft_children_container_node.cc +++ b/docraft/src/docraft/model/docraft_children_container_node.cc @@ -1,4 +1,20 @@ -#include "model/docraft_children_container_node.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_children_container_node.h" #include #include diff --git a/docraft/src/model/docraft_circle.cc b/docraft/src/docraft/model/docraft_circle.cc similarity index 56% rename from docraft/src/model/docraft_circle.cc rename to docraft/src/docraft/model/docraft_circle.cc index 419b6e2..7cdaf8a 100644 --- a/docraft/src/model/docraft_circle.cc +++ b/docraft/src/docraft/model/docraft_circle.cc @@ -1,7 +1,23 @@ -#include "model/docraft_circle.h" - -#include "renderer/docraft_renderer.h" -#include "utils/docraft_logger.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_circle.h" + +#include "docraft/renderer/docraft_renderer.h" +#include "docraft/utils/docraft_logger.h" namespace docraft::model { void DocraftCircle::draw(const std::shared_ptr &context) { diff --git a/docraft/src/model/docraft_clone_utils.cc b/docraft/src/docraft/model/docraft_clone_utils.cc similarity index 54% rename from docraft/src/model/docraft_clone_utils.cc rename to docraft/src/docraft/model/docraft_clone_utils.cc index b38ae73..4829d83 100644 --- a/docraft/src/model/docraft_clone_utils.cc +++ b/docraft/src/docraft/model/docraft_clone_utils.cc @@ -1,4 +1,20 @@ -#include "model/docraft_clone_utils.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_clone_utils.h" #include diff --git a/docraft/src/docraft/model/docraft_footer.cc b/docraft/src/docraft/model/docraft_footer.cc new file mode 100644 index 0000000..c190357 --- /dev/null +++ b/docraft/src/docraft/model/docraft_footer.cc @@ -0,0 +1,36 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_footer.h" + +#include + +#include "docraft/model/docraft_clone_utils.h" + +namespace docraft::model { + DocraftFooter::DocraftFooter() { + set_name("footer"); + } + + std::shared_ptr DocraftFooter::clone() const { + auto copy = std::make_shared(*this); + copy->clear_children(); + for (const auto &child : children()) { + copy->add_child(clone_node(child)); + } + return copy; + } +} // docraft diff --git a/docraft/src/model/docraft_foreach.cc b/docraft/src/docraft/model/docraft_foreach.cc similarity index 58% rename from docraft/src/model/docraft_foreach.cc rename to docraft/src/docraft/model/docraft_foreach.cc index 54415c9..fd92ad3 100644 --- a/docraft/src/model/docraft_foreach.cc +++ b/docraft/src/docraft/model/docraft_foreach.cc @@ -1,10 +1,26 @@ -#include "model/docraft_foreach.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -#include "model/docraft_clone_utils.h" +#include "docraft/model/docraft_foreach.h" + +#include "docraft/model/docraft_clone_utils.h" namespace docraft::model { void DocraftForeach::draw(const std::shared_ptr &context) { - //render the children for each item in the collection specified by the "model" attribute, using template variables for the current item + //render the children for each item in the collection specified by the "docraft/model" attribute, using template variables for the current item draw_children(context); } diff --git a/docraft/src/docraft/model/docraft_header.cc b/docraft/src/docraft/model/docraft_header.cc new file mode 100644 index 0000000..22b8177 --- /dev/null +++ b/docraft/src/docraft/model/docraft_header.cc @@ -0,0 +1,35 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_header.h" +#include + +#include "docraft/model/docraft_clone_utils.h" + +namespace docraft::model { + DocraftHeader::DocraftHeader() { + set_name("header"); + } + + std::shared_ptr DocraftHeader::clone() const { + auto copy = std::make_shared(*this); + copy->clear_children(); + for (const auto &child : children()) { + copy->add_child(clone_node(child)); + } + return copy; + } +} diff --git a/docraft/src/model/docraft_image.cc b/docraft/src/docraft/model/docraft_image.cc similarity index 80% rename from docraft/src/model/docraft_image.cc rename to docraft/src/docraft/model/docraft_image.cc index bab4a0a..8d6a7d8 100644 --- a/docraft/src/model/docraft_image.cc +++ b/docraft/src/docraft/model/docraft_image.cc @@ -1,6 +1,22 @@ -#include "model/docraft_image.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -#include "renderer/docraft_renderer.h" +#include "docraft/model/docraft_image.h" + +#include "docraft/renderer/docraft_renderer.h" namespace docraft::model { DocraftImage::DocraftImage(){ diff --git a/docraft/src/model/docraft_layout.cc b/docraft/src/docraft/model/docraft_layout.cc similarity index 71% rename from docraft/src/model/docraft_layout.cc rename to docraft/src/docraft/model/docraft_layout.cc index 23965c3..9d7db91 100644 --- a/docraft/src/model/docraft_layout.cc +++ b/docraft/src/docraft/model/docraft_layout.cc @@ -1,12 +1,28 @@ -#include "model/docraft_layout.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_layout.h" #include #include #include #include -#include "model/docraft_clone_utils.h" -#include "utils/docraft_logger.h" +#include "docraft/model/docraft_clone_utils.h" +#include "docraft/utils/docraft_logger.h" namespace docraft::model { DocraftLayout::DocraftLayout(DocraftLayout *node) : DocraftChildrenContainerNode(node), diff --git a/docraft/src/model/docraft_line.cc b/docraft/src/docraft/model/docraft_line.cc similarity index 58% rename from docraft/src/model/docraft_line.cc rename to docraft/src/docraft/model/docraft_line.cc index d1771b7..9ce77a0 100644 --- a/docraft/src/model/docraft_line.cc +++ b/docraft/src/docraft/model/docraft_line.cc @@ -1,7 +1,23 @@ -#include "model/docraft_line.h" - -#include "renderer/docraft_renderer.h" -#include "utils/docraft_logger.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_line.h" + +#include "docraft/renderer/docraft_renderer.h" +#include "docraft/utils/docraft_logger.h" namespace docraft::model { void DocraftLine::draw(const std::shared_ptr &context) { diff --git a/docraft/src/model/docraft_list.cc b/docraft/src/docraft/model/docraft_list.cc similarity index 90% rename from docraft/src/model/docraft_list.cc rename to docraft/src/docraft/model/docraft_list.cc index 6275ee3..a541121 100644 --- a/docraft/src/model/docraft_list.cc +++ b/docraft/src/docraft/model/docraft_list.cc @@ -1,9 +1,25 @@ -#include "model/docraft_list.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_list.h" #include -#include "model/docraft_clone_utils.h" -#include "renderer/docraft_renderer.h" +#include "docraft/model/docraft_clone_utils.h" +#include "docraft/renderer/docraft_renderer.h" namespace docraft::model { void DocraftList::draw(const std::shared_ptr &context) { diff --git a/docraft/src/docraft/model/docraft_new_page.cc b/docraft/src/docraft/model/docraft_new_page.cc new file mode 100644 index 0000000..3377986 --- /dev/null +++ b/docraft/src/docraft/model/docraft_new_page.cc @@ -0,0 +1,21 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_new_page.h" + +namespace docraft::model { + // Intentionally empty; behavior is handled in layout. +} // docraft diff --git a/docraft/src/model/docraft_node.cc b/docraft/src/docraft/model/docraft_node.cc similarity index 84% rename from docraft/src/model/docraft_node.cc rename to docraft/src/docraft/model/docraft_node.cc index 1439352..c5c06f1 100644 --- a/docraft/src/model/docraft_node.cc +++ b/docraft/src/docraft/model/docraft_node.cc @@ -1,4 +1,20 @@ -#include "model/docraft_node.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_node.h" #include #include diff --git a/docraft/src/model/docraft_page_number.cc b/docraft/src/docraft/model/docraft_page_number.cc similarity index 63% rename from docraft/src/model/docraft_page_number.cc rename to docraft/src/docraft/model/docraft_page_number.cc index 62d053b..e41e248 100644 --- a/docraft/src/model/docraft_page_number.cc +++ b/docraft/src/docraft/model/docraft_page_number.cc @@ -1,11 +1,27 @@ -#include "model/docraft_page_number.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_page_number.h" #include #include -#include "backend/docraft_page_rendering_backend.h" -#include "model/docraft_clone_utils.h" -#include "renderer/docraft_renderer.h" +#include "docraft/backend/docraft_page_rendering_backend.h" +#include "docraft/model/docraft_clone_utils.h" +#include "docraft/renderer/docraft_renderer.h" namespace docraft::model { DocraftPageNumber::DocraftPageNumber() { diff --git a/docraft/src/docraft/model/docraft_paragraph.cc b/docraft/src/docraft/model/docraft_paragraph.cc new file mode 100644 index 0000000..898932b --- /dev/null +++ b/docraft/src/docraft/model/docraft_paragraph.cc @@ -0,0 +1,31 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// +// Created by Matteo on 29/12/25. +// + +#include "docraft/model/docraft_paragraph.h" + +namespace docraft::model { + void DocraftParagraph::draw(const std::shared_ptr &context) { + (void)context; + } + + std::shared_ptr DocraftParagraph::clone() const { + return std::make_shared(*this); + } +} // namespace docraft::model diff --git a/docraft/src/model/docraft_polygon.cc b/docraft/src/docraft/model/docraft_polygon.cc similarity index 61% rename from docraft/src/model/docraft_polygon.cc rename to docraft/src/docraft/model/docraft_polygon.cc index a1a7851..dde275a 100644 --- a/docraft/src/model/docraft_polygon.cc +++ b/docraft/src/docraft/model/docraft_polygon.cc @@ -1,7 +1,23 @@ -#include "model/docraft_polygon.h" - -#include "renderer/docraft_renderer.h" -#include "utils/docraft_logger.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_polygon.h" + +#include "docraft/renderer/docraft_renderer.h" +#include "docraft/utils/docraft_logger.h" namespace docraft::model { void DocraftPolygon::draw(const std::shared_ptr &context) { diff --git a/docraft/src/model/docraft_position.cc b/docraft/src/docraft/model/docraft_position.cc similarity index 84% rename from docraft/src/model/docraft_position.cc rename to docraft/src/docraft/model/docraft_position.cc index b849892..fe8ee88 100644 --- a/docraft/src/model/docraft_position.cc +++ b/docraft/src/docraft/model/docraft_position.cc @@ -1,9 +1,25 @@ -#include "model/docraft_position.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_position.h" #include #include -#include "utils/docraft_logger.h" +#include "docraft/utils/docraft_logger.h" namespace docraft::model { #pragma region DocraftPoint diff --git a/docraft/src/model/docraft_rectangle.cc b/docraft/src/docraft/model/docraft_rectangle.cc similarity index 69% rename from docraft/src/model/docraft_rectangle.cc rename to docraft/src/docraft/model/docraft_rectangle.cc index 0f872a4..af2c7f0 100644 --- a/docraft/src/model/docraft_rectangle.cc +++ b/docraft/src/docraft/model/docraft_rectangle.cc @@ -1,11 +1,27 @@ -#include "model/docraft_rectangle.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_rectangle.h" #include #include -#include "model/docraft_clone_utils.h" -#include "renderer/docraft_renderer.h" -#include "utils/docraft_logger.h" +#include "docraft/model/docraft_clone_utils.h" +#include "docraft/renderer/docraft_renderer.h" +#include "docraft/utils/docraft_logger.h" namespace docraft::model { void DocraftRectangle::draw(const std::shared_ptr &context) { diff --git a/docraft/src/model/docraft_section.cc b/docraft/src/docraft/model/docraft_section.cc similarity index 73% rename from docraft/src/model/docraft_section.cc rename to docraft/src/docraft/model/docraft_section.cc index 44b3d1e..6549b06 100644 --- a/docraft/src/model/docraft_section.cc +++ b/docraft/src/docraft/model/docraft_section.cc @@ -1,7 +1,23 @@ -#include "model/docraft_section.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -#include "model/docraft_clone_utils.h" -#include "renderer/docraft_renderer.h" +#include "docraft/model/docraft_section.h" + +#include "docraft/model/docraft_clone_utils.h" +#include "docraft/renderer/docraft_renderer.h" namespace docraft::model { DocraftSection::DocraftSection() { diff --git a/docraft/src/model/docraft_settings.cc b/docraft/src/docraft/model/docraft_settings.cc similarity index 73% rename from docraft/src/model/docraft_settings.cc rename to docraft/src/docraft/model/docraft_settings.cc index 9810afe..50e5986 100644 --- a/docraft/src/model/docraft_settings.cc +++ b/docraft/src/docraft/model/docraft_settings.cc @@ -1,4 +1,20 @@ -#include "model/docraft_settings.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_settings.h" #include diff --git a/docraft/src/model/docraft_table.cc b/docraft/src/docraft/model/docraft_table.cc similarity index 96% rename from docraft/src/model/docraft_table.cc rename to docraft/src/docraft/model/docraft_table.cc index 41ca721..b65f9e7 100644 --- a/docraft/src/model/docraft_table.cc +++ b/docraft/src/docraft/model/docraft_table.cc @@ -1,13 +1,29 @@ -#include "model/docraft_table.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_table.h" #include #include #include -#include "model/docraft_clone_utils.h" -#include "renderer/docraft_pdf_renderer.h" -#include "utils/docraft_base64.h" -#include "utils/docraft_parser_utilis.h" +#include "docraft/model/docraft_clone_utils.h" +#include "docraft/renderer/docraft_pdf_renderer.h" +#include "docraft/utils/docraft_base64.h" +#include "docraft/utils/docraft_parser_utilis.h" namespace docraft::model { namespace { @@ -397,7 +413,7 @@ namespace docraft::model { const std::string &DocraftTable::model_template() const { if (!model_template_.has_value()) { - throw std::runtime_error("Model template not set"); + throw std::runtime_error("docraft/model template not set"); } return *model_template_; } diff --git a/docraft/src/model/docraft_text.cc b/docraft/src/docraft/model/docraft_text.cc similarity index 84% rename from docraft/src/model/docraft_text.cc rename to docraft/src/docraft/model/docraft_text.cc index 5862b85..adca7c3 100644 --- a/docraft/src/model/docraft_text.cc +++ b/docraft/src/docraft/model/docraft_text.cc @@ -1,11 +1,27 @@ -#include "model/docraft_text.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_text.h" #include #include #include -#include "model/docraft_clone_utils.h" -#include "renderer/docraft_renderer.h" +#include "docraft/model/docraft_clone_utils.h" +#include "docraft/renderer/docraft_renderer.h" namespace docraft::model { DocraftText::DocraftText() { set_padding(kDefaultTextPadding); diff --git a/docraft/src/model/docraft_triangle.cc b/docraft/src/docraft/model/docraft_triangle.cc similarity index 63% rename from docraft/src/model/docraft_triangle.cc rename to docraft/src/docraft/model/docraft_triangle.cc index aadc2b3..b75d8be 100644 --- a/docraft/src/model/docraft_triangle.cc +++ b/docraft/src/docraft/model/docraft_triangle.cc @@ -1,9 +1,25 @@ -#include "model/docraft_triangle.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/model/docraft_triangle.h" #include -#include "renderer/docraft_renderer.h" -#include "utils/docraft_logger.h" +#include "docraft/renderer/docraft_renderer.h" +#include "docraft/utils/docraft_logger.h" namespace docraft::model { void DocraftTriangle::draw(const std::shared_ptr &context) { diff --git a/docraft/src/renderer/docraft_pdf_renderer.cc b/docraft/src/docraft/renderer/docraft_pdf_renderer.cc similarity index 78% rename from docraft/src/renderer/docraft_pdf_renderer.cc rename to docraft/src/docraft/renderer/docraft_pdf_renderer.cc index bf65427..9e16568 100644 --- a/docraft/src/renderer/docraft_pdf_renderer.cc +++ b/docraft/src/docraft/renderer/docraft_pdf_renderer.cc @@ -1,17 +1,33 @@ -#include "renderer/docraft_pdf_renderer.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/renderer/docraft_pdf_renderer.h" #include -#include "renderer/painter/docraft_image_painter.h" -#include "docraft_color.h" -#include "renderer/painter/docraft_blank_line_painter.h" -#include "renderer/painter/docraft_circle_painter.h" -#include "renderer/painter/docraft_line_painter.h" -#include "renderer/painter/docraft_polygon_painter.h" -#include "renderer/painter/docraft_rectangle_painter.h" -#include "renderer/painter/docraft_table_painter.h" -#include "renderer/painter/docraft_text_painter.h" -#include "renderer/painter/docraft_triangle_painter.h" +#include "docraft/renderer/painter/docraft_image_painter.h" +#include "docraft/docraft_color.h" +#include "docraft/renderer/painter/docraft_blank_line_painter.h" +#include "docraft/renderer/painter/docraft_circle_painter.h" +#include "docraft/renderer/painter/docraft_line_painter.h" +#include "docraft/renderer/painter/docraft_polygon_painter.h" +#include "docraft/renderer/painter/docraft_rectangle_painter.h" +#include "docraft/renderer/painter/docraft_table_painter.h" +#include "docraft/renderer/painter/docraft_text_painter.h" +#include "docraft/renderer/painter/docraft_triangle_painter.h" namespace docraft::renderer { void DocraftPDFRenderer::render_text(const model::DocraftText &text_node) { diff --git a/docraft/src/docraft/renderer/painter/docraft_blank_line_painter.cc b/docraft/src/docraft/renderer/painter/docraft_blank_line_painter.cc new file mode 100644 index 0000000..4867039 --- /dev/null +++ b/docraft/src/docraft/renderer/painter/docraft_blank_line_painter.cc @@ -0,0 +1,27 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/renderer/painter/docraft_blank_line_painter.h" + +namespace docraft::renderer::painter { + docraft_blank_line_painter::docraft_blank_line_painter(const model::DocraftBlankLine &blank_line_node) : blank_line_node_( + blank_line_node) { + } + + void docraft_blank_line_painter::draw(const std::shared_ptr &context) { + // Blank line does not render anything + } +} // docraft diff --git a/docraft/src/renderer/painter/docraft_circle_painter.cc b/docraft/src/docraft/renderer/painter/docraft_circle_painter.cc similarity index 70% rename from docraft/src/renderer/painter/docraft_circle_painter.cc rename to docraft/src/docraft/renderer/painter/docraft_circle_painter.cc index d08ba32..c669df5 100644 --- a/docraft/src/renderer/painter/docraft_circle_painter.cc +++ b/docraft/src/docraft/renderer/painter/docraft_circle_painter.cc @@ -1,8 +1,24 @@ -#include "renderer/painter/docraft_circle_painter.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/renderer/painter/docraft_circle_painter.h" #include -#include +#include "docraft/backend/docraft_shape_rendering_backend.h" namespace docraft::renderer::painter { DocraftCirclePainter::DocraftCirclePainter(const model::DocraftCircle &circle_node) : circle_node_(circle_node) { diff --git a/docraft/src/renderer/painter/docraft_image_painter.cc b/docraft/src/docraft/renderer/painter/docraft_image_painter.cc similarity index 72% rename from docraft/src/renderer/painter/docraft_image_painter.cc rename to docraft/src/docraft/renderer/painter/docraft_image_painter.cc index 23f977a..8a63a2b 100644 --- a/docraft/src/renderer/painter/docraft_image_painter.cc +++ b/docraft/src/docraft/renderer/painter/docraft_image_painter.cc @@ -1,8 +1,24 @@ -#include "renderer/painter/docraft_image_painter.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/renderer/painter/docraft_image_painter.h" #include -#include "backend/docraft_image_rendering_backend.h" +#include "docraft/backend/docraft_image_rendering_backend.h" namespace docraft::renderer::painter { DocraftImagePainter::DocraftImagePainter(const model::DocraftImage &image_node) : image_node_(image_node) { diff --git a/docraft/src/renderer/painter/docraft_line_painter.cc b/docraft/src/docraft/renderer/painter/docraft_line_painter.cc similarity index 63% rename from docraft/src/renderer/painter/docraft_line_painter.cc rename to docraft/src/docraft/renderer/painter/docraft_line_painter.cc index 6187c5f..d4f3393 100644 --- a/docraft/src/renderer/painter/docraft_line_painter.cc +++ b/docraft/src/docraft/renderer/painter/docraft_line_painter.cc @@ -1,6 +1,22 @@ -#include "renderer/painter/docraft_line_painter.h" - -#include +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/renderer/painter/docraft_line_painter.h" + +#include "docraft/backend/docraft_shape_rendering_backend.h" namespace docraft::renderer::painter { DocraftLinePainter::DocraftLinePainter(const model::DocraftLine &line_node) : line_node_(line_node) { diff --git a/docraft/src/renderer/painter/docraft_polygon_painter.cc b/docraft/src/docraft/renderer/painter/docraft_polygon_painter.cc similarity index 72% rename from docraft/src/renderer/painter/docraft_polygon_painter.cc rename to docraft/src/docraft/renderer/painter/docraft_polygon_painter.cc index aef4f86..d81d97b 100644 --- a/docraft/src/renderer/painter/docraft_polygon_painter.cc +++ b/docraft/src/docraft/renderer/painter/docraft_polygon_painter.cc @@ -1,6 +1,22 @@ -#include "renderer/painter/docraft_polygon_painter.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -#include +#include "docraft/renderer/painter/docraft_polygon_painter.h" + +#include "docraft/backend/docraft_shape_rendering_backend.h" namespace docraft::renderer::painter { DocraftPolygonPainter::DocraftPolygonPainter(const model::DocraftPolygon &polygon_node) : polygon_node_(polygon_node) { diff --git a/docraft/src/renderer/painter/docraft_rectangle_painter.cc b/docraft/src/docraft/renderer/painter/docraft_rectangle_painter.cc similarity index 75% rename from docraft/src/renderer/painter/docraft_rectangle_painter.cc rename to docraft/src/docraft/renderer/painter/docraft_rectangle_painter.cc index 1cf8c77..d8fb4ba 100644 --- a/docraft/src/renderer/painter/docraft_rectangle_painter.cc +++ b/docraft/src/docraft/renderer/painter/docraft_rectangle_painter.cc @@ -1,6 +1,22 @@ -#include "renderer/painter/docraft_rectangle_painter.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -#include +#include "docraft/renderer/painter/docraft_rectangle_painter.h" + +#include "docraft/backend/docraft_shape_rendering_backend.h" namespace docraft::renderer::painter { DocraftRectanglePainter::DocraftRectanglePainter(const model::DocraftRectangle &rectangle_node) : rectangle_node_( diff --git a/docraft/src/renderer/painter/docraft_table_painter.cc b/docraft/src/docraft/renderer/painter/docraft_table_painter.cc similarity index 93% rename from docraft/src/renderer/painter/docraft_table_painter.cc rename to docraft/src/docraft/renderer/painter/docraft_table_painter.cc index 8b89053..f988cdc 100644 --- a/docraft/src/renderer/painter/docraft_table_painter.cc +++ b/docraft/src/docraft/renderer/painter/docraft_table_painter.cc @@ -1,10 +1,25 @@ -#include "renderer/painter/docraft_table_painter.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/renderer/painter/docraft_table_painter.h" #include -#include +#include "docraft/backend/docraft_line_rendering_backend.h" -#include "generic/docraft_font_applier.h" -#include "renderer/painter/docraft_image_painter.h" -#include "utils/docraft_logger.h" +#include "docraft/renderer/painter/docraft_image_painter.h" +#include "docraft/utils/docraft_logger.h" namespace docraft::renderer::painter { DocraftTablePainter::DocraftTablePainter(const model::DocraftTable &table_node) : table_node_(table_node) { diff --git a/docraft/src/renderer/painter/docraft_text_painter.cc b/docraft/src/docraft/renderer/painter/docraft_text_painter.cc similarity index 86% rename from docraft/src/renderer/painter/docraft_text_painter.cc rename to docraft/src/docraft/renderer/painter/docraft_text_painter.cc index 774a086..6e82b58 100644 --- a/docraft/src/renderer/painter/docraft_text_painter.cc +++ b/docraft/src/docraft/renderer/painter/docraft_text_painter.cc @@ -1,10 +1,26 @@ -#include "renderer/painter/docraft_text_painter.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/renderer/painter/docraft_text_painter.h" #include #include #include -#include "generic/docraft_font_applier.h" +#include "docraft/generic/docraft_font_applier.h" #define WORD_SPACE_MAX 300 #define WORD_SPACE_MIN -30 diff --git a/docraft/src/renderer/painter/docraft_triangle_painter.cc b/docraft/src/docraft/renderer/painter/docraft_triangle_painter.cc similarity index 72% rename from docraft/src/renderer/painter/docraft_triangle_painter.cc rename to docraft/src/docraft/renderer/painter/docraft_triangle_painter.cc index 0aeeffd..f2e0766 100644 --- a/docraft/src/renderer/painter/docraft_triangle_painter.cc +++ b/docraft/src/docraft/renderer/painter/docraft_triangle_painter.cc @@ -1,6 +1,22 @@ -#include "renderer/painter/docraft_triangle_painter.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -#include +#include "docraft/renderer/painter/docraft_triangle_painter.h" + +#include "docraft/backend/docraft_shape_rendering_backend.h" namespace docraft::renderer::painter { DocraftTrianglePainter::DocraftTrianglePainter(const model::DocraftTriangle &triangle_node) : triangle_node_(triangle_node) { diff --git a/docraft/src/templating/docraft_template_engine.cc b/docraft/src/docraft/templating/docraft_template_engine.cc similarity index 91% rename from docraft/src/templating/docraft_template_engine.cc rename to docraft/src/docraft/templating/docraft_template_engine.cc index 5a0e2f5..7b15d1c 100644 --- a/docraft/src/templating/docraft_template_engine.cc +++ b/docraft/src/docraft/templating/docraft_template_engine.cc @@ -1,26 +1,42 @@ +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + // // Created by Matteo on 17/02/26. // -#include "templating/docraft_template_engine.h" +#include "docraft/templating/docraft_template_engine.h" #include #include #include #include -#include "docraft_color.h" -#include "model/docraft_children_container_node.h" -#include "model/docraft_clone_utils.h" -#include "model/docraft_foreach.h" -#include "model/docraft_image.h" -#include "model/docraft_list.h" -#include "model/docraft_rectangle.h" -#include "model/docraft_table.h" -#include "model/docraft_text.h" -#include "utils/docraft_logger.h" -#include "utils/docraft_base64.h" -#include "utils/docraft_parser_utilis.h" +#include "docraft/docraft_color.h" +#include "docraft/model/docraft_children_container_node.h" +#include "docraft/model/docraft_clone_utils.h" +#include "docraft/model/docraft_foreach.h" +#include "docraft/model/docraft_image.h" +#include "docraft/model/docraft_list.h" +#include "docraft/model/docraft_rectangle.h" +#include "docraft/model/docraft_table.h" +#include "docraft/model/docraft_text.h" +#include "docraft/utils/docraft_logger.h" +#include "docraft/utils/docraft_base64.h" +#include "docraft/utils/docraft_parser_utilis.h" namespace docraft::templating { void DocraftTemplateEngine::template_nodes(const std::vector > &nodes) { @@ -192,8 +208,8 @@ namespace docraft::templating { //remove template node foreach_node->clear_template_nodes(); } else { - LOG_WARNING("Model for foreach node is not an array: " + model); - throw std::runtime_error("Model for foreach node is not an array or a valid json"); + LOG_WARNING("docraft/model for foreach node is not an array: " + model); + throw std::runtime_error("docraft/model for foreach node is not an array or a valid json"); } return; } diff --git a/docraft/src/utils/docraft_base64.cc b/docraft/src/docraft/utils/docraft_base64.cc similarity index 86% rename from docraft/src/utils/docraft_base64.cc rename to docraft/src/docraft/utils/docraft_base64.cc index 1cd2f75..32c978c 100644 --- a/docraft/src/utils/docraft_base64.cc +++ b/docraft/src/docraft/utils/docraft_base64.cc @@ -1,4 +1,20 @@ -#include "utils/docraft_base64.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/utils/docraft_base64.h" #include #include diff --git a/docraft/src/utils/docraft_font_registry.cc b/docraft/src/docraft/utils/docraft_font_registry.cc similarity index 75% rename from docraft/src/utils/docraft_font_registry.cc rename to docraft/src/docraft/utils/docraft_font_registry.cc index bdf71b9..ae2c957 100644 --- a/docraft/src/utils/docraft_font_registry.cc +++ b/docraft/src/docraft/utils/docraft_font_registry.cc @@ -1,4 +1,20 @@ -#include "utils/docraft_font_registry.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/utils/docraft_font_registry.h" #include #include diff --git a/docraft/src/utils/docraft_font_resolver.cc b/docraft/src/docraft/utils/docraft_font_resolver.cc similarity index 86% rename from docraft/src/utils/docraft_font_resolver.cc rename to docraft/src/docraft/utils/docraft_font_resolver.cc index 986e6d9..7a2e787 100644 --- a/docraft/src/utils/docraft_font_resolver.cc +++ b/docraft/src/docraft/utils/docraft_font_resolver.cc @@ -1,4 +1,20 @@ -#include "utils/docraft_font_resolver.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/utils/docraft_font_resolver.h" #include #include diff --git a/docraft/src/utils/docraft_keyword_extractor.cc b/docraft/src/docraft/utils/docraft_keyword_extractor.cc similarity index 90% rename from docraft/src/utils/docraft_keyword_extractor.cc rename to docraft/src/docraft/utils/docraft_keyword_extractor.cc index 4080629..3f5031c 100644 --- a/docraft/src/utils/docraft_keyword_extractor.cc +++ b/docraft/src/docraft/utils/docraft_keyword_extractor.cc @@ -1,4 +1,20 @@ -#include "utils/docraft_keyword_extractor.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/utils/docraft_keyword_extractor.h" #include #include @@ -6,8 +22,8 @@ #include #include -#include "docraft_document.h" -#include "model/docraft_text.h" +#include "docraft/docraft_document.h" +#include "docraft/model/docraft_text.h" namespace docraft::utils { namespace { diff --git a/docraft/src/utils/docraft_logger.cc b/docraft/src/docraft/utils/docraft_logger.cc similarity index 82% rename from docraft/src/utils/docraft_logger.cc rename to docraft/src/docraft/utils/docraft_logger.cc index 7380c45..3e312e0 100644 --- a/docraft/src/utils/docraft_logger.cc +++ b/docraft/src/docraft/utils/docraft_logger.cc @@ -1,4 +1,20 @@ -#include "utils/docraft_logger.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/utils/docraft_logger.h" #include #include diff --git a/docraft/src/utils/docraft_parser_utilis.cc b/docraft/src/docraft/utils/docraft_parser_utilis.cc similarity index 81% rename from docraft/src/utils/docraft_parser_utilis.cc rename to docraft/src/docraft/utils/docraft_parser_utilis.cc index d676ee3..2a4f412 100644 --- a/docraft/src/utils/docraft_parser_utilis.cc +++ b/docraft/src/docraft/utils/docraft_parser_utilis.cc @@ -1,8 +1,24 @@ -#include "utils/docraft_parser_utilis.h" +/* + * Copyright 2026 Matteo Cadoni (https://github.com/cadons) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "docraft/utils/docraft_parser_utilis.h" #include -#include "utils/docraft_logger.h" +#include "docraft/utils/docraft_logger.h" namespace docraft::utils { std::string DocraftParserUtilis::extract_data_attribute(const std::string &data_request, const nlohmann::json &item) { diff --git a/docraft/src/model/docraft_blank_line.cc b/docraft/src/model/docraft_blank_line.cc deleted file mode 100644 index 80971ab..0000000 --- a/docraft/src/model/docraft_blank_line.cc +++ /dev/null @@ -1,18 +0,0 @@ -#include "model/docraft_blank_line.h" - -#include - -#include "renderer/docraft_renderer.h" - -namespace docraft::model { - void DocraftBlankLine::draw(const std::shared_ptr &context) { - // An empty line does not render anything, but we can log its presence if needed - context->renderer()->render_blank_line(*this); - // std::cout << "Drawing an empty line at position (" << x() << ", " << y() << ")\n"; - - } - - std::shared_ptr DocraftBlankLine::clone() const { - return std::make_shared(*this); - } -} // docraft diff --git a/docraft/src/model/docraft_body.cc b/docraft/src/model/docraft_body.cc deleted file mode 100644 index 9a3e1a1..0000000 --- a/docraft/src/model/docraft_body.cc +++ /dev/null @@ -1,15 +0,0 @@ -#include "model/docraft_body.h" - -#include "model/docraft_clone_utils.h" - -namespace docraft::model{ - - std::shared_ptr DocraftBody::clone() const { - auto copy = std::make_shared(*this); - copy->clear_children(); - for (const auto &child : children()) { - copy->add_child(clone_node(child)); - } - return copy; - } -} // docraft diff --git a/docraft/src/model/docraft_footer.cc b/docraft/src/model/docraft_footer.cc deleted file mode 100644 index 55552d3..0000000 --- a/docraft/src/model/docraft_footer.cc +++ /dev/null @@ -1,20 +0,0 @@ -#include "model/docraft_footer.h" - -#include - -#include "model/docraft_clone_utils.h" - -namespace docraft::model { - DocraftFooter::DocraftFooter() { - set_name("footer"); - } - - std::shared_ptr DocraftFooter::clone() const { - auto copy = std::make_shared(*this); - copy->clear_children(); - for (const auto &child : children()) { - copy->add_child(clone_node(child)); - } - return copy; - } -} // docraft diff --git a/docraft/src/model/docraft_header.cc b/docraft/src/model/docraft_header.cc deleted file mode 100644 index a111598..0000000 --- a/docraft/src/model/docraft_header.cc +++ /dev/null @@ -1,19 +0,0 @@ -#include "model/docraft_header.h" -#include - -#include "model/docraft_clone_utils.h" - -namespace docraft::model { - DocraftHeader::DocraftHeader() { - set_name("header"); - } - - std::shared_ptr DocraftHeader::clone() const { - auto copy = std::make_shared(*this); - copy->clear_children(); - for (const auto &child : children()) { - copy->add_child(clone_node(child)); - } - return copy; - } -} diff --git a/docraft/src/model/docraft_new_page.cc b/docraft/src/model/docraft_new_page.cc deleted file mode 100644 index 486e7a4..0000000 --- a/docraft/src/model/docraft_new_page.cc +++ /dev/null @@ -1,5 +0,0 @@ -#include "model/docraft_new_page.h" - -namespace docraft::model { - // Intentionally empty; behavior is handled in layout. -} // docraft diff --git a/docraft/src/model/docraft_paragraph.cc b/docraft/src/model/docraft_paragraph.cc deleted file mode 100644 index f1ce6e8..0000000 --- a/docraft/src/model/docraft_paragraph.cc +++ /dev/null @@ -1,15 +0,0 @@ -// -// Created by Matteo on 29/12/25. -// - -#include "model/docraft_paragraph.h" - -namespace docraft::model { - void DocraftParagraph::draw(const std::shared_ptr &context) { - (void)context; - } - - std::shared_ptr DocraftParagraph::clone() const { - return std::make_shared(*this); - } -} // namespace docraft::model diff --git a/docraft/src/renderer/painter/docraft_blank_line_painter.cc b/docraft/src/renderer/painter/docraft_blank_line_painter.cc deleted file mode 100644 index 2c985c5..0000000 --- a/docraft/src/renderer/painter/docraft_blank_line_painter.cc +++ /dev/null @@ -1,11 +0,0 @@ -#include "renderer/painter/docraft_blank_line_painter.h" - -namespace docraft::renderer::painter { - docraft_blank_line_painter::docraft_blank_line_painter(const model::DocraftBlankLine &blank_line_node) : blank_line_node_( - blank_line_node) { - } - - void docraft_blank_line_painter::draw(const std::shared_ptr &context) { - // Blank line does not render anything - } -} // docraft diff --git a/docraft/test/CMakeLists.txt b/docraft/test/CMakeLists.txt index 9356e60..05ec3ac 100644 --- a/docraft/test/CMakeLists.txt +++ b/docraft/test/CMakeLists.txt @@ -5,33 +5,33 @@ find_package(GTest REQUIRED) #source files set(TEST_SOURCES - main.cpp - docraft_document_test.cc - docraft_color_test.cc - generic/docraft_font_applier_test.cc - layout/docraft_cursor_test.cc - layout/docraft_pagination_test.cc - model/docraft_position_test.cc - layout/docraft_layout_engine_test.cc - layout/docraft_layout_text_handler_test.cc - model/docraft_list_test.cc - model/docraft_clone_test.cc - model/docraft_settings_test.cc - model/docraft_node_test.cc - model/docraft_z_index_test.cc - craft/docraft_table_parser_test.cc - craft/docraft_craft_language_parser_test.cc - craft/docraft_shape_parser_test.cc - craft/docraft_image_parser_test.cc - craft/docraft_settings_parser_test.cc - backend/docraft_haru_backend_test.cc - renderer/docraft_image_painter_test.cc - renderer/docraft_painter_smoke_test.cc - renderer/docraft_section_margin_test.cc - templating/docraft_template_engine_test.cc - utils/docraft_keyword_extractor_test.cc - utils/docraft_logger_test.cc - utils/docraft_parser_utils.cc + docraft/main.cpp + docraft/docraft_document_test.cc + docraft/docraft_color_test.cc + docraft/generic/docraft_font_applier_test.cc + docraft/layout/docraft_cursor_test.cc + docraft/layout/docraft_pagination_test.cc + docraft/model/docraft_position_test.cc + docraft/layout/docraft_layout_engine_test.cc + docraft/layout/docraft_layout_text_handler_test.cc + docraft/model/docraft_list_test.cc + docraft/model/docraft_clone_test.cc + docraft/model/docraft_settings_test.cc + docraft/model/docraft_node_test.cc + docraft/model/docraft_z_index_test.cc + docraft/craft/docraft_table_parser_test.cc + docraft/craft/docraft_craft_language_parser_test.cc + docraft/craft/docraft_shape_parser_test.cc + docraft/craft/docraft_image_parser_test.cc + docraft/craft/docraft_settings_parser_test.cc + docraft/backend/docraft_haru_backend_test.cc + docraft/renderer/docraft_image_painter_test.cc + docraft/renderer/docraft_painter_smoke_test.cc + docraft/renderer/docraft_section_margin_test.cc + docraft/templating/docraft_template_engine_test.cc + docraft/utils/docraft_keyword_extractor_test.cc + docraft/utils/docraft_logger_test.cc + docraft/utils/docraft_parser_utils.cc ) add_executable(docraft_test diff --git a/docraft/test/backend/docraft_haru_backend_test.cc b/docraft/test/docraft/backend/docraft_haru_backend_test.cc similarity index 97% rename from docraft/test/backend/docraft_haru_backend_test.cc rename to docraft/test/docraft/backend/docraft_haru_backend_test.cc index 6cc9feb..2202b24 100644 --- a/docraft/test/backend/docraft_haru_backend_test.cc +++ b/docraft/test/docraft/backend/docraft_haru_backend_test.cc @@ -3,8 +3,10 @@ #include #include -#include "backend/pdf/docraft_haru_backend.h" -#include "model/docraft_page_format.h" +#include "docraft/backend/pdf/docraft_haru_backend.h" + +#include "docraft/docraft_document_metadata.h" +#include "docraft/model/docraft_page_format.h" namespace docraft::test::backend { diff --git a/docraft/test/craft/docraft_craft_language_parser_test.cc b/docraft/test/docraft/craft/docraft_craft_language_parser_test.cc similarity index 98% rename from docraft/test/craft/docraft_craft_language_parser_test.cc rename to docraft/test/docraft/craft/docraft_craft_language_parser_test.cc index b8b5571..8047b4d 100644 --- a/docraft/test/craft/docraft_craft_language_parser_test.cc +++ b/docraft/test/docraft/craft/docraft_craft_language_parser_test.cc @@ -1,7 +1,7 @@ #include -#include "craft/docraft_craft_language_parser.h" -#include "model/docraft_text.h" +#include "docraft/craft/docraft_craft_language_parser.h" +#include "docraft/model/docraft_text.h" TEST(DocraftCraftLanguageParserTest, ParsesTitleSubtitleAndTextWithPredefinedDefaults) { const char *xml = R"XML( diff --git a/docraft/test/craft/docraft_image_parser_test.cc b/docraft/test/docraft/craft/docraft_image_parser_test.cc similarity index 92% rename from docraft/test/craft/docraft_image_parser_test.cc rename to docraft/test/docraft/craft/docraft_image_parser_test.cc index 0b6c0dc..9cf7788 100644 --- a/docraft/test/craft/docraft_image_parser_test.cc +++ b/docraft/test/docraft/craft/docraft_image_parser_test.cc @@ -1,8 +1,8 @@ #include #include -#include "craft/parser/docraft_parser.h" -#include "model/docraft_image.h" +#include "docraft/craft/parser/docraft_parser.h" +#include "docraft/model/docraft_image.h" TEST(DocraftImageParserTest, ParsesBase64RawImageData) { const char *xml = R"XML( diff --git a/docraft/test/craft/docraft_settings_parser_test.cc b/docraft/test/docraft/craft/docraft_settings_parser_test.cc similarity index 97% rename from docraft/test/craft/docraft_settings_parser_test.cc rename to docraft/test/docraft/craft/docraft_settings_parser_test.cc index 4274bea..56473d2 100644 --- a/docraft/test/craft/docraft_settings_parser_test.cc +++ b/docraft/test/docraft/craft/docraft_settings_parser_test.cc @@ -1,8 +1,8 @@ #include #include -#include "craft/parser/docraft_parser.h" -#include "model/docraft_settings.h" +#include "docraft/craft/parser/docraft_parser.h" +#include "docraft/model/docraft_settings.h" namespace docraft::test::craft { class DocraftSettingsParserTest : public ::testing::Test { diff --git a/docraft/test/craft/docraft_shape_parser_test.cc b/docraft/test/docraft/craft/docraft_shape_parser_test.cc similarity index 88% rename from docraft/test/craft/docraft_shape_parser_test.cc rename to docraft/test/docraft/craft/docraft_shape_parser_test.cc index e2a51c7..2c2d0c4 100644 --- a/docraft/test/craft/docraft_shape_parser_test.cc +++ b/docraft/test/docraft/craft/docraft_shape_parser_test.cc @@ -1,17 +1,17 @@ #include #include -#include "craft/parser/docraft_circle_parser.h" -#include "craft/parser/docraft_line_parser.h" -#include "craft/parser/docraft_polygon_parser.h" -#include "craft/parser/docraft_triangle_parser.h" -#include "craft/parser/docraft_parser.h" -#include "docraft_color.h" -#include "model/docraft_circle.h" -#include "model/docraft_line.h" -#include "model/docraft_polygon.h" -#include "model/docraft_rectangle.h" -#include "model/docraft_triangle.h" +#include "docraft/craft/parser/docraft_circle_parser.h" +#include "docraft/craft/parser/docraft_line_parser.h" +#include "docraft/craft/parser/docraft_polygon_parser.h" +#include "docraft/craft/parser/docraft_triangle_parser.h" +#include "docraft/craft/parser/docraft_parser.h" +#include "docraft/docraft_color.h" +#include "docraft/model/docraft_circle.h" +#include "docraft/model/docraft_line.h" +#include "docraft/model/docraft_polygon.h" +#include "docraft/model/docraft_rectangle.h" +#include "docraft/model/docraft_triangle.h" namespace { docraft::RGB to_rgb(const docraft::DocraftColor &color) { diff --git a/docraft/test/craft/docraft_table_parser_test.cc b/docraft/test/docraft/craft/docraft_table_parser_test.cc similarity index 98% rename from docraft/test/craft/docraft_table_parser_test.cc rename to docraft/test/docraft/craft/docraft_table_parser_test.cc index ed5f7cf..aec78c4 100644 --- a/docraft/test/craft/docraft_table_parser_test.cc +++ b/docraft/test/docraft/craft/docraft_table_parser_test.cc @@ -1,8 +1,8 @@ #include #include -#include "craft/parser/docraft_parser.h" -#include "model/docraft_table.h" +#include "docraft/craft/parser/docraft_parser.h" +#include "docraft/model/docraft_table.h" namespace { docraft::RGB to_rgb(const docraft::DocraftColor &color) { diff --git a/docraft/test/docraft_color_test.cc b/docraft/test/docraft/docraft_color_test.cc similarity index 96% rename from docraft/test/docraft_color_test.cc rename to docraft/test/docraft/docraft_color_test.cc index 62f9bca..827d9a8 100644 --- a/docraft/test/docraft_color_test.cc +++ b/docraft/test/docraft/docraft_color_test.cc @@ -1,5 +1,5 @@ #include -#include "docraft_color.h" +#include "../../include/docraft/docraft_color.h" using namespace docraft; diff --git a/docraft/test/docraft_document_test.cc b/docraft/test/docraft/docraft_document_test.cc similarity index 98% rename from docraft/test/docraft_document_test.cc rename to docraft/test/docraft/docraft_document_test.cc index 1096166..c59f885 100644 --- a/docraft/test/docraft_document_test.cc +++ b/docraft/test/docraft/docraft_document_test.cc @@ -5,11 +5,11 @@ #include #include -#include "docraft_document.h" -#include "model/docraft_body.h" -#include "model/docraft_list.h" -#include "model/docraft_rectangle.h" -#include "model/docraft_text.h" +#include "docraft/docraft_document.h" +#include "docraft/model/docraft_body.h" +#include "docraft/model/docraft_list.h" +#include "docraft/model/docraft_rectangle.h" +#include "docraft/model/docraft_text.h" #include "utils/docraft_mock_rendering_backend.h" namespace docraft::test { diff --git a/docraft/test/generic/docraft_font_applier_test.cc b/docraft/test/docraft/generic/docraft_font_applier_test.cc similarity index 92% rename from docraft/test/generic/docraft_font_applier_test.cc rename to docraft/test/docraft/generic/docraft_font_applier_test.cc index 2c877ec..a3d3d22 100644 --- a/docraft/test/generic/docraft_font_applier_test.cc +++ b/docraft/test/docraft/generic/docraft_font_applier_test.cc @@ -3,10 +3,10 @@ #include #include -#include "docraft_document_context.h" -#include "generic/docraft_font_applier.h" -#include "utils/docraft_font_resolver.h" -#include "model/docraft_text.h" +#include "docraft/docraft_document_context.h" +#include "docraft/generic/docraft_font_applier.h" +#include "docraft/utils/docraft_font_resolver.h" +#include "docraft/model/docraft_text.h" using namespace docraft; diff --git a/docraft/test/layout/docraft_cursor_test.cc b/docraft/test/docraft/layout/docraft_cursor_test.cc similarity index 96% rename from docraft/test/layout/docraft_cursor_test.cc rename to docraft/test/docraft/layout/docraft_cursor_test.cc index 302b63b..658f159 100644 --- a/docraft/test/layout/docraft_cursor_test.cc +++ b/docraft/test/docraft/layout/docraft_cursor_test.cc @@ -1,6 +1,6 @@ #include -#include "docraft_cursor.h" +#include "docraft/docraft_cursor.h" namespace docraft::test::layout { class DocraftCursorTest : public ::testing::Test { diff --git a/docraft/test/layout/docraft_layout_engine_test.cc b/docraft/test/docraft/layout/docraft_layout_engine_test.cc similarity index 98% rename from docraft/test/layout/docraft_layout_engine_test.cc rename to docraft/test/docraft/layout/docraft_layout_engine_test.cc index 99683a4..461906b 100644 --- a/docraft/test/layout/docraft_layout_engine_test.cc +++ b/docraft/test/docraft/layout/docraft_layout_engine_test.cc @@ -1,16 +1,16 @@ -#include "layout/docraft_layout_engine.h" +#include "docraft/layout/docraft_layout_engine.h" #include #include -#include "model/docraft_blank_line.h" -#include "model/docraft_body.h" -#include "model/docraft_footer.h" -#include "model/docraft_header.h" -#include "model/docraft_layout.h" -#include "model/docraft_rectangle.h" -#include "model/docraft_table.h" -#include "model/docraft_text.h" +#include "docraft/model/docraft_blank_line.h" +#include "docraft/model/docraft_body.h" +#include "docraft/model/docraft_footer.h" +#include "docraft/model/docraft_header.h" +#include "docraft/model/docraft_layout.h" +#include "docraft/model/docraft_rectangle.h" +#include "docraft/model/docraft_table.h" +#include "docraft/model/docraft_text.h" namespace docraft::test::layout { class DocraftLayoutEngineTest : public ::testing::Test { diff --git a/docraft/test/layout/docraft_layout_text_handler_test.cc b/docraft/test/docraft/layout/docraft_layout_text_handler_test.cc similarity index 96% rename from docraft/test/layout/docraft_layout_text_handler_test.cc rename to docraft/test/docraft/layout/docraft_layout_text_handler_test.cc index 5c2c854..bc40161 100644 --- a/docraft/test/layout/docraft_layout_text_handler_test.cc +++ b/docraft/test/docraft/layout/docraft_layout_text_handler_test.cc @@ -1,8 +1,8 @@ -#include "layout/docraft_layout_engine.h" +#include "docraft/layout/docraft_layout_engine.h" #include -#include "model/docraft_text.h" +#include "docraft/model/docraft_text.h" namespace docraft::test::layout { class DocraftLayoutTextHandlerTest : public ::testing::Test { diff --git a/docraft/test/layout/docraft_pagination_test.cc b/docraft/test/docraft/layout/docraft_pagination_test.cc similarity index 91% rename from docraft/test/layout/docraft_pagination_test.cc rename to docraft/test/docraft/layout/docraft_pagination_test.cc index c13ce5e..0440629 100644 --- a/docraft/test/layout/docraft_pagination_test.cc +++ b/docraft/test/docraft/layout/docraft_pagination_test.cc @@ -2,15 +2,15 @@ #include -#include "docraft_document_context.h" -#include "layout/docraft_layout_engine.h" -#include "model/docraft_body.h" -#include "model/docraft_footer.h" -#include "model/docraft_header.h" -#include "model/docraft_page_number.h" -#include "model/docraft_rectangle.h" -#include "model/docraft_table.h" -#include "utils/docraft_mock_rendering_backend.h" +#include "docraft/docraft_document_context.h" +#include "docraft/layout/docraft_layout_engine.h" +#include "docraft/model/docraft_body.h" +#include "docraft/model/docraft_footer.h" +#include "docraft/model/docraft_header.h" +#include "docraft/model/docraft_page_number.h" +#include "docraft/model/docraft_rectangle.h" +#include "docraft/model/docraft_table.h" +#include "docraft/utils/docraft_mock_rendering_backend.h" namespace docraft::test::layout { class DocraftPaginationTest : public ::testing::Test { diff --git a/docraft/test/main.cpp b/docraft/test/docraft/main.cpp similarity index 100% rename from docraft/test/main.cpp rename to docraft/test/docraft/main.cpp diff --git a/docraft/test/model/docraft_clone_test.cc b/docraft/test/docraft/model/docraft_clone_test.cc similarity index 97% rename from docraft/test/model/docraft_clone_test.cc rename to docraft/test/docraft/model/docraft_clone_test.cc index b0def9b..9643520 100644 --- a/docraft/test/model/docraft_clone_test.cc +++ b/docraft/test/docraft/model/docraft_clone_test.cc @@ -2,13 +2,13 @@ #include -#include "docraft_color.h" -#include "model/docraft_foreach.h" -#include "model/docraft_image.h" -#include "model/docraft_layout.h" -#include "model/docraft_rectangle.h" -#include "model/docraft_table.h" -#include "model/docraft_text.h" +#include "docraft/docraft_color.h" +#include "docraft/model/docraft_foreach.h" +#include "docraft/model/docraft_image.h" +#include "docraft/model/docraft_layout.h" +#include "docraft/model/docraft_rectangle.h" +#include "docraft/model/docraft_table.h" +#include "docraft/model/docraft_text.h" namespace docraft::test::model { namespace { diff --git a/docraft/test/model/docraft_list_test.cc b/docraft/test/docraft/model/docraft_list_test.cc similarity index 96% rename from docraft/test/model/docraft_list_test.cc rename to docraft/test/docraft/model/docraft_list_test.cc index 9805f1d..28ec86e 100644 --- a/docraft/test/model/docraft_list_test.cc +++ b/docraft/test/docraft/model/docraft_list_test.cc @@ -1,8 +1,8 @@ #include -#include "layout/docraft_layout_engine.h" -#include "model/docraft_list.h" -#include "model/docraft_text.h" +#include "docraft/layout/docraft_layout_engine.h" +#include "docraft/model/docraft_list.h" +#include "docraft/model/docraft_text.h" namespace docraft::test::model { TEST(DocraftListTest, OrderedListNumbersAreApplied) { diff --git a/docraft/test/model/docraft_node_test.cc b/docraft/test/docraft/model/docraft_node_test.cc similarity index 91% rename from docraft/test/model/docraft_node_test.cc rename to docraft/test/docraft/model/docraft_node_test.cc index 75d8ba4..81b11e7 100644 --- a/docraft/test/model/docraft_node_test.cc +++ b/docraft/test/docraft/model/docraft_node_test.cc @@ -1,8 +1,8 @@ #include -#include "docraft_document_context.h" -#include "model/docraft_rectangle.h" -#include "utils/docraft_mock_rendering_backend.h" +#include "docraft/docraft_document_context.h" +#include "docraft/model/docraft_rectangle.h" +#include "docraft/utils/docraft_mock_rendering_backend.h" namespace docraft::test::model { class DocraftNodeTest : public ::testing::Test { diff --git a/docraft/test/model/docraft_position_test.cc b/docraft/test/docraft/model/docraft_position_test.cc similarity index 97% rename from docraft/test/model/docraft_position_test.cc rename to docraft/test/docraft/model/docraft_position_test.cc index 68f3f4c..cdd0b55 100644 --- a/docraft/test/model/docraft_position_test.cc +++ b/docraft/test/docraft/model/docraft_position_test.cc @@ -1,8 +1,8 @@ -#include "model/docraft_position.h" +#include "docraft/model/docraft_position.h" #include -#include "utils/docraft_logger.h" +#include "docraft/utils/docraft_logger.h" namespace docraft::test::model { class DocraftPositionTest : public ::testing::Test { diff --git a/docraft/test/model/docraft_settings_test.cc b/docraft/test/docraft/model/docraft_settings_test.cc similarity index 97% rename from docraft/test/model/docraft_settings_test.cc rename to docraft/test/docraft/model/docraft_settings_test.cc index f575f94..aa0e2ce 100644 --- a/docraft/test/model/docraft_settings_test.cc +++ b/docraft/test/docraft/model/docraft_settings_test.cc @@ -1,6 +1,6 @@ #include -#include "model/docraft_settings.h" +#include "docraft/model/docraft_settings.h" namespace docraft::test::model { class DocraftSettingsTest : public ::testing::Test { diff --git a/docraft/test/model/docraft_z_index_test.cc b/docraft/test/docraft/model/docraft_z_index_test.cc similarity index 97% rename from docraft/test/model/docraft_z_index_test.cc rename to docraft/test/docraft/model/docraft_z_index_test.cc index ac86f17..4f106ac 100644 --- a/docraft/test/model/docraft_z_index_test.cc +++ b/docraft/test/docraft/model/docraft_z_index_test.cc @@ -2,7 +2,7 @@ #include -#include "model/docraft_children_container_node.h" +#include "docraft/model/docraft_children_container_node.h" namespace docraft::test::model { namespace { diff --git a/docraft/test/renderer/docraft_image_painter_test.cc b/docraft/test/docraft/renderer/docraft_image_painter_test.cc similarity index 86% rename from docraft/test/renderer/docraft_image_painter_test.cc rename to docraft/test/docraft/renderer/docraft_image_painter_test.cc index 8bec842..2917839 100644 --- a/docraft/test/renderer/docraft_image_painter_test.cc +++ b/docraft/test/docraft/renderer/docraft_image_painter_test.cc @@ -2,9 +2,9 @@ #include -#include "docraft_document_context.h" -#include "model/docraft_image.h" -#include "renderer/painter/docraft_image_painter.h" +#include "docraft/docraft_document_context.h" +#include "docraft/model/docraft_image.h" +#include "docraft/renderer/painter/docraft_image_painter.h" using namespace docraft; diff --git a/docraft/test/renderer/docraft_painter_smoke_test.cc b/docraft/test/docraft/renderer/docraft_painter_smoke_test.cc similarity index 82% rename from docraft/test/renderer/docraft_painter_smoke_test.cc rename to docraft/test/docraft/renderer/docraft_painter_smoke_test.cc index 7393c49..bf9f2dc 100644 --- a/docraft/test/renderer/docraft_painter_smoke_test.cc +++ b/docraft/test/docraft/renderer/docraft_painter_smoke_test.cc @@ -1,23 +1,23 @@ #include -#include "docraft_document_context.h" -#include "docraft_color.h" -#include "generic/docraft_font_applier.h" -#include "model/docraft_circle.h" -#include "model/docraft_rectangle.h" -#include "model/docraft_table.h" -#include "model/docraft_text.h" -#include "model/docraft_triangle.h" -#include "model/docraft_line.h" -#include "model/docraft_polygon.h" -#include "renderer/painter/docraft_blank_line_painter.h" -#include "renderer/painter/docraft_circle_painter.h" -#include "renderer/painter/docraft_line_painter.h" -#include "renderer/painter/docraft_polygon_painter.h" -#include "renderer/painter/docraft_rectangle_painter.h" -#include "renderer/painter/docraft_table_painter.h" -#include "renderer/painter/docraft_text_painter.h" -#include "renderer/painter/docraft_triangle_painter.h" +#include "docraft/docraft_document_context.h" +#include "docraft/docraft_color.h" +#include "docraft/generic/docraft_font_applier.h" +#include "docraft/model/docraft_circle.h" +#include "docraft/model/docraft_rectangle.h" +#include "docraft/model/docraft_table.h" +#include "docraft/model/docraft_text.h" +#include "docraft/model/docraft_triangle.h" +#include "docraft/model/docraft_line.h" +#include "docraft/model/docraft_polygon.h" +#include "docraft/renderer/painter/docraft_blank_line_painter.h" +#include "docraft/renderer/painter/docraft_circle_painter.h" +#include "docraft/renderer/painter/docraft_line_painter.h" +#include "docraft/renderer/painter/docraft_polygon_painter.h" +#include "docraft/renderer/painter/docraft_rectangle_painter.h" +#include "docraft/renderer/painter/docraft_table_painter.h" +#include "docraft/renderer/painter/docraft_text_painter.h" +#include "docraft/renderer/painter/docraft_triangle_painter.h" using namespace docraft; diff --git a/docraft/test/renderer/docraft_section_margin_test.cc b/docraft/test/docraft/renderer/docraft_section_margin_test.cc similarity index 81% rename from docraft/test/renderer/docraft_section_margin_test.cc rename to docraft/test/docraft/renderer/docraft_section_margin_test.cc index 437a171..b203adb 100644 --- a/docraft/test/renderer/docraft_section_margin_test.cc +++ b/docraft/test/docraft/renderer/docraft_section_margin_test.cc @@ -1,11 +1,11 @@ #include -#include "docraft_color.h" -#include "docraft_document_context.h" -#include "model/docraft_header.h" -#include "model/docraft_position.h" -#include "renderer/docraft_pdf_renderer.h" -#include "utils/docraft_mock_rendering_backend.h" +#include "docraft/docraft_color.h" +#include "docraft/docraft_document_context.h" +#include "docraft/model/docraft_header.h" +#include "docraft/model/docraft_position.h" +#include "docraft/renderer/docraft_pdf_renderer.h" +#include "docraft/utils/docraft_mock_rendering_backend.h" namespace docraft::test::renderer { TEST(DocraftSectionMarginTest, DrawsMarginLines) { diff --git a/docraft/test/templating/docraft_template_engine_test.cc b/docraft/test/docraft/templating/docraft_template_engine_test.cc similarity index 96% rename from docraft/test/templating/docraft_template_engine_test.cc rename to docraft/test/docraft/templating/docraft_template_engine_test.cc index 187ba13..d406037 100644 --- a/docraft/test/templating/docraft_template_engine_test.cc +++ b/docraft/test/docraft/templating/docraft_template_engine_test.cc @@ -1,11 +1,11 @@ #include -#include "docraft_document.h" -#include "model/docraft_foreach.h" -#include "model/docraft_list.h" -#include "model/docraft_table.h" -#include "model/docraft_text.h" -#include "templating/docraft_template_engine.h" +#include "docraft/docraft_document.h" +#include "docraft/model/docraft_foreach.h" +#include "docraft/model/docraft_list.h" +#include "docraft/model/docraft_table.h" +#include "docraft/model/docraft_text.h" +#include "docraft/templating/docraft_template_engine.h" namespace docraft::test::templating { class DocraftTemplateEngineTest : public ::testing::Test { diff --git a/docraft/test/utils/docraft_keyword_extractor_test.cc b/docraft/test/docraft/utils/docraft_keyword_extractor_test.cc similarity index 94% rename from docraft/test/utils/docraft_keyword_extractor_test.cc rename to docraft/test/docraft/utils/docraft_keyword_extractor_test.cc index 77c56fd..94136dc 100644 --- a/docraft/test/utils/docraft_keyword_extractor_test.cc +++ b/docraft/test/docraft/utils/docraft_keyword_extractor_test.cc @@ -1,8 +1,8 @@ #include -#include "docraft_document.h" -#include "model/docraft_text.h" -#include "utils/docraft_keyword_extractor.h" +#include "docraft/docraft_document.h" +#include "docraft/model/docraft_text.h" +#include "docraft/utils/docraft_keyword_extractor.h" namespace docraft::test::utils { TEST(DocraftKeywordExtractorTest, RanksKeywordsByFrequency) { diff --git a/docraft/test/utils/docraft_logger_test.cc b/docraft/test/docraft/utils/docraft_logger_test.cc similarity index 98% rename from docraft/test/utils/docraft_logger_test.cc rename to docraft/test/docraft/utils/docraft_logger_test.cc index ced1ef7..4c9fa78 100644 --- a/docraft/test/utils/docraft_logger_test.cc +++ b/docraft/test/docraft/utils/docraft_logger_test.cc @@ -1,4 +1,4 @@ -#include "utils/docraft_logger.h" +#include "docraft/utils/docraft_logger.h" #include diff --git a/docraft/test/utils/docraft_mock_rendering_backend.h b/docraft/test/docraft/utils/docraft_mock_rendering_backend.h similarity index 99% rename from docraft/test/utils/docraft_mock_rendering_backend.h rename to docraft/test/docraft/utils/docraft_mock_rendering_backend.h index 0097c7c..53d7ca9 100644 --- a/docraft/test/utils/docraft_mock_rendering_backend.h +++ b/docraft/test/docraft/utils/docraft_mock_rendering_backend.h @@ -4,7 +4,7 @@ #include #include -#include "backend/docraft_rendering_backend.h" +#include "docraft/backend/docraft_rendering_backend.h" namespace docraft::test::utils { class MockRenderingBackend : public backend::IDocraftRenderingBackend { diff --git a/docraft/test/utils/docraft_parser_utils.cc b/docraft/test/docraft/utils/docraft_parser_utils.cc similarity index 98% rename from docraft/test/utils/docraft_parser_utils.cc rename to docraft/test/docraft/utils/docraft_parser_utils.cc index 2c9115d..2d50e4c 100644 --- a/docraft/test/utils/docraft_parser_utils.cc +++ b/docraft/test/docraft/utils/docraft_parser_utils.cc @@ -1,7 +1,7 @@ #include #include -#include "utils/docraft_parser_utilis.h" +#include "docraft/utils/docraft_parser_utilis.h" namespace docraft::test::utils { TEST(DocraftParserUtilis, extract_data_attribute) {