valatypesymbol.vala 1.91 KB
Newer Older
1
/* valatypesymbol.vala
2
 *
3 4
 * Copyright (C) 2006-2010  Jürg Billeter
 * Copyright (C) 2006-2008  Raffaele Sandrini
5 6 7 8
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
9
 * version 2.1 of the License, or (at your option) any later version.
10 11 12 13 14 15 16 17 18 19 20 21

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Jürg Billeter <j@bitron.ch>
22
 *	Raffaele Sandrini <raffaele@sandrini.ch>
23 24 25 26
 */

using GLib;

27 28 29 30
/**
 * Represents a runtime data type. This data type may be defined in Vala source
 * code or imported from an external library with a Vala API file.
 */
31
public abstract class Vala.TypeSymbol : Symbol {
32
	public TypeSymbol (string? name, SourceReference? source_reference = null, Comment? comment = null) {
Jürg Billeter's avatar
Jürg Billeter committed
33
		base (name, source_reference, comment);
34 35
	}

36 37 38 39 40 41 42 43
	/**
	 * Checks whether this data type has value or reference type semantics.
	 *
	 * @return true if this data type has reference type semantics
	 */
	public virtual bool is_reference_type () {
		return false;
	}
44

45
	/**
46 47
	 * Checks whether this data type is equal to or a subtype of the
	 * specified data type.
48 49 50 51
	 *
	 * @param t a data type
	 * @return  true if t is a supertype of this data type, false otherwise
	 */
52
	public virtual bool is_subtype_of (TypeSymbol t) {
53
		return (this == t);
54
	}
55

56 57 58
	/**
	 * Return the index of the specified type parameter name.
	 */
59
	public virtual int get_type_parameter_index (string name) {
60 61
		return -1;
	}
62
}