//\ssyy public void generate_code(StreamWriter sw,HelpStorage hst) { //sw.WriteLine(); string temp=""; if (hst.get_help_context(this.node_name)!=null) { sw.WriteLine(@" ///<summary>"); sw.WriteLine(@" ///"+hst.get_help_context(this.node_name).help_context); sw.WriteLine(@" ///</summary>"); } sw.WriteLine(" [Serializable]"); if (base_class!=null) { temp=text_consts.space+text_consts.colon+text_consts.space+base_class.node_name; } sw.WriteLine(text_consts.tab+text_consts.public_keyword+text_consts.space+text_consts.class_keyword+text_consts.space+ node_name+temp); sw.WriteLine(text_consts.tab+text_consts.open_figure); //sw.WriteLine(); generate_simple_constructor_code(sw); //sw.WriteLine(); if (_subnodes.Count>0) { generate_big_constructor_code(sw, false); sw.WriteLine(); generate_big_constructor_code(sw, true); } if (CountNodesInBaseClasses() > 0) { sw.WriteLine(); generate_big_constructor_code(sw, false, true); sw.WriteLine(); generate_big_constructor_code(sw, true, true); } sw.WriteLine(); foreach (node_field_info nfi in _subnodes) { nfi.generate_field_code(sw); } if (_subnodes.Count > 0) sw.WriteLine(); foreach(node_field_info nfi in _subnodes) { nfi.generate_code_property(sw,this,hst); } if (_subnodes.Count>0) sw.WriteLine(); foreach (method_info mi in _methods) { mi.generate_code(sw, this, hst); } if (_methods.Count > 0) sw.WriteLine(); generate_visitor_node(sw); sw.WriteLine(); sw.WriteLine(text_consts.tab+text_consts.close_figure); sw.WriteLine(); sw.WriteLine(); }
public void generate_code_property(StreamWriter sw,node_info ni,HelpStorage hst) { string prop=text_consts.create_property(field_type_name,property_name,field_code_name, hst.get_help_context(ni.node_name+"."+field_name).help_context); //sw.WriteLine(); sw.WriteLine(prop); //sw.WriteLine(); }
//\ssyy //ssyy public void generate_cpp_code(StreamWriter sw_h, StreamWriter sw_cpp, HelpStorage hst) { sw_h.WriteLine(); string temp = ""; if (hst.get_help_context(this.node_name) != null) { sw_h.WriteLine(@" ///<summary>"); sw_h.WriteLine(@" ///" + hst.get_help_context(this.node_name).help_context); sw_h.WriteLine(@" ///</summary>"); if (base_class != null) { temp = text_consts.space + text_consts.colon + text_consts.space + text_consts.public_keyword + text_consts.space + base_class.node_name; } sw_h.WriteLine(text_consts.tab + text_consts.class_keyword + text_consts.space + node_name + temp); sw_h.WriteLine(text_consts.tab + text_consts.open_figure); sw_h.WriteLine(text_consts.tab + text_consts.public_keyword + text_consts.colon); List<string> destructor_code = new List<string>(); foreach (node_field_info nfi in _subnodes) { nfi.generate_cpp_field_code(sw_h, destructor_code); } if (destructor_code.Count > 0) { sw_h.WriteLine(); sw_h.WriteLine(text_consts.tab2 + text_consts.tilde + node_name + text_consts.open_par + text_consts.close_par + text_consts.semicolon); sw_cpp.WriteLine(); sw_cpp.WriteLine(text_consts.tab + node_name + text_consts.colon2 + text_consts.tilde + node_name + text_consts.open_par + text_consts.close_par); sw_cpp.WriteLine(text_consts.tab + text_consts.open_figure); foreach (string s in destructor_code) { sw_cpp.WriteLine(s); } sw_cpp.WriteLine(text_consts.tab + text_consts.close_figure); } generate_visitor_node_cpp(sw_h); sw_h.WriteLine(text_consts.tab + text_consts.close_figure + text_consts.semicolon); sw_h.WriteLine(); } }