Do not free values returned via g_object_get prematurely, require
[vala-lang.git] / vala / valamember.vala
blobceb4ceeb2d19ff23bf5039d5d204932d7057867b
1 /* valamember.vala
3 * Copyright (C) 2006-2008 Raffaele Sandrini, 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
19 * Author:
20 * Raffaele Sandrini <raffaele@sandrini.ch>
23 using GLib;
24 using Gee;
26 /**
27 * Represents a general class member.
29 public abstract class Vala.Member : Symbol {
30 private Gee.List<string> cheader_filenames = new ArrayList<string> ();
32 public Member (string? name, SourceReference? source_reference) {
33 base (name, source_reference);
36 public override void accept (CodeVisitor visitor) {
37 visitor.visit_member (this);
40 public override Gee.List<string> get_cheader_filenames () {
41 if (cheader_filenames.size == 0 && parent_symbol != null) {
42 /* default to header filenames of the namespace */
43 foreach (string filename in parent_symbol.get_cheader_filenames ()) {
44 add_cheader_filename (filename);
47 if (cheader_filenames.size == 0 && source_reference != null && !external_package) {
48 // don't add default include directives for VAPI files
49 cheader_filenames.add (source_reference.file.get_cinclude_filename ());
52 return new ReadOnlyList<string> (cheader_filenames);
56 /**
57 * Adds a filename to the list of C header filenames users of this data
58 * type must include.
60 * @param filename a C header filename
62 public void add_cheader_filename (string filename) {
63 cheader_filenames.add (filename);
67 public enum MemberBinding {
68 INSTANCE,
69 CLASS,
70 STATIC