change run to use meson/ninja and then exec. - remove libvala code from application...
[roobuilder] / src / ccode / valaccodeggnucsection.vala
1 /* valaccodeggnucsection.vala
2  *
3  * Copyright (C) 2016  Rico Tzschichholz
4  *
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.
9
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.
14
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
18  *
19  * Author:
20  *      Rico Tzschichholz <ricotz@ubuntu.com>
21  */
22
23 using GLib;
24
25 /**
26  * Represents a section that should be processed on condition.
27  */
28 public class Vala.CCodeGGnucSection : CCodeFragment {
29         /**
30          * The expression
31          */
32         public GGnucSectionType section_type { get; set; }
33
34         public CCodeGGnucSection (GGnucSectionType t) {
35                 section_type = t;
36         }
37
38         public override void write (CCodeWriter writer) {
39                 writer.write_string ("G_GNUC_BEGIN_");
40                 writer.write_string (section_type.to_string ());
41                 writer.write_newline ();
42                 foreach (CCodeNode node in get_children ()) {
43                         node.write_combined (writer);
44                 }
45                 writer.write_string ("G_GNUC_END_");
46                 writer.write_string (section_type.to_string ());
47                 writer.write_newline ();
48         }
49
50         public override void write_declaration (CCodeWriter writer) {
51         }
52 }
53
54 public enum Vala.GGnucSectionType {
55         IGNORE_DEPRECATIONS;
56
57         public unowned string to_string () {
58                 switch (this) {
59                         case IGNORE_DEPRECATIONS:
60                                 return "IGNORE_DEPRECATIONS";
61                         default:
62                                 assert_not_reached ();
63                 }
64         }
65 }