/// <summary> /// Handles a parameter directive, outputting an extra property. /// </summary> /// <param name="directive">The parameter directive.</param> private void HandleParameterDirective([NotNull] IT4Directive directive) { Pair <IT4Token, string> type = directive.GetAttributeValueIgnoreOnlyWhitespace(_directiveInfoManager.Parameter.TypeAttribute.Name); if (type.First == null || type.Second == null) { return; } Pair <IT4Token, string> name = directive.GetAttributeValueIgnoreOnlyWhitespace(_directiveInfoManager.Parameter.NameAttribute.Name); if (name.First == null || name.Second == null) { return; } StringBuilder builder = _parametersResult.Builder; builder.Append("[System.CodeDom.Compiler.GeneratedCodeAttribute] private global::"); _parametersResult.AppendMapped(type.Second, type.First.GetTreeTextRange()); builder.Append(' '); _parametersResult.AppendMapped(name.Second, name.First.GetTreeTextRange()); builder.Append(" { get { return default(global::"); builder.Append(type.Second); builder.AppendLine("); } }"); }
/// <summary>Handles a template directive, determining if we should output a Host property and use a base class.</summary> /// <param name="directive">The template directive.</param> private void HandleTemplateDirective([NotNull] IT4Directive directive) { string value = directive.GetAttributeValue(_directiveInfoManager.Template.HostSpecificAttribute.Name); _hasHost = Boolean.TrueString.Equals(value, StringComparison.OrdinalIgnoreCase); (IT4Token classNameToken, string className) = directive.GetAttributeValueIgnoreOnlyWhitespace(_directiveInfoManager.Template.InheritsAttribute.Name); if (classNameToken != null && className != null) { _inheritsResult.AppendMapped(className, classNameToken.GetTreeTextRange()); } }
/// <summary> /// Handles an import directive, equivalent of an using directive in C#. /// </summary> /// <param name="directive">The import directive.</param> private void HandleImportDirective([NotNull] IT4Directive directive) { Pair <IT4Token, string> ns = directive.GetAttributeValueIgnoreOnlyWhitespace(_directiveInfoManager.Import.NamespaceAttribute.Name); if (ns.First == null || ns.Second == null) { return; } _usingsResult.Builder.Append("using "); _usingsResult.AppendMapped(ns.Second, ns.First.GetTreeTextRange()); _usingsResult.Builder.AppendLine(";"); }