ddn.odf.container.asset

ODF package asset and embedded object handling.

Provides package-level abstractions for binary and XML streams within an ODF ZIP container. Supports pictures, thumbnails, embedded objects, scripts, and arbitrary binary payloads at a preservation level.

Types 3

Classification of an asset within an ODF package.

Each member corresponds to a well-known ODF path convention (pictures, thumbnails, embedded objects, scripts, etc.).

UNKNOWN
PICTURE
THUMBNAIL
EMBEDDED_OBJECT
EMBEDDED_PACKAGE
SCRIPT
TEMPLATE
XML_STREAM
BINARY_STREAM
DIRECTORY
structOdfAsset

Describes a single binary or XML stream inside an ODF package.

Holds the path, MIME type, classification, and preservation flags needed to handle the entry during read-modify-write cycles.

Fields
string fullPath
string mediaType
bool compressionEnabled
bool preservationRequired
Methods
bool isPicture() @property const @safe pure nothrow @nogcReturns `true` if this asset is a picture.
bool isThumbnail() @property const @safe pure nothrow @nogcReturns `true` if this asset is a thumbnail.
bool isEmbeddedObject() @property const @safe pure nothrow @nogcReturns `true` if this asset is an embedded object or embedded package.
bool isScript() @property const @safe pure nothrow @nogcReturns `true` if this asset is a macro script.
bool isXml() @property const @safe pure nothrow @nogcReturns `true` if this asset is an XML stream.
bool isDirectory() @property const @safe pure nothrow @nogcReturns `true` if this asset is a directory entry.
OdfAssetKind classifyKind(string path, string mediaType) @safe pure nothrowDetermines the asset kind from its path and MIME media type.
OdfAsset from(string path, string mediaType) @safe pure nothrowConstructs an OdfAsset from a package path and MIME type.
bool startsWithP(string s, string prefix) @safe pure nothrow @nogc
bool endsWithS(string s, string suffix) @safe pure nothrow @nogc
bool endsWithPng(string s) @safe pure nothrow @nogc
bool endsWithXml(string s) @safe pure nothrow @nogc

An indexed collection of OdfAsset entries keyed by path.

Provides lookup, enumeration, and filtering by OdfAssetKind. Duplicates (same path) are silently skipped on insertion.

Fields
private OdfAsset[] _assets
private size_t[string] _index
Methods
const(OdfAsset)[] assets() @property const @safe pure nothrow @nogcAll assets in insertion order.
size_t count() @property const @safe pure nothrow @nogcNumber of assets in the index.
bool contains(string path) const @safe pure nothrow @nogcChecks whether an asset with the given path exists.
const(OdfAsset) * get(string path) const @safe pure nothrowRetrieves a pointer to the asset at the given path.
void add(string path, string mediaType)Adds an asset for the given path and media type.
void addFromManifest(ManifestModel manifest)Populates the index from all entries in a manifest model.
const(OdfAsset)[] byKind(OdfAssetKind kind) constReturns all assets matching the given kind.
const(OdfAsset)[] pictures() @property constAll picture assets.
const(OdfAsset)[] thumbnails() @property constAll thumbnail assets.
const(OdfAsset)[] embeddedObjects() @property constAll embedded-object and embedded-package assets.
const(OdfAsset)[] scripts() @property constAll macro-script assets.
Constructors
this()Constructs an empty asset index.