Insert "%s" argument in printf calls with non-literal format string
[vala-lang.git] / vala / valadelegatetype.vala
blob376138007fc34b1d33c619c0ba4093be9617ab03
1 /* valadelegatetype.vala
3 * Copyright (C) 2007-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
19 * Author:
20 * Jürg Billeter <j@bitron.ch>
23 using GLib;
24 using Gee;
26 /**
27 * The type of an instance of a delegate.
29 public class Vala.DelegateType : DataType {
30 public Delegate delegate_symbol { get; set; }
32 public DelegateType (Delegate delegate_symbol) {
33 this.delegate_symbol = delegate_symbol;
36 public override bool is_invokable () {
37 return true;
40 public override DataType? get_return_type () {
41 return delegate_symbol.return_type;
44 public override Gee.List<FormalParameter>? get_parameters () {
45 return delegate_symbol.get_parameters ();
48 public override string to_qualified_string (Scope? scope) {
49 string s = delegate_symbol.get_full_name ();
50 if (nullable) {
51 s += "?";
53 return s;
56 public override DataType copy () {
57 var result = new DelegateType (delegate_symbol);
58 result.source_reference = source_reference;
59 result.value_owned = value_owned;
60 result.nullable = nullable;
62 foreach (DataType arg in get_type_arguments ()) {
63 result.add_type_argument (arg.copy ());
66 return result;
69 public override string? get_cname () {
70 return delegate_symbol.get_cname ();
73 public override Gee.List<Symbol> get_symbols () {
74 var symbols = new ArrayList<Symbol> ();
75 symbols.add (delegate_symbol);
76 return symbols;
79 public override string? get_type_id () {
80 return "G_TYPE_POINTER";
83 public override bool check (SemanticAnalyzer analyzer) {
84 return delegate_symbol.check (analyzer);
87 public override bool is_disposable () {
88 return delegate_symbol.has_target && value_owned;