xlnt
|
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< path > | parts () 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::relationship > | relationships (const path &source) const |
Returns all relationship with "source" as the source. More... | |
std::vector< xlnt::relationship > | relationships (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< path > | parts_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 |
The manifest keeps track of all files in the OOXML package and their type and relationships.
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.
void xlnt::manifest::clear | ( | ) |
Unregisters all default and override type and all relationships and known parts.
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.
std::string xlnt::manifest::default_type | ( | const std::string & | extension | ) | const |
Returns the registered default content type for parts of the given extension.
std::vector<std::string> xlnt::manifest::extensions_with_default_types | ( | ) | const |
Returns a vector of all extensions with registered default content types.
bool xlnt::manifest::has_default_type | ( | const std::string & | extension | ) | const |
Returns true if a default content type for the extension has been registered.
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.
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.
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.
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.
std::vector<path> xlnt::manifest::parts | ( | ) | const |
Returns the path to all internal package parts registered as a source or target of a relationship.
std::vector<path> xlnt::manifest::parts_with_overriden_types | ( | ) | const |
Returns the path of every part in this manifest with an overriden content type.
void xlnt::manifest::register_default_type | ( | const std::string & | extension, |
const std::string & | type | ||
) |
Associates the given extension with the given content 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.
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.
std::string xlnt::manifest::register_relationship | ( | const class relationship & | rel | ) |
Registers a new relationship already constructed elsewhere.
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.
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.
std::vector<xlnt::relationship> xlnt::manifest::relationships | ( | const path & | source | ) | const |
Returns all relationship with "source" as the source.
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".
void xlnt::manifest::unregister_default_type | ( | const std::string & | extension | ) |
Unregisters the default content type for the given extension.
void xlnt::manifest::unregister_override_type | ( | const path & | part | ) |
Unregisters the overriding content type of the given part.
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].