[gxml] API Break: Making Serializable interface more thin
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] API Break: Making Serializable interface more thin
- Date: Thu, 11 Feb 2016 00:50:04 +0000 (UTC)
commit 9423cb87e8e62260487953aba6a9d410b4442dad
Author: Daniel Espinosa <esodan gmail com>
Date: Wed Feb 10 18:40:18 2016 -0600
API Break: Making Serializable interface more thin
gxml/Serializable.vala | 185 +++----------------------------
gxml/SerializableGeeArrayList.vala | 27 +-----
gxml/SerializableGeeDualKeyMap.vala | 27 +-----
gxml/SerializableGeeHashMap.vala | 27 +-----
gxml/SerializableGeeTreeMap.vala | 27 +-----
gxml/SerializableObjectModel.vala | 95 ++++------------
test/SerializableGeeDualKeyMapTest.vala | 4 -
test/SerializableObjectModelTest.vala | 22 +++-
test/SerializableTest.vala | 18 ++--
9 files changed, 65 insertions(+), 367 deletions(-)
---
diff --git a/gxml/Serializable.vala b/gxml/Serializable.vala
index c174951..fdb3048 100644
--- a/gxml/Serializable.vala
+++ b/gxml/Serializable.vala
@@ -31,28 +31,6 @@ namespace GXml {
*/
public interface Serializable : GLib.Object {
/**
- * Convenient property to store serializable properties
- */
- protected abstract ParamSpec[] properties { get; set; }
- /**
- * Store all properties to be ignored on serialization.
- *
- * Use property's cannonical name as key and its { link GLib.ParamSpec}. To
- * get the last one use { link GLib.Object.get_class} and use, again, property's
- * cannonical name to find it.
- *
- * Long named properties like this 'ignored_serializable_properties' are stored
- * by GObject using its cannonical name, then you must use it as key, in this
- * case use 'ignored-serializable-properties'.
- *
- * This property is ignored on serialisation.
- *
- * Implementors: By default { link list_serializable_properties} initialize
- * this property to store all public properties, except this one. Make shure to
- * call { link init_properties} before add new propeties.
- */
- public abstract HashTable<string,GLib.ParamSpec> ignored_serializable_properties { get; protected set; }
- /**
* Return false if you want to ignore unknown properties and { link GXml.Node}'s
* not in your class definition.
*
@@ -128,7 +106,7 @@ namespace GXml {
* By default no namspace prefix is added to { link GXml.Element} on serialized. Implementors
* must consider override this methodk if this node should have a namespace.
*/
- public abstract bool set_namespace (GXml.Node node);
+ public abstract bool set_default_namespace (GXml.Node node);
//public abstract Namespace @namespace { get; set; default = null; }
/**
* Used to check { link GXml.Element}'s contents must be deseralized.
@@ -289,7 +267,6 @@ namespace GXml {
*
*/
public virtual GLib.ParamSpec? default_find_property_spec (string property_name) {
- init_properties ();
var props = list_serializable_properties ();
foreach (ParamSpec spec in props) {
if (spec.name.down () == property_name.down ())
@@ -311,33 +288,6 @@ namespace GXml {
}
/**
- * Used internally to initialize { link ignored_serializable_properties} property
- * and default not to be serialized properties. Unless you override any function
- * is not required to be called at class implementor's construction time.
- *
- */
- public abstract void init_properties ();
-
- /**
- * Default implementation for { link Serializable.init_properties}
- *
- */
- public virtual void default_init_properties ()
- {
- if (ignored_serializable_properties == null) {
- ignored_serializable_properties = new HashTable<string,ParamSpec> (str_hash, str_equal);
- ignored_serializable_properties.set ("ignored-serializable-properties",
- get_class ().find_property("ignored-serializable-properties"));
- ignored_serializable_properties.set ("unknown-serializable-properties",
- get_class ().find_property("unknown-serializable-properties"));
- ignored_serializable_properties.set ("unknown-serializable-nodes",
- get_class ().find_property("unknown-serializable-nodes"));
- ignored_serializable_properties.set ("serialized-xml-node-value",
- get_class ().find_property("serialized-xml-node-value"));
- }
- }
-
- /**
* List the known properties for an object's class
*
* Class { link GXml.Serialization} uses
@@ -371,108 +321,24 @@ namespace GXml {
*/
public virtual GLib.ParamSpec[] default_list_serializable_properties ()
{
- init_properties ();
- if (properties == null) {
- ParamSpec[] props = {};
- foreach (ParamSpec spec in this.get_class ().list_properties ()) {
- if (!ignored_serializable_properties.contains (spec.name)) {
- props += spec;
- }
+ ParamSpec[] props = {};
+ var l = new HashTable<string,ParamSpec> (str_hash, str_equal);
+ l.set ("ignored-serializable-properties",
+ get_class ().find_property("ignored-serializable-properties"));
+ l.set ("unknown-serializable-properties",
+ get_class ().find_property("unknown-serializable-properties"));
+ l.set ("unknown-serializable-nodes",
+ get_class ().find_property("unknown-serializable-nodes"));
+ l.set ("serialized-xml-node-value",
+ get_class ().find_property("serialized-xml-node-value"));
+ foreach (ParamSpec spec in this.get_class ().list_properties ()) {
+ if (!l.contains (spec.name)) {
+ props += spec;
}
- properties = props;
- }
- return properties;
- }
-
- /**
- * Get a string version of the specified property
- *
- * { link GXml.Serialization} uses { link GLib.Object.get_property} (as
- * well as { link GLib.ObjectClass.find_property},
- * { link GLib.ObjectClass.list_properties}, and
- * { link GLib.Object.set_property}) to manage serialization of
- * an object's properties. { link GXml.Serializable} gives an
- * implementing class an opportunity to override
- * { link GLib.Object.get_property} to control what value is
- * returned for a given parameter.
- *
- * For instance, if an object has private data fields
- * that are not installed public properties, but that
- * should be serialized,
- * { link GXml.Serializable.list_serializable_properties} can be used to
- * handle this case as a virtual property, supported
- * by the other { link GXml.Serializable} functions.
- *
- * @param spec is usually obtained from { link list_serializable_properties} or { link
GLib.ObjectClass.find_property}.
- *
- * @param spec The property we're retrieving as a string
- */
- public abstract void get_property_value (GLib.ParamSpec spec, ref Value val);
- /**
- * Default implementation for get_property_value ().
- *
- */
- public virtual void default_get_property_value (GLib.ParamSpec spec, ref Value val)
- {
- if (!ignored_serializable_properties.contains (spec.name))
- ((GLib.Object)this).get_property (spec.name, ref val);
- }
- /**
- * Set a property's value.
- *
- * Class { link GXml.Serialization} uses { link GLib.Object.set_property} (as
- * well as { link GLib.ObjectClass.find_property},
- * { link GLib.ObjectClass.list_properties}, and
- * { link GLib.Object.get_property}) to manage serialization of
- * an object's properties. { link GXml.Serializable} gives an
- * implementing class an opportunity to override
- * { link GLib.Object.set_property} to control how a property's
- * value is set.
- *
- * For instance, if an object has private data fields
- * that are not installed public properties, but that
- * should be serialized,
- * { link set_property_value} can be used to
- * handle this case as a virtual property, supported
- * by the other { link GXml.Serializable} functions.
- *
- * @param spec Specifies the property whose value will be set
- * @param val The value to set the property to.
- */
- public abstract void set_property_value (GLib.ParamSpec spec, GLib.Value val);
- /**
- * Default implementation for set_property_value ().
- *
- */
- public virtual void default_set_property_value (GLib.ParamSpec spec, GLib.Value val)
- {
- if (!ignored_serializable_properties.contains (spec.name)) {
- ((GLib.Object)this).set_property (spec.name, val);
}
+ return props;
}
- /**
- * Method to provide custome transformations from strings to
- * a { link GLib.Value}. Could be used on { link Serializable} or simple
- * transformations from string.
- *
- * Some specialized classes, like derived from { link Serializable} class
- * implementator, can provide custome transformations.
- *
- * Returns: true if transformation was handled, false otherwise.
- *
- * Implementors:
- * To be overrided by derived classes of implementators to provide custome
- * transformations. Declare it as virtual if you want derived classes of
- * implementators to provide custome transformations.
- * Call this method before use standard Serializable or implementator ones.
- *
- * @param str a string to get attribute from
- * @param dest a { link GLib.Value} describing attribute to deserialize
- */
- public abstract bool transform_from_string (string str, ref GLib.Value dest)
- throws GLib.Error;
-
/**
* Transforms a string into another type hosted by { link GLib.Value}.
*
@@ -574,27 +440,6 @@ namespace GXml {
str, t.name ());
}
}
-
- /**
- * Method to provide custome transformations from
- * a { link GLib.Value} to strings. Could be used on { link deserialize} or simple
- * transformations to strings.
- *
- * Some specialized classes, like derived from { link Serializable} class
- * implementator, can provide custome transformations.
- *
- * Implementors:
- * To be overrided by derived classes of implementators to provide custome
- * transformations. Declare it as virtual if you want derived classes of
- * implementators to provide custome transformations.
- * Call this method before use standard Serializable or implementator ones.
- *
- * @param val a { link GLib.Value} to get attribute from
- * @param str a string describing attribute to deserialize
- * @return true if transformation was handled, false otherwise.
- */
- public abstract bool transform_to_string (GLib.Value val, ref string str)
- throws GLib.Error;
/**
* Transforms a { link GLib.Value} to its string representation.
*
diff --git a/gxml/SerializableGeeArrayList.vala b/gxml/SerializableGeeArrayList.vala
index bc1f300..e8816bb 100644
--- a/gxml/SerializableGeeArrayList.vala
+++ b/gxml/SerializableGeeArrayList.vala
@@ -50,7 +50,7 @@ public class GXml.SerializableArrayList<G> : Gee.ArrayList<G>, Serializable, Ser
protected ParamSpec[] properties { get; set; }
public GLib.HashTable<string,GLib.ParamSpec> ignored_serializable_properties { get; protected set; }
public string? serialized_xml_node_value { get; protected set; default=null; }
- public virtual bool set_namespace (GXml.Node node) { return true; }
+ public virtual bool set_default_namespace (GXml.Node node) { return true; }
public bool get_enable_unknown_serializable_property () { return false; }
public virtual bool serialize_use_xml_node_value () { return false; }
@@ -66,36 +66,11 @@ public class GXml.SerializableArrayList<G> : Gee.ArrayList<G>, Serializable, Ser
return default_find_property_spec (property_name);
}
- public virtual void init_properties ()
- {
- default_init_properties ();
- }
-
public virtual GLib.ParamSpec[] list_serializable_properties ()
{
return default_list_serializable_properties ();
}
- public virtual void get_property_value (GLib.ParamSpec spec, ref Value val)
- {
- default_get_property_value (spec, ref val);
- }
-
- public virtual void set_property_value (GLib.ParamSpec spec, GLib.Value val)
- {
- default_set_property_value (spec, val);
- }
-
- public virtual bool transform_from_string (string str, ref GLib.Value dest)
- {
- return false;
- }
-
- public virtual bool transform_to_string (GLib.Value val, ref string str)
- {
- return false;
- }
-
public virtual GXml.Node? serialize (GXml.Node node)
throws GLib.Error
requires (node is GXml.Element)
diff --git a/gxml/SerializableGeeDualKeyMap.vala b/gxml/SerializableGeeDualKeyMap.vala
index 50108db..b8b1fc2 100644
--- a/gxml/SerializableGeeDualKeyMap.vala
+++ b/gxml/SerializableGeeDualKeyMap.vala
@@ -132,7 +132,7 @@ public class GXml.SerializableDualKeyMap<P,S,V> : Object, Serializable, Serializ
protected ParamSpec[] properties { get; set; }
public GLib.HashTable<string,GLib.ParamSpec> ignored_serializable_properties { get; protected set; }
public string? serialized_xml_node_value { get; protected set; default=null; }
- public virtual bool set_namespace (GXml.Node node) { return true; }
+ public virtual bool set_default_namespace (GXml.Node node) { return true; }
public virtual bool get_enable_unknown_serializable_property () { return false; }
public virtual bool serialize_use_xml_node_value () { return false; }
@@ -148,36 +148,11 @@ public class GXml.SerializableDualKeyMap<P,S,V> : Object, Serializable, Serializ
return default_find_property_spec (property_name);
}
- public virtual void init_properties ()
- {
- default_init_properties ();
- }
-
public virtual GLib.ParamSpec[] list_serializable_properties ()
{
return default_list_serializable_properties ();
}
- public virtual void get_property_value (GLib.ParamSpec spec, ref Value val)
- {
- default_get_property_value (spec, ref val);
- }
-
- public virtual void set_property_value (GLib.ParamSpec spec, GLib.Value val)
- {
- default_set_property_value (spec, val);
- }
-
- public virtual bool transform_from_string (string str, ref GLib.Value dest)
- {
- return false;
- }
-
- public virtual bool transform_to_string (GLib.Value val, ref string str)
- {
- return false;
- }
-
public virtual GXml.Node? serialize (GXml.Node node)
throws GLib.Error
requires (node is GXml.Element)
diff --git a/gxml/SerializableGeeHashMap.vala b/gxml/SerializableGeeHashMap.vala
index fd030cd..b5ec838 100644
--- a/gxml/SerializableGeeHashMap.vala
+++ b/gxml/SerializableGeeHashMap.vala
@@ -48,7 +48,7 @@ public class GXml.SerializableHashMap<K,V> : Gee.HashMap<K,V>, Serializable, Ser
protected ParamSpec[] properties { get; set; }
public GLib.HashTable<string,GLib.ParamSpec> ignored_serializable_properties { get; protected set; }
public string? serialized_xml_node_value { get; protected set; default=null; }
- public virtual bool set_namespace (GXml.Node node) { return true; }
+ public virtual bool set_default_namespace (GXml.Node node) { return true; }
public virtual bool get_enable_unknown_serializable_property () { return false; }
public virtual bool serialize_use_xml_node_value () { return false; }
@@ -64,36 +64,11 @@ public class GXml.SerializableHashMap<K,V> : Gee.HashMap<K,V>, Serializable, Ser
return default_find_property_spec (property_name);
}
- public virtual void init_properties ()
- {
- default_init_properties ();
- }
-
public virtual GLib.ParamSpec[] list_serializable_properties ()
{
return default_list_serializable_properties ();
}
- public virtual void get_property_value (GLib.ParamSpec spec, ref Value val)
- {
- default_get_property_value (spec, ref val);
- }
-
- public virtual void set_property_value (GLib.ParamSpec spec, GLib.Value val)
- {
- default_set_property_value (spec, val);
- }
-
- public virtual bool transform_from_string (string str, ref GLib.Value dest)
- {
- return false;
- }
-
- public virtual bool transform_to_string (GLib.Value val, ref string str)
- {
- return false;
- }
-
public virtual GXml.Node? serialize (GXml.Node node)
throws GLib.Error
requires (node is GXml.Element)
diff --git a/gxml/SerializableGeeTreeMap.vala b/gxml/SerializableGeeTreeMap.vala
index b8c48c2..a4f499d 100644
--- a/gxml/SerializableGeeTreeMap.vala
+++ b/gxml/SerializableGeeTreeMap.vala
@@ -48,7 +48,7 @@ public class GXml.SerializableTreeMap<K,V> : Gee.TreeMap<K,V>, Serializable, Ser
protected ParamSpec[] properties { get; set; }
public GLib.HashTable<string,GLib.ParamSpec> ignored_serializable_properties { get; protected set; }
public string? serialized_xml_node_value { get; protected set; default=null; }
- public virtual bool set_namespace (GXml.Node node) { return true; }
+ public virtual bool set_default_namespace (GXml.Node node) { return true; }
public bool get_enable_unknown_serializable_property () { return false; }
public virtual bool serialize_use_xml_node_value () { return false; }
@@ -67,36 +67,11 @@ public class GXml.SerializableTreeMap<K,V> : Gee.TreeMap<K,V>, Serializable, Ser
return default_find_property_spec (property_name);
}
- public virtual void init_properties ()
- {
- default_init_properties ();
- }
-
public virtual GLib.ParamSpec[] list_serializable_properties ()
{
return default_list_serializable_properties ();
}
- public virtual void get_property_value (GLib.ParamSpec spec, ref Value val)
- {
- default_get_property_value (spec, ref val);
- }
-
- public virtual void set_property_value (GLib.ParamSpec spec, GLib.Value val)
- {
- default_set_property_value (spec, val);
- }
-
- public virtual bool transform_from_string (string str, ref GLib.Value dest)
- {
- return false;
- }
-
- public virtual bool transform_to_string (GLib.Value val, ref string str)
- {
- return false;
- }
-
public virtual GXml.Node? serialize (GXml.Node node)
throws GLib.Error
requires (node is GXml.Element)
diff --git a/gxml/SerializableObjectModel.vala b/gxml/SerializableObjectModel.vala
index c390a0b..63d478a 100644
--- a/gxml/SerializableObjectModel.vala
+++ b/gxml/SerializableObjectModel.vala
@@ -69,14 +69,17 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
private void init_unknown_doc ()
{
_doc = new TwDocument ();
- var r = _doc.create_element ("root");
- _doc.children.add (r);
+ try {
+ var r = _doc.create_element ("root");
+ _doc.children.add (r);
+ }
+ catch { assert_not_reached (); }
}
public virtual bool serialize_use_xml_node_value () { return false; }
public virtual bool property_use_nick () { return false; }
- public virtual bool set_namespace (GXml.Node node) { return true; }
+ public virtual bool set_default_namespace (GXml.Node node) { return true; }
public virtual string node_name ()
{
return default_node_name ();
@@ -91,38 +94,11 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
return default_find_property_spec (property_name);
}
- public virtual void init_properties ()
- {
- default_init_properties ();
- }
-
public virtual GLib.ParamSpec[] list_serializable_properties ()
{
return default_list_serializable_properties ();
}
- public virtual void get_property_value (GLib.ParamSpec spec, ref Value val)
- {
- default_get_property_value (spec, ref val);
- }
-
- public virtual void set_property_value (GLib.ParamSpec spec, GLib.Value val)
- {
- default_set_property_value (spec, val);
- }
-
- public virtual bool transform_from_string (string str, ref GLib.Value dest)
- throws GLib.Error
- {
- return false;
- }
-
- public virtual bool transform_to_string (GLib.Value val, ref string str)
- throws GLib.Error
- {
- return false;
- }
-
public virtual GXml.Node? serialize (GXml.Node node)
throws GLib.Error
requires (node_name () != null)
@@ -144,7 +120,7 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
doc = node.document;
var element = (Element) doc.create_element (node_name ());
node.children.add (element);
- set_namespace (element);
+ set_default_namespace (element);
foreach (ParamSpec spec in list_serializable_properties ()) {
serialize_property (element, spec);
}
@@ -236,18 +212,16 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
}
else
{
- if (!transform_to_string (oval, ref val)) {
- if (Value.type_transformable (prop.value_type, typeof (string)))
- {
- Value rval = Value (typeof (string));
- oval.transform (ref rval);
- val = rval.dup_string ();
- }
- else {
- Node node = null;
- this.serialize_unknown_property (element, prop, out node);
- return node;
- }
+ if (Value.type_transformable (prop.value_type, typeof (string)))
+ {
+ Value rval = Value (typeof (string));
+ oval.transform (ref rval);
+ val = rval.dup_string ();
+ }
+ else {
+ Node node = null;
+ this.serialize_unknown_property (element, prop, out node);
+ return node;
}
}
string attr_name;
@@ -451,14 +425,12 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
catch (EnumerationError e) {}
}
else {
- if (!transform_from_string (property_node.value, ref val)) {
- Value ptmp = Value (typeof (string));
- ptmp.set_string (property_node.value);
- if (Value.type_transformable (typeof (string), prop.value_type))
- ret = ptmp.transform (ref val);
- else
- ret = string_to_gvalue (property_node.value, ref val);
- }
+ Value ptmp = Value (typeof (string));
+ ptmp.set_string (property_node.value);
+ if (Value.type_transformable (typeof (string), prop.value_type))
+ ret = ptmp.transform (ref val);
+ else
+ ret = string_to_gvalue (property_node.value, ref val);
}
set_property (prop.name, val);
return ret;
@@ -469,25 +441,4 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
return true;
}
public abstract string to_string ();
-
- public static bool equals (SerializableObjectModel a, SerializableObjectModel b)
- {
- if (b.get_type () == a.get_type ()) {
- var alp = ((Serializable)a).list_serializable_properties ();
- bool ret = true;
- foreach (ParamSpec p in alp) {
- var bp = ((Serializable)b).find_property_spec (p.name);
- if (bp != null) {
- Value apval = Value (p.value_type);
- ((Serializable)a).get_property_value (p, ref apval);
- Value bpval = Value (bp.value_type);;
- ((Serializable)b).get_property_value (bp, ref bpval);
- if ( apval != bpval)
- ret = false;
- }
- }
- return ret;
- }
- return false;
- }
}
diff --git a/test/SerializableGeeDualKeyMapTest.vala b/test/SerializableGeeDualKeyMapTest.vala
index fc2f3af..0d71b97 100644
--- a/test/SerializableGeeDualKeyMapTest.vala
+++ b/test/SerializableGeeDualKeyMapTest.vala
@@ -37,10 +37,6 @@ class Spaces : SerializableObjectModel, SerializableMapDualKey<string,string>
this.name = name;
this.owner = owner;
}
- public override void init_properties ()
- {
- default_init_properties ();
- }
public override string to_string () { return name; }
}
diff --git a/test/SerializableObjectModelTest.vala b/test/SerializableObjectModelTest.vala
index 498fada..f881e00 100644
--- a/test/SerializableObjectModelTest.vala
+++ b/test/SerializableObjectModelTest.vala
@@ -59,7 +59,7 @@ public class ObjectModel : SerializableObjectModel
string ret = this.get_type ().name () +"{Properties:\n";
foreach (ParamSpec p in lp) {
Value v = Value (p.value_type);
- get_property_value (p, ref v);
+ get_property (p.name, ref v);
string t;
try { t = gvalue_to_string (v); } catch { t = "[CANT_TRANSFORM]"; }
ret += @"[$(p.name)]{" + t + "}\n";
@@ -177,7 +177,7 @@ public class Cpu : ObjectModel
{
piles = new Gee.ArrayList<int> ();
}
-
+/*
public override bool transform_to_string (GLib.Value val, ref string str)
{
if (val.type ().is_a (typeof (float))) {
@@ -204,6 +204,7 @@ public class Cpu : ObjectModel
}
return false;
}
+ */
public string piles_to_string ()
{
string str = "";
@@ -231,11 +232,18 @@ class Configuration : ObjectModel
public override string node_name () { return "Configuration"; }
public override bool property_use_nick () { return true; }
- public Configuration ()
+ public override GLib.ParamSpec[] list_serializable_properties ()
{
- init_properties (); // initializing properties to be ignored by default
- ignored_serializable_properties.set ("invalid",
- get_class ().find_property("invalid"));
+ ParamSpec[] props = {};
+ var l = new HashTable<string,ParamSpec> (str_hash, str_equal);
+ l.set ("invalid",
+ get_class ().find_property("invalid"));
+ foreach (ParamSpec spec in default_list_serializable_properties ()) {
+ if (!l.contains (spec.name)) {
+ props += spec;
+ }
+ }
+ return props;
}
public override GXml.Node? serialize (GXml.Node node) throws GLib.Error
{
@@ -281,7 +289,7 @@ class UnknownAttribute : ObjectModel
public class NameSpace : SerializableObjectModel
{
- public override bool set_namespace (GXml.Node node)
+ public override bool set_default_namespace (GXml.Node node)
{
Test.message ("Setting default namespace");
node.set_namespace ("http://www.gnome.org/GXml", "gxml");
diff --git a/test/SerializableTest.vala b/test/SerializableTest.vala
index 8c71e34..5881e92 100644
--- a/test/SerializableTest.vala
+++ b/test/SerializableTest.vala
@@ -151,20 +151,18 @@ public class SerializableBanana : GXml.SerializableObjectModel {
// This method overrides the one implemented at Serializable
public override GLib.ParamSpec[] list_serializable_properties ()
{
- if (properties == null) {
- properties = new ParamSpec [4];
- int i = 0;
- foreach (string name in new string[] { "private-field", "public-field",
"private-property", "public-property" }) {
- // TODO: offer guidance for these fields, esp. ParamFlags
- properties[i] = (ParamSpec) new ParamSpecInt (name, name, name, int.MIN,
int.MAX, 0, ParamFlags.READABLE);
- i++;
- }
+ var properties = new ParamSpec [4];
+ int i = 0;
+ foreach (string name in new string[] { "private-field", "public-field", "private-property",
"public-property" }) {
+ // TODO: offer guidance for these fields, esp. ParamFlags
+ properties[i] = (ParamSpec) new ParamSpecInt (name, name, name, int.MIN, int.MAX, 0,
ParamFlags.READABLE);
+ i++;
}
return properties;
}
// This method overrides the one implemented at Serializable
- public override void get_property_value (GLib.ParamSpec spec, ref Value val)
+ public void get_property_value (GLib.ParamSpec spec, ref Value val)
{
val = Value (typeof (int));
switch (spec.name) {
@@ -187,7 +185,7 @@ public class SerializableBanana : GXml.SerializableObjectModel {
}
// This method overrides the one implemented at Serializable
- public override void set_property_value (GLib.ParamSpec spec, GLib.Value val)
+ public void set_property_value (GLib.ParamSpec spec, GLib.Value val)
{
switch (spec.name) {
case "private-field":
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]