xlnt
Public Member Functions | List of all members
xlnt::manifest Class Reference

The manifest keeps track of all files in the OOXML package and their type and relationships. More...

#include <manifest.hpp>

Public Member Functions

void clear ()
 Unregisters all default and override type and all relationships and known parts. More...
 
std::vector< pathparts () const
 Returns the path to all internal package parts registered as a source or target of a relationship. More...
 
bool has_relationship (const path &source, relationship_type type) const
 Returns true if the manifest contains a relationship with the given type with part as the source. More...
 
bool has_relationship (const path &source, const std::string &rel_id) const
 Returns true if the manifest contains a relationship with the given type with part as the source. More...
 
class relationship relationship (const path &source, relationship_type type) const
 Returns the relationship with "source" as the source and with a type of "type". Throws a key_not_found exception if no such relationship is found. More...
 
class relationship relationship (const path &source, const std::string &rel_id) const
 Returns the relationship with "source" as the source and with an ID of "rel_id". Throws a key_not_found exception if no such relationship is found. More...
 
std::vector< xlnt::relationshiprelationships (const path &source) const
 Returns all relationship with "source" as the source. More...
 
std::vector< xlnt::relationshiprelationships (const path &source, relationship_type type) const
 Returns all relationships with "source" as the source and with a type of "type". More...
 
path canonicalize (const std::vector< xlnt::relationship > &rels) const
 Returns the canonical path of the chain of relationships by traversing through rels and forming the absolute combined path. More...
 
std::string register_relationship (const uri &source, relationship_type type, const uri &target, target_mode mode)
 Registers a new relationship by specifying all of the relationship properties explicitly. More...
 
std::string register_relationship (const class relationship &rel)
 Registers a new relationship already constructed elsewhere. More...
 
std::unordered_map< std::string, std::string > unregister_relationship (const uri &source, const std::string &rel_id)
 Delete the relationship with the given id from source part. Returns a mapping of relationship IDs since IDs are shifted down. For example, if there are three relationships for part a.xml like [rId1, rId2, rId3] and rId2 is deleted, the resulting map would look like [rId3->rId2]. More...
 
std::string content_type (const path &part) const
 Given the path to a part, returns the content type of the part as a string. More...
 
bool has_default_type (const std::string &extension) const
 Returns true if a default content type for the extension has been registered. More...
 
std::vector< std::string > extensions_with_default_types () const
 Returns a vector of all extensions with registered default content types. More...
 
std::string default_type (const std::string &extension) const
 Returns the registered default content type for parts of the given extension. More...
 
void register_default_type (const std::string &extension, const std::string &type)
 Associates the given extension with the given content type. More...
 
void unregister_default_type (const std::string &extension)
 Unregisters the default content type for the given extension. More...
 
bool has_override_type (const path &part) const
 Returns true if a content type overriding the default content type has been registered for the given part. More...
 
std::string override_type (const path &part) const
 Returns the override content type registered for the given part. Throws key_not_found exception if no override type was found. More...
 
std::vector< pathparts_with_overriden_types () const
 Returns the path of every part in this manifest with an overriden content type. More...
 
void register_override_type (const path &part, const std::string &type)
 Overrides any default type registered for the part's extension with the given content type. More...
 
void unregister_override_type (const path &part)
 Unregisters the overriding content type of the given part. More...
 
bool operator== (const manifest &other) const
 

Detailed Description

The manifest keeps track of all files in the OOXML package and their type and relationships.

Member Function Documentation

◆ canonicalize()

path xlnt::manifest::canonicalize ( const std::vector< xlnt::relationship > &  rels) const

Returns the canonical path of the chain of relationships by traversing through rels and forming the absolute combined path.

◆ clear()

void xlnt::manifest::clear ( )

Unregisters all default and override type and all relationships and known parts.

◆ content_type()

std::string xlnt::manifest::content_type ( const path part) const

Given the path to a part, returns the content type of the part as a string.

◆ default_type()

std::string xlnt::manifest::default_type ( const std::string &  extension) const

Returns the registered default content type for parts of the given extension.

◆ extensions_with_default_types()

std::vector<std::string> xlnt::manifest::extensions_with_default_types ( ) const

Returns a vector of all extensions with registered default content types.

◆ has_default_type()

bool xlnt::manifest::has_default_type ( const std::string &  extension) const

Returns true if a default content type for the extension has been registered.

◆ has_override_type()

bool xlnt::manifest::has_override_type ( const path part) const

Returns true if a content type overriding the default content type has been registered for the given part.

◆ has_relationship() [1/2]

bool xlnt::manifest::has_relationship ( const path source,
relationship_type  type 
) const

Returns true if the manifest contains a relationship with the given type with part as the source.

◆ has_relationship() [2/2]

bool xlnt::manifest::has_relationship ( const path source,
const std::string &  rel_id 
) const

Returns true if the manifest contains a relationship with the given type with part as the source.

◆ override_type()

std::string xlnt::manifest::override_type ( const path part) const

Returns the override content type registered for the given part. Throws key_not_found exception if no override type was found.

◆ parts()

std::vector<path> xlnt::manifest::parts ( ) const

Returns the path to all internal package parts registered as a source or target of a relationship.

◆ parts_with_overriden_types()

std::vector<path> xlnt::manifest::parts_with_overriden_types ( ) const

Returns the path of every part in this manifest with an overriden content type.

◆ register_default_type()

void xlnt::manifest::register_default_type ( const std::string &  extension,
const std::string &  type 
)

Associates the given extension with the given content type.

◆ register_override_type()

void xlnt::manifest::register_override_type ( const path part,
const std::string &  type 
)

Overrides any default type registered for the part's extension with the given content type.

◆ register_relationship() [1/2]

std::string xlnt::manifest::register_relationship ( const uri source,
relationship_type  type,
const uri target,
target_mode  mode 
)

Registers a new relationship by specifying all of the relationship properties explicitly.

◆ register_relationship() [2/2]

std::string xlnt::manifest::register_relationship ( const class relationship rel)

Registers a new relationship already constructed elsewhere.

◆ relationship() [1/2]

class relationship xlnt::manifest::relationship ( const path source,
const std::string &  rel_id 
) const

Returns the relationship with "source" as the source and with an ID of "rel_id". Throws a key_not_found exception if no such relationship is found.

◆ relationship() [2/2]

class relationship xlnt::manifest::relationship ( const path source,
relationship_type  type 
) const

Returns the relationship with "source" as the source and with a type of "type". Throws a key_not_found exception if no such relationship is found.

◆ relationships() [1/2]

std::vector<xlnt::relationship> xlnt::manifest::relationships ( const path source) const

Returns all relationship with "source" as the source.

◆ relationships() [2/2]

std::vector<xlnt::relationship> xlnt::manifest::relationships ( const path source,
relationship_type  type 
) const

Returns all relationships with "source" as the source and with a type of "type".

◆ unregister_default_type()

void xlnt::manifest::unregister_default_type ( const std::string &  extension)

Unregisters the default content type for the given extension.

◆ unregister_override_type()

void xlnt::manifest::unregister_override_type ( const path part)

Unregisters the overriding content type of the given part.

◆ unregister_relationship()

std::unordered_map<std::string, std::string> xlnt::manifest::unregister_relationship ( const uri source,
const std::string &  rel_id 
)

Delete the relationship with the given id from source part. Returns a mapping of relationship IDs since IDs are shifted down. For example, if there are three relationships for part a.xml like [rId1, rId2, rId3] and rId2 is deleted, the resulting map would look like [rId3->rId2].


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