diff options
Diffstat (limited to 'src/tools/heat/Serialize/CodeDomInterfaces.cs')
-rw-r--r-- | src/tools/heat/Serialize/CodeDomInterfaces.cs | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/src/tools/heat/Serialize/CodeDomInterfaces.cs b/src/tools/heat/Serialize/CodeDomInterfaces.cs new file mode 100644 index 00000000..bd674db6 --- /dev/null +++ b/src/tools/heat/Serialize/CodeDomInterfaces.cs | |||
@@ -0,0 +1,96 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Harvesters.Serialize | ||
4 | { | ||
5 | using System; | ||
6 | using System.Collections; | ||
7 | using System.Xml; | ||
8 | |||
9 | /// <summary> | ||
10 | /// Interface for generated schema elements. | ||
11 | /// </summary> | ||
12 | public interface ISchemaElement | ||
13 | { | ||
14 | /// <summary> | ||
15 | /// Gets and sets the parent of this element. May be null. | ||
16 | /// </summary> | ||
17 | /// <value>An ISchemaElement that has this element as a child.</value> | ||
18 | ISchemaElement ParentElement | ||
19 | { | ||
20 | get; | ||
21 | set; | ||
22 | } | ||
23 | |||
24 | /// <summary> | ||
25 | /// Outputs xml representing this element, including the associated attributes | ||
26 | /// and any nested elements. | ||
27 | /// </summary> | ||
28 | /// <param name="writer">XmlWriter to be used when outputting the element.</param> | ||
29 | void OutputXml(XmlWriter writer); | ||
30 | } | ||
31 | |||
32 | /// <summary> | ||
33 | /// Interface for generated schema elements. Implemented by elements that have child | ||
34 | /// elements. | ||
35 | /// </summary> | ||
36 | public interface IParentElement | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// Gets an enumerable collection of the children of this element. | ||
40 | /// </summary> | ||
41 | /// <value>An enumerable collection of the children of this element.</value> | ||
42 | IEnumerable Children | ||
43 | { | ||
44 | get; | ||
45 | } | ||
46 | |||
47 | /// <summary> | ||
48 | /// Gets an enumerable collection of the children of this element, filtered | ||
49 | /// by the passed in type. | ||
50 | /// </summary> | ||
51 | /// <param name="childType">The type of children to retrieve.</param> | ||
52 | IEnumerable this[Type childType] | ||
53 | { | ||
54 | get; | ||
55 | } | ||
56 | |||
57 | /// <summary> | ||
58 | /// Adds a child to this element. | ||
59 | /// </summary> | ||
60 | /// <param name="child">Child to add.</param> | ||
61 | void AddChild(ISchemaElement child); | ||
62 | |||
63 | /// <summary> | ||
64 | /// Removes a child from this element. | ||
65 | /// </summary> | ||
66 | /// <param name="child">Child to remove.</param> | ||
67 | void RemoveChild(ISchemaElement child); | ||
68 | } | ||
69 | |||
70 | /// <summary> | ||
71 | /// Interface for generated schema elements. Implemented by classes with attributes. | ||
72 | /// </summary> | ||
73 | public interface ISetAttributes | ||
74 | { | ||
75 | /// <summary> | ||
76 | /// Sets the attribute with the given name to the given value. The value here is | ||
77 | /// a string, and is converted to the strongly-typed version inside this method. | ||
78 | /// </summary> | ||
79 | /// <param name="name">The name of the attribute to set.</param> | ||
80 | /// <param name="value">The value to assign to the attribute.</param> | ||
81 | void SetAttribute(string name, string value); | ||
82 | } | ||
83 | |||
84 | /// <summary> | ||
85 | /// Interface for generated schema elements. Implemented by classes with children. | ||
86 | /// </summary> | ||
87 | public interface ICreateChildren | ||
88 | { | ||
89 | /// <summary> | ||
90 | /// Creates an instance of the child with the passed in name. | ||
91 | /// </summary> | ||
92 | /// <param name="childName">String matching the element name of the child when represented in XML.</param> | ||
93 | /// <returns>An instance of that child.</returns> | ||
94 | ISchemaElement CreateChild(string childName); | ||
95 | } | ||
96 | } | ||