public TagName(string name, NamespacePrefix namespacePrefix) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (namespacePrefix == null) { throw new ArgumentNullException(nameof(namespacePrefix)); } this.name = name; this.namespacePrefix = namespacePrefix; }
public Selector <Element> Universal(NamespacePrefix prefix) { return(prefix.IsSpecific ? (Selector <Element>)(nodes => Enumerable.Empty <Element>()) : (Selector <Element>)(nodes => nodes)); }
public Selector <SvgElement> AttributeExists(NamespacePrefix prefix, string name) { return(nodes => nodes.Where(n => n.Attributes.ContainsKey(name) || n.CustomAttributes.ContainsKey(name))); }
public Selector <SvgElement> Type(NamespacePrefix prefix, string name) { var type = SvgElementFactory.AvailableElements.SingleOrDefault(e => e.ElementName == name); return(nodes => nodes.Where(n => n.GetType() == type.ElementType)); }
/// <summary> /// Generates a <a href="http://www.w3.org/TR/css3-selectors/#universal-selector">universal selector</a>, /// any single element in the document tree in any namespace /// (including those without a namespace) if no default namespace /// has been specified for selectors. /// </summary> public virtual Selector <HtmlNode> Universal(NamespacePrefix prefix) => prefix.IsSpecific ? (Selector <HtmlNode>)(nodes => Enumerable.Empty <HtmlNode>()) : (nodes => nodes.Elements());
public void NamespacePrefix_does_not_match_sibling_namespace_with_same_textual_prefix() { NamespacePrefix p = new NamespacePrefix("System.Web"); Assert.IsFalse(p.Matches("System.WebServer")); }
public void NamespacePrefix_matches_child_namespaces() { NamespacePrefix p = new NamespacePrefix("System.Web.*"); Assert.IsTrue(p.Matches("System.Web.UI.Page")); }
public void AttributeExists(NamespacePrefix prefix, string name) { }
public void Type(NamespacePrefix prefix, string name) { TypePrefix = prefix; TypeName = name; }
/// <summary> /// Create the template output /// </summary> public override string TransformText() { #line 1 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" // This template creates an inherited type, e.g., type MyFloat float64 in a <PackageName>_<StructName>StructOf(<GoTypeName>).cs file #line default #line hidden this.Write(@"//--------------------------------------------------------- // <auto-generated> // This code was generated by a tool. Changes to this // file may cause incorrect behavior and will be lost // if the code is regenerated. // // Generated on "); #line 10 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(GeneratedTime)); #line default #line hidden this.Write("\r\n// </auto-generated>\r\n//-------------------------------------------------------" + "--\r\nusing System.CodeDom.Compiler;\r\nusing System.Runtime.CompilerServices;\r\n"); #line 15 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" if (!NamespacePrefix.Equals("go")) { #line default #line hidden this.Write("using go;\r\n"); #line 17 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" } #line default #line hidden this.Write("\r\n#nullable enable\r\n\r\n"); #line 21 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(NamespaceHeader)); #line default #line hidden this.Write("\r\n public static partial class "); #line 22 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(PackageName)); #line default #line hidden this.Write("_package\r\n {\r\n ["); #line 24 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(GeneratedCodeAttribute)); #line default #line hidden this.Write("]\r\n "); #line 25 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Scope)); #line default #line hidden this.Write(" partial struct "); #line 25 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write("\r\n {\r\n // Value of the "); #line 27 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write(" struct\r\n private readonly "); #line 28 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TypeName)); #line default #line hidden this.Write(" m_value;\r\n\r\n public "); #line 30 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write("("); #line 30 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TypeName)); #line default #line hidden this.Write(" value) => m_value = value;\r\n\r\n // Enable implicit conversions between" + " "); #line 32 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TypeName)); #line default #line hidden this.Write(" and "); #line 32 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write(" struct\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n " + " public static implicit operator "); #line 34 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write("("); #line 34 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TypeName)); #line default #line hidden this.Write(" value) => new "); #line 34 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write("(value);\r\n \r\n [MethodImpl(MethodImplOptions.AggressiveInlin" + "ing)]\r\n public static implicit operator "); #line 37 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TypeName)); #line default #line hidden this.Write("("); #line 37 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write(" value) => value.m_value;\r\n \r\n // Enable comparisons betwee" + "n nil and "); #line 39 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write(" struct\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n " + " public static bool operator ==("); #line 41 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write(" value, NilType nil) => value.Equals(default("); #line 41 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write("));\r\n\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n " + " public static bool operator !=("); #line 44 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write(" value, NilType nil) => !(value == nil);\r\n\r\n [MethodImpl(MethodImplOpt" + "ions.AggressiveInlining)]\r\n public static bool operator ==(NilType ni" + "l, "); #line 47 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write(" value) => value == nil;\r\n\r\n [MethodImpl(MethodImplOptions.AggressiveI" + "nlining)]\r\n public static bool operator !=(NilType nil, "); #line 50 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write(" value) => value != nil;\r\n\r\n [MethodImpl(MethodImplOptions.AggressiveI" + "nlining)]\r\n public static implicit operator "); #line 53 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write("(NilType nil) => default("); #line 53 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write(");\r\n }\r\n }\r\n"); #line 56 "D:\Projects\go2cs\src\go2cs.Templates\InheritedTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(NamespaceFooter)); #line default #line hidden this.Write("\r\n"); return(this.GenerationEnvironment.ToString()); }
public void AttributeSubstring(NamespacePrefix prefix, string name, string value) { }
public void AttributeSuffixMatch(NamespacePrefix prefix, string name, string value) { }
public void AttributeIncludes(NamespacePrefix prefix, string name, string value) { }
public void AttributeExact(NamespacePrefix prefix, string name, string value) { }
public void Equality() { Assert.That(NamespacePrefix.None.Equals(NamespacePrefix.None), Is.True); Assert.That(NamespacePrefix.Any.Equals(NamespacePrefix.Any), Is.True); Assert.That(NamespacePrefix.Empty.Equals(NamespacePrefix.Empty), Is.True); var foo = new NamespacePrefix("foo"); Assert.That(foo.Equals(foo), Is.True); Assert.That(foo.Equals((object) foo), Is.True); }
public void Inequality() { var foo = new NamespacePrefix("foo"); var bar = new NamespacePrefix("bar"); Assert.That(foo.Equals(bar), Is.False); Assert.That(foo.Equals((object)bar), Is.False); }
public void Universal(NamespacePrefix prefix) { UniversalPrefix = prefix; }
/// <summary> /// Create the template output /// </summary> public override string TransformText() { #line 1 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" // This template creates a <PackageName>_<StructName>Struct.cs file #line default #line hidden this.Write(@"//--------------------------------------------------------- // <auto-generated> // This code was generated by a tool. Changes to this // file may cause incorrect behavior and will be lost // if the code is regenerated. // // Generated on "); #line 17 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(GeneratedTime)); #line default #line hidden this.Write("\r\n// </auto-generated>\r\n//-------------------------------------------------------" + "--\r\nusing System;\r\nusing System.CodeDom.Compiler;\r\nusing System.Diagnostics;\r\nus" + "ing System.Reflection;\r\nusing System.Runtime.CompilerServices;\r\n"); #line 25 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(string.Join(Environment.NewLine, UsingStatements))); #line default #line hidden this.Write("\r\n"); #line 26 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" if (!NamespacePrefix.Equals("go")) { #line default #line hidden this.Write("using go;\r\n"); #line 28 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" } #line default #line hidden this.Write("\r\n#nullable enable\r\n\r\n"); #line 32 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(NamespaceHeader)); #line default #line hidden this.Write("\r\n public static partial class "); #line 33 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(PackageName)); #line default #line hidden this.Write("_package\r\n {\r\n ["); #line 35 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(GeneratedCodeAttribute)); #line default #line hidden this.Write("]"); #line 35 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" foreach (string promotedStruct in PromotedStructs) { if (!string.IsNullOrEmpty(promotedStruct)) { #line default #line hidden this.Write("\r\n [PromotedStruct(typeof("); #line 42 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(promotedStruct)); #line default #line hidden this.Write("))]"); #line 42 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" } } #line default #line hidden this.Write("\r\n "); #line 46 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Scope)); #line default #line hidden this.Write(" partial struct "); #line 46 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write("\r\n {"); #line 47 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" foreach (KeyValuePair <string, List <FunctionSignature> > kvp in PromotedFunctions) { foreach (var decl in kvp.Value) { #line default #line hidden #line 52 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(new StructFuncDeclTemplate { PromotedField = kvp.Key, FunctionName = decl.Name, Scope = "public", ParameterSignature = decl.Signature.GenerateParametersSignature(), ParameterNames = GetParameterNames(decl), ParameterTypes = GetParameterTypeNames(decl), ResultType = decl.Signature.GenerateResultSignature() } .TransformText())); #line default #line hidden #line 62 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" } } foreach (KeyValuePair <string, List <FieldInfo> > kvp in PromotedFields) { FieldInfo promotedStruct = GetPromotedStruct(kvp.Key); bool isPointer = promotedStruct?.Type is PointerTypeInfo; #line default #line hidden this.Write("\r\n // "); #line 73 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(kvp.Key)); #line default #line hidden this.Write(" structure promotion - sourced from "); #line 73 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(isPointer ? "pointer" : "value copy")); #line default #line hidden this.Write("\r\n private readonly ptr<"); #line 74 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(kvp.Key)); #line default #line hidden this.Write("> m_"); #line 74 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(kvp.Key)); #line default #line hidden this.Write("Ref;\r\n\r\n private ref "); #line 76 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(kvp.Key)); #line default #line hidden this.Write(" "); #line 76 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(kvp.Key)); #line default #line hidden this.Write("_"); #line 76 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(isPointer ? "ptr" : "val")); #line default #line hidden this.Write(" => ref m_"); #line 76 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(kvp.Key)); #line default #line hidden this.Write("Ref.Value;\r\n"); #line 77 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" foreach (var decl in kvp.Value) { #line default #line hidden this.Write("\r\n public ref "); #line 83 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(decl.Type.TypeName)); #line default #line hidden this.Write(" "); #line 83 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(decl.Name)); #line default #line hidden this.Write(" => ref m_"); #line 83 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(kvp.Key)); #line default #line hidden this.Write("Ref.Value."); #line 83 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(decl.Name)); #line default #line hidden this.Write(";\r\n"); #line 84 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" } } if (PromotedFunctions.Count > 0) { #line default #line hidden this.Write(" \r\n [DebuggerStepperBoundary]\r\n static "); #line 93 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write("()\r\n {\r\n Type targetType = typeof("); #line 95 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write(");\r\n MethodInfo extensionMethod;"); #line 96 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" foreach (KeyValuePair <string, List <FunctionSignature> > kvp in PromotedFunctions) { foreach (var decl in kvp.Value) { #line default #line hidden #line 102 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(new StructFuncInitTemplate { FunctionName = decl.Name } .TransformText())); #line default #line hidden #line 106 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" } } #line default #line hidden this.Write("\r\n }\r\n"); #line 111 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" } #line default #line hidden this.Write("\r\n // Constructors\r\n public "); #line 116 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write("(NilType _)\r\n {"); #line 117 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" foreach (var decl in StructFields) { if (PromotedStructs.Contains(decl.Type.TypeName)) { // Promoted struct #line default #line hidden this.Write("\r\n this.m_"); #line 124 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(decl.Name)); #line default #line hidden this.Write("Ref = new ptr<"); #line 124 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(decl.Type.TypeName)); #line default #line hidden this.Write(">(new "); #line 124 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(decl.Type.TypeName)); #line default #line hidden this.Write("(nil));"); #line 124 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" } else { // Promoted interface or normal struct field #line default #line hidden this.Write("\r\n this."); #line 130 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(decl.Name)); #line default #line hidden this.Write(" = default;"); #line 130 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" } } #line default #line hidden this.Write("\r\n }"); #line 134 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" if (StructFields.Length > 0) { #line default #line hidden this.Write("\r\n\r\n public "); #line 140 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write("("); #line 140 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(string.Join(", ", StructFields.Select(field => $"{(field.Type is PointerTypeInfo ? "ref " : "")}{field.Type.TypeName} {field.Name} = default")))); #line default #line hidden this.Write(")\r\n {"); #line 141 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" foreach (var decl in StructFields) { if (PromotedStructs.Contains(decl.Type.TypeName)) { // Promoted struct #line default #line hidden this.Write("\r\n this.m_"); #line 148 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(decl.Name)); #line default #line hidden this.Write("Ref = new ptr<"); #line 148 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(decl.Type.TypeName)); #line default #line hidden this.Write(">("); #line 148 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(decl.Type is PointerTypeInfo ? "ref " : "")); #line default #line hidden #line 148 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(decl.Name)); #line default #line hidden this.Write(");"); #line 148 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" } else { // Promoted interface or normal struct field #line default #line hidden this.Write("\r\n this."); #line 154 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(decl.Name)); #line default #line hidden this.Write(" = "); #line 154 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(decl.Name)); #line default #line hidden this.Write(";"); #line 154 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" } } #line default #line hidden this.Write("\r\n }\r\n"); #line 159 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" } #line default #line hidden this.Write("\r\n // Enable comparisons between nil and "); #line 162 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write(" struct\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n " + " public static bool operator ==("); #line 164 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write(" value, NilType nil) => value.Equals(default("); #line 164 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write("));\r\n\r\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r\n " + " public static bool operator !=("); #line 167 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write(" value, NilType nil) => !(value == nil);\r\n\r\n [MethodImpl(MethodImplOpt" + "ions.AggressiveInlining)]\r\n public static bool operator ==(NilType ni" + "l, "); #line 170 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write(" value) => value == nil;\r\n\r\n [MethodImpl(MethodImplOptions.AggressiveI" + "nlining)]\r\n public static bool operator !=(NilType nil, "); #line 173 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write(" value) => value != nil;\r\n\r\n [MethodImpl(MethodImplOptions.AggressiveI" + "nlining)]\r\n public static implicit operator "); #line 176 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write("(NilType nil) => default("); #line 176 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write(");\r\n }\r\n\r\n ["); #line 179 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(GeneratedCodeAttribute)); #line default #line hidden this.Write("]\r\n "); #line 180 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Scope)); #line default #line hidden this.Write(" static "); #line 180 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write(" "); #line 180 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write("_cast(dynamic value)\r\n {\r\n return new "); #line 182 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(StructName)); #line default #line hidden this.Write("("); #line 182 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(GetConstructorParameterNames())); #line default #line hidden this.Write(");\r\n }\r\n }\r\n"); #line 185 "D:\Projects\go2cs\src\go2cs.Templates\StructTypeTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(NamespaceFooter)); #line default #line hidden return(this.GenerationEnvironment.ToString()); }
public void AttributeExists(NamespacePrefix prefix, string name) { AttributeExistsPrefix = prefix; AttributeExistsName = name; }
public void NamespacePrefix_matches_exact_namespaces() { NamespacePrefix p = new NamespacePrefix("System.Web"); Assert.IsTrue(p.Matches("System.Web")); }
public void AttributeExact(NamespacePrefix prefix, string name, string value) { AttributeExactPrefix = prefix; AttributeExactName = name; AttributeExactValue = value; }
/// <summary> /// Generates a <a href="http://www.w3.org/TR/css3-selectors/#type-selectors">type selector</a>, /// which represents an instance of the element type in the document tree. /// </summary> public virtual Selector <HtmlNode> Type(NamespacePrefix prefix, string type) => prefix.IsSpecific ? (Selector <HtmlNode>)(nodes => Enumerable.Empty <HtmlNode>()) : (nodes => nodes.Elements().Where(n => n.Name == type));
public void AttributeIncludes(NamespacePrefix prefix, string name, string value) { AttributeIncludesPrefix = prefix; AttributeIncludesName = name; AttributeIncludesValue = value; }
/// <summary> /// Generates an <a href="http://www.w3.org/TR/css3-selectors/#attribute-selectors">attribute selector</a> /// that represents an element with the given attribute <paramref name="name"/> /// whatever the values of the attribute. /// </summary> public virtual Selector <HtmlNode> AttributeExists(NamespacePrefix prefix, string name) => prefix.IsSpecific ? (Selector <HtmlNode>)(nodes => Enumerable.Empty <HtmlNode>()) : (nodes => nodes.Elements().Where(n => n.Attributes[name] != null));
public void AttributeSuffixMatch(NamespacePrefix prefix, string name, string value) { AttributeSuffixMatchPrefix = prefix; AttributeSuffixMatchName = name; AttributeSuffixMatchValue = value; }
public Selector <SvgElement> Universal(NamespacePrefix prefix) { return(nodes => nodes); }
public void AttributeSubstring(NamespacePrefix prefix, string name, string value) { AttributeSubstringPrefix = prefix; AttributeSubstringName = name; AttributeSubstringValue = value; }
public Selector <Element> Type(NamespacePrefix prefix, string name) { return(prefix.IsSpecific ? (Selector <Element>)(nodes => Enumerable.Empty <Element>()) : (Selector <Element>)(nodes => nodes.Where(n => n.TagName.ToUpper() == name.ToUpper()))); }
public virtual Selector <XmlNode> Type(NamespacePrefix prefix, string type) { // TODO Proper namespace support return(nodes => nodes.Where(n => n.Name == type)); }
public Selector <Element> AttributeDashMatch(NamespacePrefix prefix, string name, string value) { throw new NotImplementedException(); }
public virtual Selector <XmlNode> Universal(NamespacePrefix prefix) { // TODO Proper namespace support return(nodes => nodes.Elements()); }
public void HashCode() { var foo = new NamespacePrefix("foo"); var bar = new NamespacePrefix("bar"); Assert.That(foo.GetHashCode() == bar.GetHashCode(), Is.False); }
public virtual Selector <XmlNode> AttributeExists(NamespacePrefix prefix, string name) { // TODO Proper namespace support return(nodes => nodes.Elements().Where(n => n.Attributes[name] != null)); }
public void TypeEquality() { var foo = new NamespacePrefix("foo"); Assert.That(foo, Is.Not.EqualTo(null)); Assert.That(foo, Is.Not.EqualTo(123)); }
public void Universal(NamespacePrefix prefix) { }