UNPKG

1.63 kBTypeScriptView Raw
1/**
2 * Copyright (C) 2016-2019 Michael Kourlas
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16/**
17 * The options used to create a new entity reference.
18 */
19export interface IXmlEntityRefOptions {
20 /**
21 * The name of the entity to be referenced.
22 */
23 name: string;
24}
25/**
26 * Represents an entity reference.
27 *
28 * An entity reference is structured as follows, where `{name}` is the name of
29 * the entity to be referenced:
30 *
31 * ```xml
32 * &{entity};
33 * ```
34 */
35export default class XmlEntityRef<Parent> {
36 private readonly _validation;
37 private readonly _parent;
38 private _name;
39 constructor(parent: Parent, validation: boolean, options: IXmlEntityRefOptions);
40 /**
41 * Gets the name of this entity reference.
42 */
43 get name(): string;
44 /**
45 * Sets the name of this entity reference.
46 */
47 set name(name: string);
48 /**
49 * Returns an XML string representation of this entity reference.
50 */
51 toString(): string;
52 /**
53 * Returns the parent of this entity reference.
54 */
55 up(): Parent;
56}