From 6a24996a2e831cfe402398af65b31fb1ecd575a9 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 22 Apr 2021 16:36:39 -0700 Subject: Move WixBuildTools into internal --- .../WixBuildTools.XsdGen/CodeDomInterfaces.cs | 96 ++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 src/internal/WixBuildTools.XsdGen/CodeDomInterfaces.cs (limited to 'src/internal/WixBuildTools.XsdGen/CodeDomInterfaces.cs') diff --git a/src/internal/WixBuildTools.XsdGen/CodeDomInterfaces.cs b/src/internal/WixBuildTools.XsdGen/CodeDomInterfaces.cs new file mode 100644 index 00000000..850839d4 --- /dev/null +++ b/src/internal/WixBuildTools.XsdGen/CodeDomInterfaces.cs @@ -0,0 +1,96 @@ +// 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. + +namespace WixToolset.Serialize +{ + using System; + using System.Collections; + using System.Xml; + + /// + /// Interface for generated schema elements. + /// + public interface ISchemaElement + { + /// + /// Gets and sets the parent of this element. May be null. + /// + /// An ISchemaElement that has this element as a child. + ISchemaElement ParentElement + { + get; + set; + } + + /// + /// Outputs xml representing this element, including the associated attributes + /// and any nested elements. + /// + /// XmlTextWriter to be used when outputting the element. + void OutputXml(XmlWriter writer); + } + + /// + /// Interface for generated schema elements. Implemented by elements that have child + /// elements. + /// + public interface IParentElement + { + /// + /// Gets an enumerable collection of the children of this element. + /// + /// An enumerable collection of the children of this element. + IEnumerable Children + { + get; + } + + /// + /// Gets an enumerable collection of the children of this element, filtered + /// by the passed in type. + /// + /// The type of children to retrieve. + IEnumerable this[Type childType] + { + get; + } + + /// + /// Adds a child to this element. + /// + /// Child to add. + void AddChild(ISchemaElement child); + + /// + /// Removes a child from this element. + /// + /// Child to remove. + void RemoveChild(ISchemaElement child); + } + + /// + /// Interface for generated schema elements. Implemented by classes with attributes. + /// + public interface ISetAttributes + { + /// + /// Sets the attribute with the given name to the given value. The value here is + /// a string, and is converted to the strongly-typed version inside this method. + /// + /// The name of the attribute to set. + /// The value to assign to the attribute. + void SetAttribute(string name, string value); + } + + /// + /// Interface for generated schema elements. Implemented by classes with children. + /// + public interface ICreateChildren + { + /// + /// Creates an instance of the child with the passed in name. + /// + /// String matching the element name of the child when represented in XML. + /// An instance of that child. + ISchemaElement CreateChild(string childName); + } +} -- cgit v1.2.3-55-g6feb