1 /* valaccodedeclarationspace.vala
3 * Copyright (C) 2009 Jürg Billeter
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 * Jürg Billeter <j@bitron.ch>
25 class Vala
.CCodeDeclarationSpace
{
26 Set
<string> includes
= new HashSet
<string> (str_hash
, str_equal
);
27 internal CCodeFragment begin
= new
CCodeFragment ();
28 internal CCodeFragment include_directives
= new
CCodeFragment ();
29 internal CCodeFragment type_declaration
= new
CCodeFragment ();
30 internal CCodeFragment type_definition
= new
CCodeFragment ();
31 internal CCodeFragment type_member_declaration
= new
CCodeFragment ();
32 internal CCodeFragment constant_declaration
= new
CCodeFragment ();
34 public void add_include (string filename
, bool local
= false) {
35 if (!(filename
in includes
)) {
36 include_directives
.append (new
CCodeIncludeDirective (filename
, local
));
37 includes
.add (filename
);
41 public void add_begin (CCodeNode node
) {
45 public void add_type_declaration (CCodeNode node
) {
46 type_declaration
.append (node
);
49 public void add_type_definition (CCodeNode node
) {
50 type_definition
.append (node
);
53 public void add_type_member_declaration (CCodeNode node
) {
54 type_member_declaration
.append (node
);
57 public void add_constant_declaration (CCodeNode node
) {
58 constant_declaration
.append (node
);