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
20 * Raffaele Sandrini <raffaele@sandrini.ch>
26 * Represents a general class member.
28 public abstract class Vala
.Member
: Symbol
{
29 public Comment comment
{ get; set; }
31 private List
<string> cheader_filenames
= new ArrayList
<string> ();
34 * Specifies whether this method explicitly hides a member of a base
37 public bool hides
{ get; set; }
39 public Member (string? name
, SourceReference? source_reference
, Comment? comment
= null) {
40 base (name
, source_reference
);
41 this
.comment
= comment
;
44 public override void accept (CodeVisitor visitor
) {
45 visitor
.visit_member (this
);
48 public override List
<string> get_cheader_filenames () {
49 if (cheader_filenames
.size
== 0 && parent_symbol
!= null) {
50 /* default to header filenames of the namespace */
51 foreach (string filename
in parent_symbol
.get_cheader_filenames ()) {
52 add_cheader_filename (filename
);
55 if (cheader_filenames
.size
== 0 && source_reference
!= null && !external_package
) {
56 // don't add default include directives for VAPI files
57 cheader_filenames
.add (source_reference
.file
.get_cinclude_filename ());
60 return new ReadOnlyList
<string> (cheader_filenames
);
65 * Adds a filename to the list of C header filenames users of this data
68 * @param filename a C header filename
70 public void add_cheader_filename (string filename
) {
71 cheader_filenames
.add (filename
);
74 public Symbol?
get_hidden_member () {
77 if (parent_symbol is Class
) {
78 var cl
= ((Class
) parent_symbol
).base_class
;
80 sym
= cl
.scope
.lookup (name
);
81 if (sym
!= null && sym
.access
!= SymbolAccessibility
.PRIVATE
) {
86 } else if (parent_symbol is Struct
) {
87 var st
= ((Struct
) parent_symbol
).base_struct
;
89 sym
= st
.scope
.lookup (name
);
90 if (sym
!= null && sym
.access
!= SymbolAccessibility
.PRIVATE
) {
101 public enum MemberBinding
{