summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2006-05-14 12:12:41 +0000
committerMurray Cumming <murrayc@src.gnome.org>2006-05-14 12:12:41 +0000
commitd585c900fb9edcd2e4c0f0e197c7e3b6485839fd (patch)
tree8460463ed9edd651ac793f7b9a5d06408de91316
parent732822b53ea288a33d370048eca6f119fbe612bb (diff)
downloadglibmm-d585c900fb9edcd2e4c0f0e197c7e3b6485839fd.tar.gz
Restored the init(GValue*) method that was lost when merging changes from
2006-05-14 Murray Cumming <murrayc@murrayc.com> * glib/glibmm/value.cc: * glib/glibmm/value.h: Restored the init(GValue*) method that was lost when merging changes from the glibmm-2-10 branch.
-rw-r--r--ChangeLog6
-rw-r--r--glib/glibmm/value.cc8
-rw-r--r--glib/glibmm/value.h12
3 files changed, 26 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 52bd2765..e329ff05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-05-14 Murray Cumming <murrayc@murrayc.com>
+
+ * glib/glibmm/value.cc:
+ * glib/glibmm/value.h: Restored the init(GValue*) method that was lost when
+ merging changes from the glibmm-2-10 branch.
+
2006-05-09 Murray Cumming <murrayc@murrayc.com>
* glib/glibmm/ustring.cc:
diff --git a/glib/glibmm/value.cc b/glib/glibmm/value.cc
index adb3e902..12ba6fc9 100644
--- a/glib/glibmm/value.cc
+++ b/glib/glibmm/value.cc
@@ -39,6 +39,14 @@ void ValueBase::init(GType type)
g_value_init(&gobject_, type);
}
+void ValueBase::init(const GValue* value)
+{
+ g_value_init(&gobject_, G_VALUE_TYPE(value));
+
+ if(value)
+ g_value_copy(value, &gobject_);
+}
+
ValueBase::ValueBase(const ValueBase& other)
{
GLIBMM_INITIALIZE_STRUCT(gobject_, GValue);
diff --git a/glib/glibmm/value.h b/glib/glibmm/value.h
index 94203a32..a891418c 100644
--- a/glib/glibmm/value.h
+++ b/glib/glibmm/value.h
@@ -69,9 +69,21 @@ public:
*
* init() is not implemented as constructor, to avoid the necessity
* to implement a forward constructor in each derived class.
+ *
+ * @param type The type that the Value should hold.
*/
void init(GType type);
+ /** Setup the GValue storing the type and value of the specified @a value.
+ * Note that init() should never be called twice.
+ *
+ * init() is not implemented as constructor, to avoid the necessity
+ * to implement a forward constructor in each derived class.
+ *
+ * @param value The existing GValue.
+ */
+ void init(const GValue* value);
+
/** Reset contents to the default value of its type.
*/
void reset();