import EbmlElement from "../ebml/ebmlElement"; import { ByteVector } from "../byteVector"; /** * Represents a value stored in a Matroska tag. */ export default class MatroskaTagValue { static readonly DEFAULT_LANGUAGE_CODE = "und"; private readonly _matroskaVersion; private _isDefaultLanguage; private _isLanguageCodeBcp47; private _languageCode; private _name; private _nestedTags; private _value; /** * Constructs and initializes a new instance. * @param matroskaVersion Version of Matroska file the tag should be written for * @private */ private constructor(); /** * Constructs and initializes a new, empty tag. * @param matroskaVersion Version of Matroska file the tag should be written for * @param name Name of the tag value * @param value Value to store in the tag value */ static fromValue(matroskaVersion: number, name: string, value: string | ByteVector): MatroskaTagValue; /** * Constructs and initializes a new tag using a {@link EbmlParser} that points to a tag. * @param element Root element of a tag * @param matroskaVersion Version of Matroska file the tag should be written for */ static fromSimpleTagElement(element: EbmlElement, matroskaVersion: number): MatroskaTagValue; /** * Gets whether the current tag value is binary. */ get isBinary(): boolean; /** * Gets whether the current tag value is in the default language. */ get isDefaultLanguage(): boolean; /** * Set whether the current tag value is in the default language. */ set isDefaultLanguage(value: boolean); /** * Gets whether the current tag value is a string. */ get isString(): boolean; /** * Gets the language code that the tag value is stored in. */ get languageCode(): string; /** * Sets the language code that the tag is stored in. * @remarks * BCP-47 is only allowed in Matroska version 4, otherwise ISO 639-2 is the required * format for language codes. */ set languageCode(value: string); /** * Gets the name of the tag. */ get name(): string; /** * Sets the name of the tag. */ set name(value: string); /** * Gets any tags that are nested under the current instance. */ get nestedTags(): MatroskaTagValue[]; /** * Sets any tags that are nested under the current instance. */ set nestedTags(value: MatroskaTagValue[]); /** * Gets the value stored in the current instance. Use {@link isBinary} or {@link isString} to * determine whether the return value is `string` or {@link ByteVector}. */ get value(): string | ByteVector; /** * Sets the value stored in the current instance. */ set value(v: string | ByteVector); }