[glibmm] Glib::Variant: Remove the string specializations of cast_dynamic



commit 11f9fa220a065a6540347e84a804f280f597472b
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Tue Dec 27 19:38:27 2016 +0100

    Glib::Variant: Remove the string specializations of cast_dynamic
    
    The Variant<Glib::ustring> and Variant<std::string> specializations of
    VariantBase::cast_dynamic<>() are no longer used by glibmm.

 glib/src/variant.ccg |   48 ------------------------------------------------
 glib/src/variant.hg  |   10 ----------
 2 files changed, 0 insertions(+), 58 deletions(-)
---
diff --git a/glib/src/variant.ccg b/glib/src/variant.ccg
index 37576c0..89e557d 100644
--- a/glib/src/variant.ccg
+++ b/glib/src/variant.ccg
@@ -328,30 +328,6 @@ Variant<Glib::ustring>::get() const
   return convert_const_gchar_ptr_to_ustring(g_variant_get_string(gobject_, nullptr));
 }
 
-// Variant<Glib::ustring> makes sense for multiple types.
-// See http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get-string
-template <>
-Variant<Glib::ustring>
-VariantBase::cast_dynamic<Variant<Glib::ustring>>(const VariantBase& v) throw(std::bad_cast)
-{
-  if (!v.gobj())
-  {
-    return Variant<Glib::ustring>();
-  }
-
-  const VariantType vtype = v.get_type();
-  if (vtype.equal(VARIANT_TYPE_STRING) || vtype.equal(VARIANT_TYPE_OBJECT_PATH) ||
-      vtype.equal(VARIANT_TYPE_SIGNATURE))
-  {
-    return Variant<Glib::ustring>(const_cast<GVariant*>(v.gobj()), true);
-  }
-  else
-  {
-    // std::cerr << "vtype=" << v.get_type_string() << std::endl;
-    throw std::bad_cast();
-  }
-}
-
 /*--------------------Variant<std::string>---------------------*/
 
 Variant<std::string>::Variant() : VariantStringBase()
@@ -377,30 +353,6 @@ Variant<std::string>::create(const std::string& data)
   return result;
 }
 
-// Variant<std::string> makes sense for multiple types.
-// See http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get-string
-template <>
-Variant<std::string>
-VariantBase::cast_dynamic<Variant<std::string>>(const VariantBase& v) throw(std::bad_cast)
-{
-  if (!v.gobj())
-  {
-    return Variant<std::string>();
-  }
-
-  const VariantType vtype = v.get_type();
-  if (vtype.equal(VARIANT_TYPE_STRING) || vtype.equal(VARIANT_TYPE_BYTESTRING) ||
-      vtype.equal(VARIANT_TYPE_OBJECT_PATH) || vtype.equal(VARIANT_TYPE_SIGNATURE))
-  {
-    return Variant<std::string>(const_cast<GVariant*>(v.gobj()), true);
-  }
-  else
-  {
-    // std::cerr << "vtype=" << v.get_type_string() << std::endl;
-    throw std::bad_cast();
-  }
-}
-
 std::string
 Variant<std::string>::get() const
 {
diff --git a/glib/src/variant.hg b/glib/src/variant.hg
index 7749a34..6900dbe 100644
--- a/glib/src/variant.hg
+++ b/glib/src/variant.hg
@@ -563,11 +563,6 @@ public:
   _IGNORE(g_variant_get_string, g_variant_dup_string)
 };
 
-//TODO: When we can break ABI, remove this template specialization.
-template<>
-Variant<Glib::ustring> VariantBase::cast_dynamic< Variant<Glib::ustring> >(const VariantBase& v)
-throw(std::bad_cast);
-
 /** Specialization of Variant containing a std::string, for variants of type
  * bytestring, string, object path, or signature.
  * See also Variant<Glib::ustring> for UTF-8 strings.
@@ -612,11 +607,6 @@ public:
   _IGNORE(g_variant_get_bytestring, g_variant_dup_bytestring)
 };
 
-//TODO: When we can break ABI, remove this template specialization.
-template<>
-Variant<std::string> VariantBase::cast_dynamic< Variant<std::string> >(const VariantBase& v)
-throw(std::bad_cast);
-
 /** Specialization of Variant containing a dictionary entry.  See also
  * Variant< std::map<K, V> >.
  * @newin{2,28}


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