OpenXLSX 1.9.1
Loading...
Searching...
No Matches
XLXmlData.hpp
Go to the documentation of this file.
1#ifndef OPENXLSX_XLXMLDATA_HPP
2#define OPENXLSX_XLXMLDATA_HPP
3
4#ifdef _MSC_VER // conditionally enable MSVC specific pragmas to avoid other compilers warning about unknown pragmas
5# pragma warning(push)
6# pragma warning(disable : 4251)
7# pragma warning(disable : 4275)
8#endif // _MSC_VER
9
10// ===== External Includes ===== //
11#include <memory>
12#include <string>
13
14// ===== OpenXLSX Includes ===== //
15#include "OpenXLSX-Exports.hpp"
16#include "XLContentTypes.hpp"
17#include "XLXmlParser.hpp"
19
20namespace OpenXLSX
21{
28 class OPENXLSX_EXPORT XLXmlData final
29 {
30 public:
31 // ===== PUBLIC MEMBER FUNCTIONS ===== //
32
38 XLXmlData() = default;
39
49 XLXmlData(XLDocument* parentDoc,
50 const std::string& xmlPath,
51 const std::string& xmlId = "",
52 XLContentType xmlType = XLContentType::Unknown);
53
59
65 bool valid() const { return m_xmlDoc != nullptr; }
66
72 XLXmlData(const XLXmlData& other) = delete;
73
79 XLXmlData(XLXmlData&& other) noexcept = default;
80
85 XLXmlData& operator=(const XLXmlData& other) = delete;
86
93 XLXmlData& operator=(XLXmlData&& other) noexcept = default;
94
101 void setRawData(const std::string& data);
102
110 std::string getRawData(XLXmlSavingDeclaration savingDeclaration = XLXmlSavingDeclaration{}) const;
111
116 XLDocument* getParentDoc();
117
122 const XLDocument* getParentDoc() const;
123
128 std::string getXmlPath() const;
129
134 std::string getXmlID() const;
135
140 XLContentType getXmlType() const;
141
146 XMLDocument* getXmlDocument();
147
152 const XMLDocument* getXmlDocument() const;
153
158 bool empty() const;
159
160 private:
161 // ===== PRIVATE MEMBER VARIABLES ===== //
162
163 XLDocument* m_parentDoc{};
164 std::string m_xmlPath{};
165 std::string m_xmlID{};
166 XLContentType m_xmlType{};
167 mutable std::unique_ptr<XMLDocument> m_xmlDoc;
168 public:
169 bool m_isStreamed{false};
170 std::string m_streamFilePath;
171 };
172} // namespace OpenXLSX
173
174#ifdef _MSC_VER // conditionally enable MSVC specific pragmas to avoid other compilers warning about unknown pragmas
175# pragma warning(pop)
176#endif // _MSC_VER
177
178#endif // OPENXLSX_XLXMLDATA_HPP
Definition XLXmlParser.hpp:241
This class encapsulates the concept of an excel file. It is different from the XLWorkbook,...
Definition XLDocument.hpp:82
The XLXmlData class encapsulates the properties and behaviour of the .xml files in an ....
Definition XLXmlData.hpp:29
bool valid() const
check whether class is linked to a valid XML document
Definition XLXmlData.hpp:65
XLXmlData(XLXmlData &&other) noexcept=default
Move constructor. All data members are trivially movable. Hence an explicitly defaulted move construc...
std::string m_streamFilePath
Definition XLXmlData.hpp:170
XLXmlData & operator=(XLXmlData &&other) noexcept=default
Move assignment operator. All data members are trivially movable. Hence an explicitly defaulted move ...
XLXmlData(const XLXmlData &other)=delete
Copy constructor. The m_xmlDoc data member is a XMLDocument object, which is non-copyable....
XLXmlData & operator=(const XLXmlData &other)=delete
Copy assignment operator. The m_xmlDoc data member is a XMLDocument object, which is non-copyable....
bool empty() const
Test whether there is an XML file linked to this object.
XLXmlData()=default
Default constructor. All member variables are default constructed. Except for the raw XML data,...
~XLXmlData()
Default destructor. The XLXmlData does not manage any dynamically allocated resources,...
The XLXmlSavingDeclaration class encapsulates the properties of an XML saving declaration,...
Definition XLXmlSavingDeclaration.hpp:19
Definition IZipArchive.hpp:18
XLContentType
Definition XLContentTypes.hpp:28