import IRiffChunk from "./iRiffChunk"; import { ByteVector } from "../byteVector"; import { File } from "../file"; import { ILazy } from "../interfaces"; export default class RiffList implements IRiffChunk, ILazy { /** * FOURCC code for a list chunk */ static readonly IDENTIFIER_FOURCC = "LIST"; private _chunkStart; private _file; private _isLoaded; private _lists; private _originalDataSize; private _type; private _values; private constructor(); /** * Constructs and initializes a new instance with no contents. * @param type Type ID of the list */ static fromEmpty(type: string): RiffList; /** * Constructs and initializes a new instance, lazily, from a position in a file. * @param file File from which to read the current instance * @param position Position in the file where the list begins */ static fromFile(file: File, position: number): RiffList; /** @inheritDoc */ get chunkStart(): number | undefined; /** @inheritDoc */ set chunkStart(value: number); /** @inheritDoc */ get fourcc(): string; /** @inheritDoc */ get isLoaded(): boolean; /** * Total number of nested lists contained in this instance. */ get listCount(): number; /** @inheritDoc */ get originalDataSize(): number; /** @inheritDoc */ get originalTotalSize(): number; /** @internal */ set originalTotalSize(value: number); /** * ID that identifies the type of this list. */ get type(): string; /** * Total number of values contained in this instance. */ get valueCount(): number; /** * Determines if a given chunk is a list. * @param c Chunk to check is a list. */ static isChunkList(c: IRiffChunk): boolean; /** * Removes all values and nested lists from the current instance. */ clear(): void; /** * Retrieves a collection of lists by the lists' key. * @param id Key for looking up the desired lists * @returns * Array of the nested lists with the provided key, or an empty array if * the key does not exist in this instance. */ getLists(id: string): RiffList[]; /** * Retrieves a collection of values by the values' key. * @param id Key for looking up the desired values * @returns * Array of the values with the provided key, or an empty array if the * key does not exist in the instance. */ getValues(id: string): ByteVector[]; /** @inheritDoc */ load(): void; /** * Stores a collection of lists in the current instance, overwriting any that currently exist. * @param id Key for the lists to store * @param lists Collection of lists to store in the current instance */ setLists(id: string, lists: RiffList[]): void; /** * Stores a collection of values in the current instance, overwriting any that currently exist. * @param id Key for the values to store * @param values Collection of values to store in the current instance */ setValues(id: string, values: ByteVector[]): void; /** @inheritDoc */ render(): ByteVector; }