From: Luca Bruno Date: Thu, 6 Jan 2011 11:20:38 +0000 (+0100) Subject: markupreader: Add get_attributes() method returning a copy of attributes. X-Git-Tag: 0.13.0~269 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bfe1394d221a348ef8d898ecece94e7c933b06b9;p=thirdparty%2Fvala.git markupreader: Add get_attributes() method returning a copy of attributes. --- diff --git a/vala/valamarkupreader.vala b/vala/valamarkupreader.vala index 9546faac1..69170e556 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 get_attributes () { + var result = new HashMap (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) {