Esempio n. 1
0
        /// <summary>
        ///     It writes the head and the conclusion of a .h c++ file
        /// </summary>
        /// <param name="className">The name of the C++ class to be implemented</param>
        private void WriteHead(string className)
        {
            // Create the string of the head
            List <string> headlist = new List <string>();

            headlist.Add("#ifndef _" + className.ToUpper() + "_H_");
            headlist.Add("#define _" + className.ToUpper() + "_H_");
            headlist.Add("\n");
            headlist.Add("#include \"gtkmm.h\"");
            headlist.Add("\n");
            headlist.Add("class " + className + " {");
            headlist.Add(Utils.Tabs(1) + "public:");
            headlist.Add("\n");

            // Transform the portion of text to array of bytes
            // Point the current position of the buffer to the end of the stream
            CurrentBufferPosition = IOManager.WriteListOfStringIntoStream(headlist);

            // Clear the list
            headlist.Clear();

            // Continue with the end of the head class
            headlist.Add("};");
            headlist.Add("\n");
            headlist.Add("#endif /* _" + className + "_H_ */");

            // Write the second part of the head class to the HeaderFileStream
            IOManager.WriteListOfStringIntoStream(headlist);
            // Bring back to the begin of the public methods declaration
            IOManager.SetStreamPosition(CurrentBufferPosition);
        }
Esempio n. 2
0
        private void WriteInitComponents(BindingForm form)
        {
            WriteText(form.Class + "::" + "InitComponents() {");
            WriteText(Utils.Tabs(1) + "builder->get_widget(\"" + form.Id + "\", window);");
            WriteText("");
            WriteText(Utils.Tabs(1) + "// Widgets initialisation");
            List <string> initcomplist = new List <string>();

            foreach (BindingWidget widget in form.Widgets)
            {
                if (widget.AddToClass)
                {
                    initcomplist.Add(Utils.Tabs(1) + "builder->get_widget(\"" + widget.Name + "\"," + widget.VariableName + ");");
                }
            }
            IOManager.WriteListOfStringIntoStream(initcomplist);
            WriteText("}");
        }