[vala/switch-to-gir: 45/47] markupreader: Add get_attributes() method returning a copy of attributes.



commit f6ec1daa3c5b1b45396621a97cedbfd47644ac6a
Author: Luca Bruno <lucabru src gnome org>
Date:   Thu Jan 6 12:20:38 2011 +0100

    markupreader: Add get_attributes() method returning a copy of attributes.

 vala/valamarkupreader.vala |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/vala/valamarkupreader.vala b/vala/valamarkupreader.vala
index 843fba6..3acf39e 100644
--- a/vala/valamarkupreader.vala
+++ b/vala/valamarkupreader.vala
@@ -65,6 +65,19 @@ public class Vala.MarkupReader : Object {
 		return attributes[attr];
 	}
 
+	/*
+	 * Returns a copy of the current attributes.
+	 *
+	 * @return map of current attributes
+	 */
+	public Map<string,string> get_attributes () {
+		var result = new HashMap<string,string> (str_hash, str_equal);
+		foreach (var key in attributes.get_keys ()) {
+			result.set (key, attributes.get (key));
+		}
+		return result;
+	}
+
 	string read_name () {
 		char* begin = current;
 		while (current < end) {



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