UNPKG

2.08 kBTypeScriptView Raw
1import { IToXmlOptions } from './options';
2import { IElement } from './util';
3import { Value } from './value';
4/**
5 * Plist object.
6 */
7export declare class Plist {
8 /**
9 * Default XML declaration.
10 */
11 static readonly XML_DECLARATION = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
12 /**
13 * Default XML doctype.
14 */
15 static readonly XML_DOCTYPE = "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">";
16 /**
17 * XML declaration.
18 */
19 xmlDeclaration: string;
20 /**
21 * XML doctype.
22 */
23 xmlDoctype: string;
24 /**
25 * Value element.
26 */
27 value: Value | null;
28 /**
29 * Plist constructor.
30 *
31 * @param value The value.
32 */
33 constructor(value?: Value | null);
34 /**
35 * Get value or throw if null.
36 *
37 * @returns The value.
38 */
39 getValue(): Value;
40 /**
41 * Cast to specific type or null.
42 *
43 * @param Type Type constructor.
44 * @returns The object or null.
45 */
46 valueCastTo<T extends typeof Value>(Type: T): T['prototype'] | null;
47 /**
48 * Cast to specific type or throw.
49 *
50 * @param Type Type constructor.
51 * @returns The object.
52 */
53 valueCastAs<T extends typeof Value>(Type: T): T['prototype'];
54 /**
55 * Decode document from string.
56 *
57 * @param xml XML string.
58 */
59 fromXml(xml: string): void;
60 /**
61 * Decode document from element.
62 *
63 * @param element XML element.
64 * @param declaration XML declaration.
65 * @param doctype XML doctype.
66 */
67 fromXmlElement(element: Readonly<IElement>, declaration?: string | null, doctype?: string | null): void;
68 /**
69 * Decode child element from XML element.
70 *
71 * @param element XML element.
72 * @returns Value element.
73 */
74 childFromXmlElement(element: IElement): Value;
75 /**
76 * Encode documents to string.
77 *
78 * @param options Options object.
79 * @returns XML string.
80 */
81 toXml(options?: Readonly<IToXmlOptions> | null): string;
82}