Click here to Skip to main content
15,884,962 members
Articles / Programming Languages / Visual Basic

Template Based Code Generator

Rate me:
Please Sign up or sign in to vote.
4.67/5 (33 votes)
20 Nov 2007CPOL13 min read 93.2K   4.1K   116  
A template based, command-line oriented .NET code generator
using System;
using System.Collections.Specialized;

namespace Arebis.CodeGeneration
{
    /// <summary>
    /// Represents the host of a GenerationTemplate
    /// </summary>
    public interface IGenerationHost
    {
        /// <summary>
        /// Calls the given template with the given parameters.
        /// Template output is embedded in the output generated by this template.
        /// </summary>
        void CallTemplate(string templatefile, params object[] parameters);

        /// <summary>
        /// Calls the given template with the given parameters.
        /// Template output is embedded in the output generated by this template.
        /// </summary>
        void CallTemplateToFile(string templatefile, string outputfile, params object[] parameters);

        /// <summary>
        /// Settings of the generation.
        /// </summary>
        NameValueCollection Settings { get; }

		/// <summary>
		/// Writes the string to the current output.
		/// </summary>
		void WriteOutput(string str);

		/// <summary>
		/// The string representing a line break.
		/// </summary>
		string NewLineString { get; }

		/// <summary>
		/// Writes to the logfile.
		/// </summary>
		void Log(string fmt, params object[] args);

		/// <summary>
		/// Request the filewriter to write the given file with the given content.
		/// </summary>
		/// <param name="filename">Filename, absolute, or relative towards current running directory.</param>
		/// <param name="content">Full content of the file.</param>
		void WriteFile(string filename, string content);
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect AREBIS
Belgium Belgium
Senior Software Architect and independent consultant.

Comments and Discussions