The XLXmlData class encapsulates the properties and behaviour of the .xml files in an .xlsx file zip package. Objects of the XLXmlData type are intended to be stored centrally in an XLDocument object, from where they can be retrieved by other objects that encapsulates the behaviour of Excel elements, such as XLWorkbook and XLWorksheet.
More...
#include <XLXmlData.hpp>
|
| | XLXmlData ()=default |
| | Default constructor. All member variables are default constructed. Except for the raw XML data, none of the member variables can be modified after construction. Hence, objects created using the default constructor can only serve as null objects and targets for the move assignemnt operator.
|
| |
| | XLXmlData (XLDocument *parentDoc, const std::string &xmlPath, const std::string &xmlId="", XLContentType xmlType=XLContentType::Unknown) |
| | Constructor. This constructor creates objects with the given parameters. the xmlId and the xmlType parameters have default values. These are only useful for relationship (.rels) files and the [Content_Types].xml file located in the root directory of the zip package.
|
| |
| | ~XLXmlData () |
| | Default destructor. The XLXmlData does not manage any dynamically allocated resources, so a default destructor will suffice.
|
| |
| bool | valid () const |
| | check whether class is linked to a valid XML document
|
| |
| | XLXmlData (const XLXmlData &other)=delete |
| | Copy constructor. The m_xmlDoc data member is a XMLDocument object, which is non-copyable. Hence, the XLXmlData objects have a explicitly deleted copy constructor.
|
| |
| | XLXmlData (XLXmlData &&other) noexcept=default |
| | Move constructor. All data members are trivially movable. Hence an explicitly defaulted move constructor is sufficient.
|
| |
| XLXmlData & | operator= (const XLXmlData &other)=delete |
| | Copy assignment operator. The m_xmlDoc data member is a XMLDocument object, which is non-copyable. Hence, the XLXmlData objects have a explicitly deleted copy assignment operator.
|
| |
| XLXmlData & | operator= (XLXmlData &&other) noexcept=default |
| | Move assignment operator. All data members are trivially movable. Hence an explicitly defaulted move constructor is sufficient.
|
| |
| void | setRawData (const std::string &data) |
| | Set the raw data for the underlying XML document. Being able to set the XML data directly is useful when creating a new file using a XML file template. E.g., when creating a new worksheet, the XML code for a minimum viable XLWorksheet object can be added using this function.
|
| |
| std::string | getRawData (XLXmlSavingDeclaration savingDeclaration=XLXmlSavingDeclaration{}) const |
| | Get the raw data for the underlying XML document. This function will retrieve the raw XML text data from the underlying XMLDocument object. This will mainly be used when saving data to the .xlsx package using the save function in the XLDocument class.
|
| |
| XLDocument * | getParentDoc () |
| | Access the parent XLDocument object.
|
| |
| const XLDocument * | getParentDoc () const |
| | Access the parent XLDocument object.
|
| |
| std::string | getXmlPath () const |
| | Retrieve the path of the XML data in the .xlsx zip archive.
|
| |
| std::string | getXmlID () const |
| | Retrieve the relationship ID of the XML file.
|
| |
| XLContentType | getXmlType () const |
| | Retrieve the type represented by the XML data.
|
| |
| XMLDocument * | getXmlDocument () |
| | Access the underlying XMLDocument object.
|
| |
| const XMLDocument * | getXmlDocument () const |
| | Access the underlying XMLDocument object.
|
| |
| bool | empty () const |
| | Test whether there is an XML file linked to this object.
|
| |
The XLXmlData class encapsulates the properties and behaviour of the .xml files in an .xlsx file zip package. Objects of the XLXmlData type are intended to be stored centrally in an XLDocument object, from where they can be retrieved by other objects that encapsulates the behaviour of Excel elements, such as XLWorkbook and XLWorksheet.
◆ XLXmlData() [1/4]
| OpenXLSX::XLXmlData::XLXmlData |
( |
| ) |
|
|
default |
Default constructor. All member variables are default constructed. Except for the raw XML data, none of the member variables can be modified after construction. Hence, objects created using the default constructor can only serve as null objects and targets for the move assignemnt operator.
◆ XLXmlData() [2/4]
Constructor. This constructor creates objects with the given parameters. the xmlId and the xmlType parameters have default values. These are only useful for relationship (.rels) files and the [Content_Types].xml file located in the root directory of the zip package.
- Parameters
-
| parentDoc | A pointer to the parent XLDocument object. |
| xmlPath | A std::string with the file path in zip package. |
| xmlId | A std::string with the relationship ID of the file (used in the XLRelationships class) |
| xmlType | The type of object the XML file represents, e.g. XLWorkbook or XLWorksheet. |
◆ ~XLXmlData()
| XLXmlData::~XLXmlData |
( |
| ) |
|
|
default |
Default destructor. The XLXmlData does not manage any dynamically allocated resources, so a default destructor will suffice.
◆ XLXmlData() [3/4]
| OpenXLSX::XLXmlData::XLXmlData |
( |
const XLXmlData & |
other | ) |
|
|
delete |
Copy constructor. The m_xmlDoc data member is a XMLDocument object, which is non-copyable. Hence, the XLXmlData objects have a explicitly deleted copy constructor.
- Parameters
-
◆ XLXmlData() [4/4]
| OpenXLSX::XLXmlData::XLXmlData |
( |
XLXmlData && |
other | ) |
|
|
defaultnoexcept |
Move constructor. All data members are trivially movable. Hence an explicitly defaulted move constructor is sufficient.
- Parameters
-
◆ empty()
| bool OpenXLSX::XLXmlData::empty |
( |
| ) |
const |
Test whether there is an XML file linked to this object.
- Returns
- true if there is no underlying XML file, otherwise false
◆ getParentDoc() [1/2]
◆ getParentDoc() [2/2]
| const XLDocument * XLXmlData::getParentDoc |
( |
| ) |
const |
◆ getRawData()
Get the raw data for the underlying XML document. This function will retrieve the raw XML text data from the underlying XMLDocument object. This will mainly be used when saving data to the .xlsx package using the save function in the XLDocument class.
- Parameters
-
| savingDeclaration | @optional specify an XML saving declaration to use |
- Returns
- A std::string with the raw XML text data.
- Note
- Default encoding for pugixml xml_document::save is pugi::encoding_auto, becomes pugi::encoding_utf8
◆ getXmlDocument() [1/2]
Access the underlying XMLDocument object.
- Returns
- A pointer to the XMLDocument object.
◆ getXmlDocument() [2/2]
| const XMLDocument * XLXmlData::getXmlDocument |
( |
| ) |
const |
Access the underlying XMLDocument object.
- Returns
- A const pointer to the XMLDocument object.
◆ getXmlID()
| std::string XLXmlData::getXmlID |
( |
| ) |
const |
Retrieve the relationship ID of the XML file.
- Returns
- A std::string with the relationship ID.
◆ getXmlPath()
| std::string XLXmlData::getXmlPath |
( |
| ) |
const |
Retrieve the path of the XML data in the .xlsx zip archive.
- Returns
- A std::string with the path.
◆ getXmlType()
Retrieve the type represented by the XML data.
- Returns
- A XLContentType getValue representing the type.
◆ operator=() [1/2]
Copy assignment operator. The m_xmlDoc data member is a XMLDocument object, which is non-copyable. Hence, the XLXmlData objects have a explicitly deleted copy assignment operator.
◆ operator=() [2/2]
Move assignment operator. All data members are trivially movable. Hence an explicitly defaulted move constructor is sufficient.
- Parameters
-
- Returns
- A reference to the moved-to object.
◆ setRawData()
| void XLXmlData::setRawData |
( |
const std::string & |
data | ) |
|
Set the raw data for the underlying XML document. Being able to set the XML data directly is useful when creating a new file using a XML file template. E.g., when creating a new worksheet, the XML code for a minimum viable XLWorksheet object can be added using this function.
- Parameters
-
| data | A std::string with the raw XML text. |
◆ valid()
| bool OpenXLSX::XLXmlData::valid |
( |
| ) |
const |
|
inline |
check whether class is linked to a valid XML document
- Returns
- true if the class should have a link to valid data
-
false if accessing any other properties / methods could cause a segmentation fault
◆ m_isStreamed
| bool OpenXLSX::XLXmlData::m_isStreamed {false} |
◆ m_streamFilePath
| std::string OpenXLSX::XLXmlData::m_streamFilePath |
The documentation for this class was generated from the following files:
- /home/runner/work/OpenXLSX-NX/OpenXLSX-NX/OpenXLSX/headers/XLXmlData.hpp
- /home/runner/work/OpenXLSX-NX/OpenXLSX-NX/OpenXLSX/sources/XLXmlData.cpp