[vala] dova: Support delegates



commit 7e032ff7d574cebcd472728c5255263adaa84768
Author: Jürg Billeter <j bitron ch>
Date:   Sat Jun 5 09:51:45 2010 +0200

    dova: Support delegates

 vala/valadelegate.vala     |   11 +++++++++++
 vala/valadelegatetype.vala |    6 +++++-
 2 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/vala/valadelegate.vala b/vala/valadelegate.vala
index afedd3b..09538e9 100644
--- a/vala/valadelegate.vala
+++ b/vala/valadelegate.vala
@@ -228,6 +228,17 @@ public class Vala.Delegate : TypeSymbol {
 		this.cname = cname;
 	}
 
+	public override string? get_lower_case_cname (string? infix) {
+		if (infix == null) {
+			infix = "";
+		}
+		return "%s%s%s".printf (parent_symbol.get_lower_case_cprefix (), infix, camel_case_to_lower_case (name));
+	}
+
+	public override string? get_upper_case_cname (string? infix) {
+		return get_lower_case_cname (infix).up ();
+	}
+
 	private void process_ccode_attribute (Attribute a) {
 		if (a.has_argument ("cname")) {
 			set_cname (a.get_string ("cname"));
diff --git a/vala/valadelegatetype.vala b/vala/valadelegatetype.vala
index 8d337e0..15dc2c3 100644
--- a/vala/valadelegatetype.vala
+++ b/vala/valadelegatetype.vala
@@ -68,7 +68,11 @@ public class Vala.DelegateType : DataType {
 	}
 
 	public override string? get_cname () {
-		return delegate_symbol.get_cname ();
+		if (CodeContext.get ().profile == Profile.DOVA) {
+			return "%s*".printf (delegate_symbol.get_cname ());
+		} else {
+			return delegate_symbol.get_cname ();
+		}
 	}
 
 	public override List<Symbol> get_symbols () {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]