1 // ------------------------------------------------------------------------------
3 // This code was generated by a tool.
4 // Mono Runtime Version: 4.0.30319.17020
6 // Changes to this file may cause incorrect behavior and will be lost if
7 // the code is regenerated.
9 // ------------------------------------------------------------------------------
11 namespace T4TemplateTest {
14 using System.Collections.Generic;
18 public partial class PreprocessedT4Template : PreprocessedT4TemplateBase {
20 public virtual string TransformText() {
21 this.GenerationEnvironment = null;
23 #line 1 "/home/gustavo/github/CSharpForFun/ServiceStack/T4TemplateTest/T4TemplateTest/PreprocessedT4Template.tt"
29 #line 6 "/home/gustavo/github/CSharpForFun/ServiceStack/T4TemplateTest/T4TemplateTest/PreprocessedT4Template.tt"
34 return this.GenerationEnvironment.ToString();
37 public virtual void Initialize() {
41 public class PreprocessedT4TemplateBase {
43 private global::System.Text.StringBuilder builder;
45 private global::System.Collections.Generic.IDictionary<string, object> session;
47 private global::System.CodeDom.Compiler.CompilerErrorCollection errors;
49 private string currentIndent = string.Empty;
51 private global::System.Collections.Generic.Stack<int> indents;
53 private ToStringInstanceHelper _toStringHelper = new ToStringInstanceHelper();
55 public virtual global::System.Collections.Generic.IDictionary<string, object> Session {
64 public global::System.Text.StringBuilder GenerationEnvironment {
66 if ((this.builder == null)) {
67 this.builder = new global::System.Text.StringBuilder();
76 protected global::System.CodeDom.Compiler.CompilerErrorCollection Errors {
78 if ((this.errors == null)) {
79 this.errors = new global::System.CodeDom.Compiler.CompilerErrorCollection();
85 public string CurrentIndent {
87 return this.currentIndent;
91 private global::System.Collections.Generic.Stack<int> Indents {
93 if ((this.indents == null)) {
94 this.indents = new global::System.Collections.Generic.Stack<int>();
100 public ToStringInstanceHelper ToStringHelper {
102 return this._toStringHelper;
106 public void Error(string message) {
107 this.Errors.Add(new global::System.CodeDom.Compiler.CompilerError(null, -1, -1, null, message));
110 public void Warning(string message) {
111 global::System.CodeDom.Compiler.CompilerError val = new global::System.CodeDom.Compiler.CompilerError(null, -1, -1, null, message);
112 val.IsWarning = true;
113 this.Errors.Add(val);
116 public string PopIndent() {
117 if ((this.Indents.Count == 0)) {
120 int lastPos = (this.currentIndent.Length - this.Indents.Pop());
121 string last = this.currentIndent.Substring(lastPos);
122 this.currentIndent = this.currentIndent.Substring(0, lastPos);
126 public void PushIndent(string indent) {
127 this.Indents.Push(indent.Length);
128 this.currentIndent = (this.currentIndent + indent);
131 public void ClearIndent() {
132 this.currentIndent = string.Empty;
133 this.Indents.Clear();
136 public void Write(string textToAppend) {
137 this.GenerationEnvironment.Append(textToAppend);
140 public void Write(string format, params object[] args) {
141 this.GenerationEnvironment.AppendFormat(format, args);
144 public void WriteLine(string textToAppend) {
145 this.GenerationEnvironment.Append(this.currentIndent);
146 this.GenerationEnvironment.AppendLine(textToAppend);
149 public void WriteLine(string format, params object[] args) {
150 this.GenerationEnvironment.Append(this.currentIndent);
151 this.GenerationEnvironment.AppendFormat(format, args);
152 this.GenerationEnvironment.AppendLine();
155 public class ToStringInstanceHelper {
157 private global::System.IFormatProvider formatProvider = global::System.Globalization.CultureInfo.InvariantCulture;
159 public global::System.IFormatProvider FormatProvider {
161 return this.formatProvider;
164 if ((this.formatProvider == null)) {
165 throw new global::System.ArgumentNullException("formatProvider");
167 this.formatProvider = value;
171 public string ToStringWithCulture(object objectToConvert) {
172 if ((objectToConvert == null)) {
173 throw new global::System.ArgumentNullException("objectToConvert");
175 global::System.Type type = objectToConvert.GetType();
176 global::System.Type iConvertibleType = typeof(global::System.IConvertible);
177 if (iConvertibleType.IsAssignableFrom(type)) {
178 return ((global::System.IConvertible)(objectToConvert)).ToString(this.formatProvider);
180 global::System.Reflection.MethodInfo methInfo = type.GetMethod("ToString", new global::System.Type[] {
182 if ((methInfo != null)) {
183 return ((string)(methInfo.Invoke(objectToConvert, new object[] {
184 this.formatProvider})));
186 return objectToConvert.ToString();