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



commit 397d8e068294a8cf3c8cdfb6a551ce50168c8401
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 9546faa..69170e5 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]