OpenXLSX 1.9.1
Loading...
Searching...
No Matches
OpenXLSX::XLContentTypes Class Reference

The purpose of this class is to load, store add and save item in the [Content_Types].xml file. More...

#include <XLContentTypes.hpp>

Inheritance diagram for OpenXLSX::XLContentTypes:
OpenXLSX::XLXmlFile

Public Member Functions

 XLContentTypes ()
 
 XLContentTypes (gsl::not_null< XLXmlData * > xmlData)
 
 ~XLContentTypes ()=default
 
 XLContentTypes (const XLContentTypes &other)
 
 XLContentTypes (XLContentTypes &&other) noexcept
 
XLContentTypesoperator= (const XLContentTypes &other)
 
XLContentTypesoperator= (XLContentTypes &&other) noexcept
 
bool hasDefault (std::string_view extension) const
 Check if a default extension exists.
 
bool hasOverride (std::string_view path) const
 Check if an override exists.
 
void addDefault (std::string_view extension, std::string_view contentType)
 Add a new default extension key/value pair to the data store.
 
void addOverride (std::string_view path, XLContentType type)
 Add a new override key/getValue pair to the data store.
 
void updateOverride (std::string_view path, XLContentType type)
 Update an existing override key/getValue pair or add if it does not exist.
 
void deleteOverride (std::string_view path)
 
void deleteOverride (const XLContentItem &item)
 
void deleteDefault (std::string_view extension)
 Delete a default extension from the content types.
 
XLContentItem contentItem (std::string_view path)
 
std::vector< XLContentItemgetContentItems ()
 
- Public Member Functions inherited from OpenXLSX::XLXmlFile
 XLXmlFile ()=default
 Default constructor.
 
std::string xmlData (XLXmlSavingDeclaration savingDeclaration=XLXmlSavingDeclaration{}) const
 Method for getting the XML data represented by the object.
 
 XLXmlFile (XLXmlData *xmlData)
 Constructor. Creates an object based on the xmlData input.
 
 XLXmlFile (const XLXmlFile &other)=default
 Copy constructor. Default implementation used.
 
 XLXmlFile (XLXmlFile &&other) noexcept=default
 Move constructor. Default implementation used.
 
 ~XLXmlFile ()=default
 Destructor. Default implementation used.
 
bool valid () const
 check whether class is linked to a valid XML file
 
XLXmlFileoperator= (const XLXmlFile &other)=default
 The copy assignment operator. The default implementation has been used.
 
XLXmlFileoperator= (XLXmlFile &&other) noexcept=default
 The move assignment operator. The default implementation has been used.
 
XLDocumentparentDoc ()
 This function provides access to the parent XLDocument object.
 
const XLDocumentparentDoc () const
 This function provides access to the parent XLDocument object.
 
XMLDocumentxmlDocument ()
 This function provides access to the underlying XMLDocument object.
 
const XMLDocumentxmlDocument () const
 This function provides access to the underlying XMLDocument object.
 
std::string getXmlPath () const
 Retrieve the path of the XML data in the .xlsx zip archive via m_xmlData->getXmlPath.
 

Additional Inherited Members

- Protected Member Functions inherited from OpenXLSX::XLXmlFile
void setXmlData (std::string_view xmlData)
 Provide the XML data represented by the object.
 
std::string relationshipID () const
 This function returns the relationship ID (the ID used in the XLRelationships objects) for the object.
 
- Protected Attributes inherited from OpenXLSX::XLXmlFile
XLXmlDatam_xmlData {nullptr}
 

Detailed Description

The purpose of this class is to load, store add and save item in the [Content_Types].xml file.

Constructor & Destructor Documentation

◆ XLContentTypes() [1/4]

XLContentTypes::XLContentTypes ( )
default

◆ XLContentTypes() [2/4]

XLContentTypes::XLContentTypes ( gsl::not_null< XLXmlData * >  xmlData)
explicit

◆ ~XLContentTypes()

OpenXLSX::XLContentTypes::~XLContentTypes ( )
default

◆ XLContentTypes() [3/4]

XLContentTypes::XLContentTypes ( const XLContentTypes other)
default

◆ XLContentTypes() [4/4]

XLContentTypes::XLContentTypes ( XLContentTypes &&  other)
defaultnoexcept

Member Function Documentation

◆ addDefault()

void XLContentTypes::addDefault ( std::string_view  extension,
std::string_view  contentType 
)

Add a new default extension key/value pair to the data store.

Parameters
extensionThe extension
contentTypeThe content type

◆ addOverride()

void XLContentTypes::addOverride ( std::string_view  path,
XLContentType  type 
)

Add a new override key/getValue pair to the data store.

Parameters
pathThe key
typeThe getValue
Note
2024-07-22: added more intelligent whitespace support

◆ contentItem()

XLContentItem XLContentTypes::contentItem ( std::string_view  path)

◆ deleteDefault()

void XLContentTypes::deleteDefault ( std::string_view  extension)

Delete a default extension from the content types.

Parameters
extensionThe extension to remove (e.g. "bin").

◆ deleteOverride() [1/2]

void XLContentTypes::deleteOverride ( const XLContentItem item)

◆ deleteOverride() [2/2]

void XLContentTypes::deleteOverride ( std::string_view  path)

◆ getContentItems()

std::vector< XLContentItem > XLContentTypes::getContentItems ( )

◆ hasDefault()

bool XLContentTypes::hasDefault ( std::string_view  extension) const

Check if a default extension exists.

Parameters
extensionThe extension
Returns
true if it exists

◆ hasOverride()

bool XLContentTypes::hasOverride ( std::string_view  path) const

Check if an override exists.

Parameters
pathThe path
Returns
true if it exists

◆ operator=() [1/2]

XLContentTypes & XLContentTypes::operator= ( const XLContentTypes other)
default

◆ operator=() [2/2]

XLContentTypes & XLContentTypes::operator= ( XLContentTypes &&  other)
defaultnoexcept

◆ updateOverride()

void XLContentTypes::updateOverride ( std::string_view  path,
XLContentType  type 
)

Update an existing override key/getValue pair or add if it does not exist.

Parameters
pathThe key
typeThe getValue

The documentation for this class was generated from the following files: