Esempio n. 1
0
        /// <summary>
        /// Generate the given template text from the supplied parameters values and add its output to
        /// the given text builder at the given index
        /// </summary>
        /// <param name="textBuilder"></param>
        /// <param name="index"></param>
        /// <param name="template"></param>
        /// <param name="paramsValues"></param>
        public static void Insert(this ListComposer textBuilder, int index, ParametricComposer template, IParametericComposerValueSource paramsValues)
        {
            template.SetParametersValues(paramsValues);

            var text = template.GenerateText();

            textBuilder.Insert(index, new StructuredTextItem(text));
        }
Esempio n. 2
0
        /// <summary>
        /// Generate the given template text from the supplied parameters values and add its output to
        /// the given text builder
        /// </summary>
        /// <param name="textBuilder"></param>
        /// <param name="template"></param>
        /// <param name="paramsValues"></param>
        public static void Add(this ListComposer textBuilder, ParametricComposer template, IParametericComposerValueSource paramsValues)
        {
            template.SetParametersValues(paramsValues);

            var text = template.GenerateText();

            textBuilder.Add(text);
        }
Esempio n. 3
0
        /// <summary>
        /// Generate the given template text from the supplied parameters values and add its output to
        /// the given text builder
        /// </summary>
        /// <param name="textBuilder"></param>
        /// <param name="template"></param>
        /// <param name="paramsValues"></param>
        public static void Add(this ListComposer textBuilder, ParametricComposer template, IDictionary <string, string> paramsValues)
        {
            template.SetParametersValues(paramsValues);

            var text = template.GenerateText();

            textBuilder.Add(text);
        }
Esempio n. 4
0
        internal string Generate(IEnumerable <string> openedNamespaces, string membersText, string scriptText)
        {
            _scriptCodeTemplate.ClearBindings();

            //Generate the full code of the script class
            GeneratedText = _scriptCodeTemplate.GenerateText(
                "opened_namespaces", GenerateOpenNamespacesCode(openedNamespaces),
                "members_code", GenerateScriptCode(membersText),
                "script_code", GenerateScriptCode(scriptText)
                );

            return(GeneratedText);
        }
Esempio n. 5
0
        private string GenerateDeclareCoefsText()
        {
            var s = new StringBuilder();

            var template = new ParametricComposer("#", "#", "public abstract #double# #coef_name# { get; }")
            {
                ["double"] = GMacLanguage.ScalarTypeName
            };


            for (var id = 0; id < CurrentFrame.GaSpaceDimension; id++)
            {
                //var coefName = "Coef" + GaUtils.ID_To_BinaryString(CurrentFrame.VSpaceDimension, id);
                var coefName = "Coef" + id;

                s.AppendLine(template.GenerateText("coef_name", coefName));
            }

            return(s.ToString());
        }
Esempio n. 6
0
        public static LinearComposer AppendAtNewLine(this LinearComposer textBuilder, ParametricComposer template, params string[] parametersValues)
        {
            var text = template.GenerateText(parametersValues);

            return(textBuilder.AppendAtNewLine(text));
        }
Esempio n. 7
0
        public static LinearComposer AppendNewLine(this LinearComposer textBuilder, ParametricComposer template, IParametericComposerValueSource parametersValues)
        {
            var text = template.GenerateText(parametersValues);

            return(textBuilder.AppendNewLine(text));
        }
Esempio n. 8
0
        public static LinearComposer AppendNewLine(this LinearComposer textBuilder, ParametricComposer template, IDictionary <string, string> parametersValues)
        {
            var text = template.GenerateText(parametersValues);

            return(textBuilder.AppendNewLine(text));
        }