[glibmm] Variant: Move constructor definitions into the .cc file.



commit 5f56698cbf63dc055258f7e2e9558eee7969be48
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Mar 29 10:28:41 2011 +0200

    Variant: Move constructor definitions into the .cc file.
    
    * glib/src/variant.[hg|ccg]: The implementations of constructors for
    template specializations do not need to be inline. This lets us fix them
    later without requiring recompilation of applications.

 ChangeLog            |   10 ++++++-
 glib/src/variant.ccg |   74 ++++++++++++++++++++++++++++++++++++++++++++++++++
 glib/src/variant.hg  |   63 +++++++++---------------------------------
 3 files changed, 97 insertions(+), 50 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 282200b..ad0bca8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,17 @@
 2011-03-29  Murray Cumming  <murrayc murrayc com>
 
+	Variant: Move constructor definitions into the .cc file.
+
+	* glib/src/variant.[hg|ccg]: The implementations of constructors for
+	template specializations do not need to be inline. This lets us fix them
+	later without requiring recompilation of applications.
+
+2011-03-29  Murray Cumming  <murrayc murrayc com>
+
 	Variant: Really declare the cast_dyamic() specialization for ustring.
 
 	* glib/src/variant.[hg|ccg]: Mention the specialization in the .h file instead
-	of just in the .ccg file.
+	of just in the .cc file.
 	Also write a custom Variant<std::string>::get() implementation because this
 	can be used for types other than just bytestring.
 	* tests/glibmm_variant/main.cc: Add tests for the new casts.
diff --git a/glib/src/variant.ccg b/glib/src/variant.ccg
index adad1d6..426cd73 100644
--- a/glib/src/variant.ccg
+++ b/glib/src/variant.ccg
@@ -39,6 +39,17 @@ void VariantBase::byteswap(VariantBase& result) const
   result.init(g_value); // g_value is already referenced.
 }
 
+
+VariantStringBase::VariantStringBase()
+: VariantBase()
+{
+}
+
+VariantStringBase::VariantStringBase(GVariant* castitem, bool take_a_reference)
+: VariantBase(castitem, take_a_reference)
+{
+}
+
 //static
 void VariantStringBase::create_object_path(VariantStringBase& output,
   const std::string& object_path)
@@ -59,6 +70,17 @@ void VariantStringBase::create_signature(VariantStringBase& output,
   output.init(result);
 }
 
+
+VariantContainerBase::VariantContainerBase()
+: VariantBase()
+{
+}
+
+VariantContainerBase::VariantContainerBase(GVariant* castitem, bool take_a_reference)
+: VariantBase(castitem, take_a_reference)
+{
+}
+
 //static
 VariantContainerBase
 VariantContainerBase::create_tuple(const std::vector<VariantBase>& children)
@@ -137,6 +159,17 @@ void VariantBase::init(const GVariant* cobject, bool take_a_reference)
     g_variant_ref(gobject_);
 }
 
+
+Variant<VariantBase>::Variant()
+: VariantContainerBase()
+{
+}
+
+Variant<VariantBase>::Variant(GVariant* castitem, bool take_a_reference)
+: VariantContainerBase(castitem, take_a_reference)
+{
+}
+
 // static
 const VariantType& Variant<VariantBase>::variant_type()
 {
@@ -159,6 +192,17 @@ void Variant<VariantBase>::get(VariantBase& variant) const
   variant.init(gvariant);
 }
 
+
+Variant<Glib::ustring>::Variant()
+: VariantStringBase()
+{
+}
+
+Variant<Glib::ustring>::Variant(GVariant* castitem, bool take_a_reference)
+: VariantStringBase(castitem, take_a_reference)
+{
+}
+
 // static
 const VariantType& Variant<Glib::ustring>::variant_type()
 {
@@ -207,6 +251,16 @@ throw(std::bad_cast)
   }
 }
 
+Variant<std::string>::Variant()
+: VariantStringBase()
+{
+}
+
+Variant<std::string>::Variant(GVariant* castitem, bool take_a_reference)
+: VariantStringBase(castitem, take_a_reference)
+{
+}
+
 // static
 const VariantType& Variant<std::string>::variant_type()
 {
@@ -266,6 +320,16 @@ std::string Variant<std::string>::get() const
 
 typedef std::vector<Glib::ustring> type_vec_ustring;
 
+Variant<type_vec_ustring>::Variant()
+: VariantContainerBase()
+{
+}
+
+Variant<type_vec_ustring>::Variant(GVariant* castitem, bool take_a_reference)
+: VariantContainerBase(castitem, take_a_reference)
+{
+}
+
 // static
 const VariantType& Variant<type_vec_ustring>::variant_type()
 {
@@ -349,6 +413,16 @@ VariantIter Variant<type_vec_ustring>::get_iter() const
 
 typedef std::vector<std::string> type_vec_string;
 
+Variant<type_vec_string>::Variant()
+: VariantContainerBase()
+{
+}
+
+Variant<type_vec_string>::Variant(GVariant* castitem, bool take_a_reference)
+: VariantContainerBase(castitem, take_a_reference)
+{
+}
+
 // static
 const VariantType& Variant<type_vec_string>::variant_type()
 {
diff --git a/glib/src/variant.hg b/glib/src/variant.hg
index dc715d7..2508d9d 100644
--- a/glib/src/variant.hg
+++ b/glib/src/variant.hg
@@ -205,9 +205,7 @@ public:
   typedef VariantStringBase             CppType;
 
   /// Default constructor.
-  VariantStringBase()
-  : VariantBase()
-  {}
+  VariantStringBase();
 
   /** GVariant constructor.
    * @param castitem The GVariant to wrap.
@@ -215,10 +213,7 @@ public:
    * GVariant or not (not taking one could destroy the GVariant with the
    * wrapper).
    */
-  explicit VariantStringBase(GVariant* castitem,
-    bool take_a_reference = false)
-  : VariantBase(castitem, take_a_reference)
-  {}
+  explicit VariantStringBase(GVariant* castitem,  bool take_a_reference = false);
 
   /** Creates a D-Bus object path variant with the contents of @a string. @a
    * string must be a valid D-Bus object path. Use is_object_path() if unsure.
@@ -266,9 +261,7 @@ public:
   typedef VariantContainerBase          CppType;
 
   /// Default constructor.
-  VariantContainerBase()
-  : VariantBase()
-  {}
+  VariantContainerBase();
 
   /** GVariant constructor.
    * @param castitem The GVariant to wrap.
@@ -276,10 +269,7 @@ public:
    * GVariant or not (not taking one could destroy the GVariant with the
    * wrapper).
    */
-  explicit VariantContainerBase(GVariant* castitem,
-    bool take_a_reference = false)
-  : VariantBase(castitem, take_a_reference)
-  {}
+  explicit VariantContainerBase(GVariant* castitem, bool take_a_reference = false);
 
   /** Create a tuple variant from a vector of its variant children.
    * @param children The vector containing the children of the container.
@@ -363,9 +353,7 @@ public:
   typedef Variant<VariantBase>          CppContainerType;
 
   /// Default constructor.
-  Variant<VariantBase>()
-  : VariantContainerBase()
-  {}
+  Variant<VariantBase>();
 
   /** GVariant constructor.
    * @param castitem The GVariant to wrap.
@@ -373,10 +361,7 @@ public:
    * GVariant or not (not taking one could destroy the GVariant with the
    * wrapper).
    */
-  explicit Variant<VariantBase>(GVariant* castitem,
-    bool take_a_reference = false)
-  : VariantContainerBase(castitem, take_a_reference)
-  {}
+  explicit Variant<VariantBase>(GVariant* castitem, bool take_a_reference = false);
 
   /** Gets the VariantType.
    * @return The VariantType.
@@ -416,9 +401,7 @@ public:
   typedef Glib::ustring         CppType;
 
   /// Default constructor.
-  Variant<Glib::ustring>()
-  : VariantStringBase()
-  {}
+  Variant<Glib::ustring>();
 
   /** GVariant constructor.
    * @param castitem The GVariant to wrap.
@@ -426,10 +409,7 @@ public:
    * GVariant or not (not taking one could destroy the GVariant with the
    * wrapper).
    */
-  explicit Variant<Glib::ustring>(GVariant* castitem,
-    bool take_a_reference = false)
-  : VariantStringBase(castitem, take_a_reference)
-  {}
+  explicit Variant<Glib::ustring>(GVariant* castitem,  bool take_a_reference = false);
 
   /** Gets the VariantType.
    * @return The VariantType.
@@ -474,9 +454,7 @@ public:
   typedef std::string           CppType;
 
   /// Default constructor.
-  Variant<std::string>()
-  : VariantStringBase()
-  {}
+  Variant<std::string>();
 
   /** GVariant constructor.
    * @param castitem The GVariant to wrap.
@@ -484,10 +462,7 @@ public:
    * GVariant or not (not taking one could destroy the GVariant with the
    * wrapper).
    */
-  explicit Variant<std::string>(GVariant* castitem,
-    bool take_a_reference = false)
-  : VariantStringBase(castitem, take_a_reference)
-  {}
+  explicit Variant<std::string>(GVariant* castitem, bool take_a_reference = false);
 
   /** Gets the VariantType.
    * @return The VariantType.
@@ -642,9 +617,7 @@ public:
   typedef std::vector<Glib::ustring>    CppContainerType;
 
   /// Default constructor.
-  Variant< std::vector<Glib::ustring> >()
-  : VariantContainerBase()
-  {}
+  Variant< std::vector<Glib::ustring> >();
 
   /** GVariant constructor.
    * @param castitem The GVariant to wrap.
@@ -652,10 +625,7 @@ public:
    * GVariant or not (not taking one could destroy the GVariant with the
    * wrapper).
    */
-  explicit Variant< std::vector<Glib::ustring> >(GVariant* castitem,
-    bool take_a_reference = false)
-  : VariantContainerBase(castitem, take_a_reference)
-  {}
+  explicit Variant< std::vector<Glib::ustring> >(GVariant* castitem, bool take_a_reference = false);
 
   /** Gets the VariantType.
    * @return The VariantType.
@@ -711,9 +681,7 @@ public:
   typedef std::vector<std::string>      CppContainerType;
 
   /// Default constructor.
-  Variant< std::vector<std::string> >()
-  : VariantContainerBase()
-  {}
+  Variant< std::vector<std::string> >();
 
   /** GVariant constructor.
    * @param castitem The GVariant to wrap.
@@ -721,10 +689,7 @@ public:
    * GVariant or not (not taking one could destroy the GVariant with the
    * wrapper).
    */
-  explicit Variant< std::vector<std::string> >(GVariant* castitem,
-    bool take_a_reference = false)
-  : VariantContainerBase(castitem, take_a_reference)
-  {}
+  explicit Variant< std::vector<std::string> >(GVariant* castitem, bool take_a_reference = false);
 
   /** Gets the VariantType.
    * @return The VariantType.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]