/// <summary> /// Create a group from the input stream, but use a nondefault lexer /// to break the templates up into chunks. This is usefor changing /// the delimiter from the default $...$ to <...>, for example. /// </summary> public StringTemplateGroup( TextReader r, Type lexer, IStringTemplateErrorListener errorListener, StringTemplateGroup superGroup) { this.templatesDefinedInGroupFile = true; this.templateLexerClass = (lexer == null) ? typeof(AngleBracketTemplateLexer) : lexer; this.errorListener = (errorListener == null) ? DEFAULT_ERROR_LISTENER : errorListener; this.superGroup = superGroup; this.templateLoader = new NullTemplateLoader(); ParseGroup(r); VerifyInterfaceImplementations(); }
/// <summary> /// Creates a group manager for some templates, all of which are /// loaded via a <see cref="StringTemplateLoader"/>. /// </summary> /// <param name="name"></param> /// <param name="templateLoader"></param> /// <param name="lexer"></param> /// <param name="errorListener"></param> public StringTemplateGroup( string name, StringTemplateLoader templateLoader, Type lexer, IStringTemplateErrorListener errorListener, StringTemplateGroup superGroup) { this.name = name; nameToGroupMap[name] = this; if (templateLoader == null) this.templateLoader = new NullTemplateLoader(); else this.templateLoader = templateLoader; this.templateLexerClass = lexer; if (errorListener == null) this.errorListener = DEFAULT_ERROR_LISTENER; else this.errorListener = errorListener; this.superGroup = superGroup; }
/// <summary> /// Create a group manager for some templates, all of which are /// located via the specified <see cref="StringTemplateLoader"/>. /// </summary> public StringTemplateGroup(string name, StringTemplateLoader templateLoader) : this(name, templateLoader, typeof(DefaultTemplateLexer), DEFAULT_ERROR_LISTENER, null) { }
/// <summary> /// Create a group manager for some templates, all of which are /// located via the specified <see cref="StringTemplateLoader"/> and /// use the specified lexer to break up the templates into chunks. /// </summary> public StringTemplateGroup(string name, StringTemplateLoader templateLoader, Type lexer) : this(name, templateLoader, lexer, DEFAULT_ERROR_LISTENER, null) { }
/// <summary> /// Creates a StringTemplateGroup instance that manages a set of /// templates that are accessible via a specified /// <seealso cref="StringTemplateLoader"/>. /// </summary> /// <param name="name">Input stream for group file data</param> /// <param name="templateLoader">Loader for retrieving this group's templates</param> /// <param name="lexer">Lexer to use for breaking up templates into chunks</param> /// <param name="errorListener">Error message sink</param> /// <param name="superGroup">Parent (or super/base) group</param> /// <returns>A StringTemplateGroup instance or null</returns> public StringTemplateGroup CreateGroup( string name, StringTemplateLoader templateLoader, Type lexer, IStringTemplateErrorListener errorListener, StringTemplateGroup superGroup) { return new StringTemplateGroup(name, templateLoader, lexer, errorListener, superGroup); }