[vala/wip/attributes: 24/31] On-demand Method.printf_format and scanf_format



commit 705ec0b61a2bb2d891f02c6e2a91a548e573ca78
Author: Luca Bruno <lucabru src gnome org>
Date:   Thu Jul 7 17:41:40 2011 +0200

    On-demand Method.printf_format and scanf_format

 vala/valamethod.vala |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index efa5f0e..b2ac9aa 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -195,12 +195,26 @@ public class Vala.Method : Subroutine {
 	/**
 	 * Specifies whether this method expects printf-style format arguments.
 	 */
-	public bool printf_format { get; set; }
+	public bool printf_format {
+		get {
+			return get_attribute ("PrintfFormat") != null;
+		}
+		set {
+			set_attribute ("PrintfFormat", value);
+		}
+	}
 
 	/**
 	 * Specifies whether this method expects scanf-style format arguments.
 	 */
-	public bool scanf_format { get; set; }
+	public bool scanf_format {
+		get {
+			return get_attribute ("ScanfFormat") != null;
+		}
+		set {
+			set_attribute ("ScanfFormat", value);
+		}
+	}
 
 	/**
 	 * Specifies whether a new function without a GType parameter is
@@ -500,10 +514,6 @@ public class Vala.Method : Subroutine {
 				returns_modified_pointer = true;
 			} else if (a.name == "FloatingReference") {
 				return_type.floating_reference = true;
-			} else if (a.name == "PrintfFormat") {
-				printf_format = true;
-			} else if (a.name == "ScanfFormat") {
-				scanf_format = true;
 			} else if (a.name == "NoArrayLength") {
 				Report.warning (source_reference, "NoArrayLength attribute is deprecated, use [CCode (array_length = false)] instead.");
 				no_array_length = true;



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