OpenXLSX 1.12.1
Modern C++ Excel Library (Fork of OpenXLSX by Kenneth Troldal Balslev)
Loading...
Searching...
No Matches
XLPackageServices.hpp
Go to the documentation of this file.
1/*
2 * OpenXLSX-NX - Modern High-Performance C++ Excel Library
3 *
4 * Original work Copyright (c) 2018-2025, Kenneth Troldal Balslev and OpenXLSX contributors
5 * Modified work Copyright (c) 2026, Curry Tang and OpenXLSX-NX contributors
6 *
7 * Distributed under the BSD 3-Clause License.
8 * See LICENSE.md in the project root or https://opensource.org/licenses/BSD-3-Clause
9 */
10
11#ifndef OPENXLSX_XLPACKAGESERVICES_HPP
12#define OPENXLSX_XLPACKAGESERVICES_HPP
13
14#ifdef _MSC_VER
15# pragma warning(push)
16# pragma warning(disable : 4251)
17# pragma warning(disable : 4275)
18#endif
19
35
36#include "IZipArchive.hpp"
37#include "OpenXLSX-Exports.hpp"
38#include "XLContentTypes.hpp"
39#include "XLRelationships.hpp"
40
41#include <cstdint>
42#include <string>
43#include <string_view>
44
45namespace OpenXLSX
46{
47 class XLXmlData;
48
55 class OPENXLSX_EXPORT XLPackageServices
56 {
57 public:
58 virtual ~XLPackageServices() = default;
59
60 // ----- Archive (ZIP / OPC binary store) -----
61
62 [[nodiscard]] virtual IZipArchive& archive() = 0;
63 [[nodiscard]] virtual const IZipArchive& archive() const = 0;
64
65 // ----- Content types registry ([Content_Types].xml) -----
66
67 [[nodiscard]] virtual XLContentTypes& contentTypes() = 0;
68 [[nodiscard]] virtual const XLContentTypes& contentTypes() const = 0;
69
70 // ----- Managed XML parts -----
71
76 [[nodiscard]] virtual XLXmlData* findXmlPart(std::string_view path, bool doNotThrow = false) = 0;
77 [[nodiscard]] virtual const XLXmlData* findXmlPart(std::string_view path, bool doNotThrow = false) const = 0;
78
82 virtual XLXmlData* emplaceXmlPart(const std::string& path, const std::string& id, XLContentType type) = 0;
83
84 // ----- Relationships -----
85
86 [[nodiscard]] virtual XLRelationships& workbookRelationships() = 0;
87
91 [[nodiscard]] virtual XLRelationships xmlRelationships(std::string_view xmlPath) = 0;
92
96 [[nodiscard]] virtual XLRelationships drawingRelationships(std::string_view drawingPath) = 0;
97 };
98
99} // namespace OpenXLSX
100
101#ifdef _MSC_VER
102# pragma warning(pop)
103#endif
104
105#endif // OPENXLSX_XLPACKAGESERVICES_HPP
This class functions as a wrapper around any class that provides the necessary functionality for a zi...
Definition IZipArchive.hpp:38
The purpose of this class is to load, store add and save item in the [Content_Types]....
Definition XLContentTypes.hpp:112
Abstract package services port (archive + XML parts + relationships + content types).
Definition XLPackageServices.hpp:56
virtual XLRelationships drawingRelationships(std::string_view drawingPath)=0
Relationships for a drawing part.
virtual XLXmlData * findXmlPart(std::string_view path, bool doNotThrow=false)=0
Locate a managed XML part by package path (e.g. "xl/pivotCache/pivotCacheDefinition1....
virtual IZipArchive & archive()=0
virtual const IZipArchive & archive() const =0
virtual ~XLPackageServices()=default
virtual const XLContentTypes & contentTypes() const =0
virtual XLRelationships xmlRelationships(std::string_view xmlPath)=0
Relationships for an arbitrary package XML part (…/_rels/name.xml.rels).
virtual XLRelationships & workbookRelationships()=0
virtual XLXmlData * emplaceXmlPart(const std::string &path, const std::string &id, XLContentType type)=0
Create and register a new managed XML part in the document's part list.
virtual const XLXmlData * findXmlPart(std::string_view path, bool doNotThrow=false) const =0
virtual XLContentTypes & contentTypes()=0
Definition XLRelationships.hpp:150
The XLXmlData class encapsulates the properties and behaviour of the .xml files in an ....
Definition XLXmlData.hpp:79
Definition IXLCellProvider.hpp:24
XLContentType
Definition XLContentTypes.hpp:38