The XLXmlFile class provides an interface for derived classes to use. It functions as an ancestor to all classes which are represented by an .xml file in an .xlsx package.
More...
#include <XLXmlFile.hpp>
The XLXmlFile class provides an interface for derived classes to use. It functions as an ancestor to all classes which are represented by an .xml file in an .xlsx package.
- Warning
- The XLXmlFile class is not intended to be instantiated on it's own, but to provide an interface for derived classes. Also, it should not be used polymorphically. For that reason, the destructor is not declared virtual.
◆ XLXmlFile() [1/4]
| OpenXLSX::XLXmlFile::XLXmlFile |
( |
| ) |
|
|
default |
◆ XLXmlFile() [2/4]
Constructor. Creates an object based on the xmlData input.
- Parameters
-
| xmlData | An XLXmlData object with the XML data to be represented by the object. |
The constructor creates a new object with the parent XLDocument and the file path as input, with an optional input being a std::string with the XML data. If the XML data is provided by a string, any file with the same path in the .zip file will be overwritten upon saving of the document. If no xmlData is provided, the data will be read from the .zip file, using the given path.
◆ XLXmlFile() [3/4]
| OpenXLSX::XLXmlFile::XLXmlFile |
( |
const XLXmlFile & |
other | ) |
|
|
default |
Copy constructor. Default implementation used.
- Parameters
-
◆ XLXmlFile() [4/4]
| OpenXLSX::XLXmlFile::XLXmlFile |
( |
XLXmlFile && |
other | ) |
|
|
defaultnoexcept |
Move constructor. Default implementation used.
- Parameters
-
◆ ~XLXmlFile()
| OpenXLSX::XLXmlFile::~XLXmlFile |
( |
| ) |
|
|
default |
Destructor. Default implementation used.
◆ getXmlPath()
| std::string XLXmlFile::getXmlPath |
( |
| ) |
const |
Retrieve the path of the XML data in the .xlsx zip archive via m_xmlData->getXmlPath.
- Returns
- A std::string with the path. Empty string if m_xmlData is nullptr
provide access to the underlying XLXmlData::getXmlPath() function
◆ operator=() [1/2]
The copy assignment operator. The default implementation has been used.
- Parameters
-
- Returns
- A reference to the new object.
◆ operator=() [2/2]
The move assignment operator. The default implementation has been used.
- Parameters
-
- Returns
- A reference to the new object.
◆ parentDoc() [1/2]
This function provides access to the parent XLDocument object.
- Returns
- A reference to the parent XLDocument object.
◆ parentDoc() [2/2]
This function provides access to the parent XLDocument object.
- Returns
- A const reference to the parent XLDocument object.
◆ relationshipID()
| std::string XLXmlFile::relationshipID |
( |
| ) |
const |
|
protected |
This function returns the relationship ID (the ID used in the XLRelationships objects) for the object.
- Returns
- A std::string with the ID. Not all spreadsheet objects may have a relationship ID. In those cases an empty string is returned.
◆ setXmlData()
| void XLXmlFile::setXmlData |
( |
std::string_view |
xmlData | ) |
|
|
protected |
Provide the XML data represented by the object.
- Parameters
-
| xmlData | A std::string_view with the XML data. |
This method sets the XML data with a std::string as input. The underlying XMLDocument reads the data. When envoking the load_string method in PugiXML, the flag 'parse_ws_pcdata' is passed along with the default flags. This will enable parsing of whitespace characters. If not set, Excel cells with only spaces will be returned as empty strings, which is not what we want. The downside is that whitespace characters such as \n and \t in the input xml file may mess up the parsing.
◆ valid()
| bool OpenXLSX::XLXmlFile::valid |
( |
| ) |
const |
|
inline |
check whether class is linked to a valid XML file
- Returns
- true if the class should have a link to valid data
-
false if accessing any other sheet properties / methods could cause a segmentation fault
- Note
- for example, if an XLSheet is created with a default constructor, XLSheetBase::valid() (derived from XLXmlFile) would return false
◆ xmlData()
Method for getting the XML data represented by the object.
- Parameters
-
| savingDeclaration | @optional specify an XML saving declaration to use |
- Returns
- A std::string with the XML data.
This method retrieves the underlying XML data as a std::string.
◆ xmlDocument() [1/2]
This function provides access to the underlying XMLDocument object.
- Returns
- A reference to the XMLDocument object.
This method returns a pointer to the underlying XMLDocument resource.
◆ xmlDocument() [2/2]
This function provides access to the underlying XMLDocument object.
- Returns
- A const reference to the XMLDocument object.
This method returns a pointer to the underlying XMLDocument resource as const.
◆ m_xmlData
| XLXmlData* OpenXLSX::XLXmlFile::m_xmlData {nullptr} |
|
protected |
The underlying XML data object.
The documentation for this class was generated from the following files:
- /home/runner/work/OpenXLSX-NX/OpenXLSX-NX/OpenXLSX/headers/XLXmlFile.hpp
- /home/runner/work/OpenXLSX-NX/OpenXLSX-NX/OpenXLSX/sources/XLXmlFile.cpp