/// <summary> /// Adds a variable with the specified type and name to this struct. /// /// <param name="type_name">field type</param> /// <param name="name">member name</param> /// </summary> public void add_field(string type_name, string name, CCodeModifiers modifiers = 0, CCodeDeclaratorSuffix declarator_suffix = null) { var decl = new CCodeDeclaration(type_name); decl.add_declarator(new CCodeVariableDeclarator(name, null, declarator_suffix)); decl.modifiers = modifiers; add_declaration(decl); }
public void add_declaration(string type_name, CCodeDeclarator declarator, CCodeModifiers modifiers = 0) { var stmt = new CCodeDeclaration(type_name); stmt.add_declarator(declarator); stmt.modifiers = modifiers; add_statement(stmt); }
/// <summary> /// Adds the specified declaration as member to this struct. /// /// <param name="decl">a variable declaration</param> /// </summary> public void add_declaration(CCodeDeclaration decl) { declarations.Add(decl); }