Commit 24039550 authored by Didier 'Ptitjes's avatar Didier 'Ptitjes Committed by Jürg Billeter

GIR writer: Improve errordomain generation

Generate get-quark and codes attributes on errordomain and generate
enum for error codes.
Signed-off-by: default avatarDidier 'Ptitjes <ptitjes@free.fr>
parent 4b936d9f
......@@ -335,20 +335,35 @@ public class Vala.GIRWriter : CodeVisitor {
}
write_indent ();
stream.printf ("<errordomain name=\"%s\"", edomain.get_cname ());
stream.printf ("<errordomain name=\"%s\"", edomain.name);
stream.printf (" get-quark=\"%squark\"", edomain.get_lower_case_cprefix ());
stream.printf (" codes=\"%s\"", edomain.name);
stream.printf ("/>\n");
write_indent ();
stream.printf ("<enumeration name=\"%s\"", edomain.name);
write_ctype_attributes (edomain);
stream.printf (">\n");
indent++;
enum_value = 0;
edomain.accept_children (this);
indent--;
write_indent ();
stream.printf ("</errordomain>\n");
stream.printf ("</enumeration>\n");
}
public override void visit_error_code (ErrorCode ecode) {
write_indent ();
stream.printf ("<member name=\"%s\"/>\n", ecode.get_cname ());
stream.printf ("<member name=\"%s\" c:identifier=\"%s\"", ecode.name.down (), ecode.get_cname ());
if (ecode.value != null) {
string value = literal_expression_to_value_string (ecode.value);
stream.printf (" value=\"%s\"", value);
} else {
stream.printf (" value=\"%d\"", enum_value++);
}
stream.printf ("/>\n");
}
public override void visit_constant (Constant c) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment