[vala/switch-to-gir: 31/34] girparser: Fix Strv properties
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/switch-to-gir: 31/34] girparser: Fix Strv properties
- Date: Sun, 29 Aug 2010 16:22:19 +0000 (UTC)
commit 7a0d0313b1ff73e466e1bd5ed866d8209ce2b68b
Author: Luca Bruno <lucabru src gnome org>
Date: Sun Aug 29 15:42:42 2010 +0200
girparser: Fix Strv properties
vala/valagirparser.vala | 25 +++++++++++++++++++++----
1 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 13ac1fc..01feb99 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1612,7 +1612,7 @@ public class Vala.GirParser : CodeVisitor {
return param;
}
- DataType parse_type (out string? ctype = null, out int array_length_index = null, bool transfer_elements = false) {
+ DataType parse_type (out string? ctype = null, out int array_length_index = null, bool transfer_elements = false, out bool no_array_length = null, out bool array_null_terminated = null) {
bool is_array = false;
string type_name = reader.get_attribute ("name");
@@ -1648,7 +1648,7 @@ public class Vala.GirParser : CodeVisitor {
type_name = "GLib.GenericArray";
}
- DataType type = parse_type_from_gir_name (type_name);
+ DataType type = parse_type_from_gir_name (type_name, out no_array_length, out array_null_terminated);
// type arguments / element types
while (current_token == MarkupTokenType.START_ELEMENT) {
@@ -1661,7 +1661,14 @@ public class Vala.GirParser : CodeVisitor {
return type;
}
- DataType parse_type_from_gir_name (string type_name) {
+ DataType parse_type_from_gir_name (string type_name, out bool no_array_length = null, out bool array_null_terminated = null) {
+ if (&no_array_length != null) {
+ no_array_length = false;
+ }
+ if (&array_null_terminated != null) {
+ array_null_terminated = false;
+ }
+
DataType type;
if (type_name == "none") {
type = new VoidType (get_current_src ());
@@ -1669,6 +1676,12 @@ public class Vala.GirParser : CodeVisitor {
type = new PointerType (new VoidType (get_current_src ()), get_current_src ());
} else if (type_name == "GObject.Strv") {
type = new ArrayType (new UnresolvedType.from_symbol (new UnresolvedSymbol (null, "string")), 1, get_current_src ());
+ if (&no_array_length != null) {
+ no_array_length = true;
+ }
+ if (&array_null_terminated != null) {
+ array_null_terminated = true;
+ }
} else {
bool known_type = true;
if (type_name == "utf8") {
@@ -1980,10 +1993,14 @@ public class Vala.GirParser : CodeVisitor {
string construct_ = reader.get_attribute ("construct");
string construct_only = reader.get_attribute ("construct-only");
next ();
- var type = parse_type ();
+ bool no_array_length;
+ bool array_null_terminated;
+ var type = parse_type (null, null, false, out no_array_length, out array_null_terminated);
var prop = new Property (name, type, null, null, get_current_src ());
prop.access = SymbolAccessibility.PUBLIC;
prop.no_accessor_method = true;
+ prop.no_array_length = no_array_length;
+ prop.array_null_terminated = array_null_terminated;
if (readable != "0") {
prop.get_accessor = new PropertyAccessor (true, false, false, prop.property_type.copy (), null, null);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]