|
OpenXLSX 1.10.0
|
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>
Public Member Functions | |
| 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. | |
| XLAllocatedMemory | getRawAllocatedData (XLXmlSavingDeclaration savingDeclaration=XLXmlSavingDeclaration{}) const |
| Get the raw data allocated directly using malloc. Intended for zero-copy serialization straight into libzip buffers, avoiding unnecessary std::string and string stream allocations. | |
| 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. | |
Data Fields | |
| bool | m_isStreamed {false} |
| std::string | m_streamFilePath |
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.
|
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::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.
| 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. |
|
default |
Default destructor. The XLXmlData does not manage any dynamically allocated resources, so a default destructor will suffice.
|
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.
| other |
|
defaultnoexcept |
Move constructor. All data members are trivially movable. Hence an explicitly defaulted move constructor is sufficient.
| other |
| bool OpenXLSX::XLXmlData::empty | ( | ) | const |
Test whether there is an XML file linked to this object.
| XLDocument * XLXmlData::getParentDoc | ( | ) |
Access the parent XLDocument object.
| const XLDocument * XLXmlData::getParentDoc | ( | ) | const |
Access the parent XLDocument object.
| XLAllocatedMemory XLXmlData::getRawAllocatedData | ( | XLXmlSavingDeclaration | savingDeclaration = XLXmlSavingDeclaration{} | ) | const |
Get the raw data allocated directly using malloc. Intended for zero-copy serialization straight into libzip buffers, avoiding unnecessary std::string and string stream allocations.
| savingDeclaration | @optional specify an XML saving declaration to use |
| std::string XLXmlData::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.
| savingDeclaration | @optional specify an XML saving declaration to use |
| XMLDocument * XLXmlData::getXmlDocument | ( | ) |
Access the underlying XMLDocument object.
| const XMLDocument * XLXmlData::getXmlDocument | ( | ) | const |
Access the underlying XMLDocument object.
| std::string XLXmlData::getXmlID | ( | ) | const |
Retrieve the relationship ID of the XML file.
| std::string XLXmlData::getXmlPath | ( | ) | const |
Retrieve the path of the XML data in the .xlsx zip archive.
| XLContentType XLXmlData::getXmlType | ( | ) | const |
Retrieve the type represented by the XML data.
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.
Move assignment operator. All data members are trivially movable. Hence an explicitly defaulted move constructor is sufficient.
| other | the XLXmlData object to be moved from. |
| 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.
| data | A std::string with the raw XML text. |
|
inline |
check whether class is linked to a valid XML document
| bool OpenXLSX::XLXmlData::m_isStreamed {false} |
| std::string OpenXLSX::XLXmlData::m_streamFilePath |