[glibmm] Replace remaining uses of Glib::ArrayHandle<> with std::vector.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Replace remaining uses of Glib::ArrayHandle<> with std::vector.
- Date: Fri, 17 Mar 2017 10:58:17 +0000 (UTC)
commit c5fff7f4a03d2ca97ba7269e0d5145f22422ff9a
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Mar 17 10:36:23 2017 +0100
Replace remaining uses of Glib::ArrayHandle<> with std::vector.
Using Glib::ArrayHandler<>::vector_to_array() and
Glib::ArrayHandler<>::array_to_vector() instead, and only in the
implementatoin instead of in the API.
gio/src/dbusintrospection.hg | 5 +-
gio/src/dbusmessage.hg | 4 +-
gio/src/settings.hg | 2 +-
gio/src/settingsschema.hg | 1 -
gio/src/unixfdlist.ccg | 16 +-
gio/src/unixfdlist.hg | 13 +-
gio/src/unixfdmessage.ccg | 4 +-
gio/src/unixfdmessage.hg | 3 +-
glib/glibmm.h | 1 -
glib/glibmm/arrayhandle.cc | 38 --
glib/glibmm/arrayhandle.h | 756 -----------------------------
glib/glibmm/containers.h | 1 -
glib/glibmm/filelist.am | 2 -
glib/src/balancedtree.hg | 3 +-
glib/src/bytes.hg | 1 -
glib/src/nodetree.hg | 1 -
tests/Makefile.am | 5 -
tests/glibmm_bool_arrayhandle/main.cc | 97 ----
tests/glibmm_null_containerhandle/main.cc | 43 --
19 files changed, 24 insertions(+), 972 deletions(-)
---
diff --git a/gio/src/dbusintrospection.hg b/gio/src/dbusintrospection.hg
index d7921c8..a92973e 100644
--- a/gio/src/dbusintrospection.hg
+++ b/gio/src/dbusintrospection.hg
@@ -16,7 +16,6 @@
*/
#include <gio/gio.h>
-#include <glibmm/arrayhandle.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
@@ -40,8 +39,8 @@ class AnnotationInfo final
_IGNORE(g_dbus_annotation_info_ref, g_dbus_annotation_info_unref)
public:
-#m4 _CONVERSION(`const Glib::ArrayHandle< Glib::RefPtr<AnnotationInfo> >&', `GDBusAnnotationInfo**',
`const_cast<GDBusAnnotationInfo**>($3.data())')
- _WRAP_METHOD(static Glib::ustring info_lookup(const Glib::ArrayHandle< Glib::RefPtr<AnnotationInfo> >&
annotations, const Glib::ustring& name), g_dbus_annotation_info_lookup)
+#m4 _CONVERSION(`const std::vector<Glib::RefPtr<AnnotationInfo>>&',
`GDBusAnnotationInfo**',`Glib::ArrayHandler<Glib::RefPtr<AnnotationInfo>>::vector_to_array($3).data()')
+ _WRAP_METHOD(static Glib::ustring info_lookup(const std::vector<Glib::RefPtr<AnnotationInfo>>&
annotations, const Glib::ustring& name), g_dbus_annotation_info_lookup)
};
/** ArgInfo - Stores information about an argument for a method or a
diff --git a/gio/src/dbusmessage.hg b/gio/src/dbusmessage.hg
index 20a15ed..f348a73 100644
--- a/gio/src/dbusmessage.hg
+++ b/gio/src/dbusmessage.hg
@@ -138,8 +138,8 @@ public:
_WRAP_METHOD(void set_header(MessageHeaderField header_field, const Glib::VariantBase& value),
g_dbus_message_set_header)
- #m4 _CONVERSION(`guchar*',`Glib::ArrayHandle<guchar>',`Glib::ArrayHandle<guchar>($3)')
- _WRAP_METHOD(Glib::ArrayHandle<guchar> get_header_fields() const, g_dbus_message_get_header_fields)
+ #m4 _CONVERSION(`guchar*',`std::vector<guchar>',`Glib::ArrayHandler<guchar>::array_to_vector($3,
Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector<guchar> get_header_fields() const, g_dbus_message_get_header_fields)
_WRAP_METHOD(Glib::ustring get_destination() const, g_dbus_message_get_destination)
_WRAP_METHOD(void set_destination(const Glib::ustring& value), g_dbus_message_set_destination)
diff --git a/gio/src/settings.hg b/gio/src/settings.hg
index 7be35e3..7370f4e 100644
--- a/gio/src/settings.hg
+++ b/gio/src/settings.hg
@@ -200,7 +200,7 @@ public:
_WRAP_PROPERTY("settings-schema", Glib::RefPtr<SettingsSchema>, newin "2,52")
- //TODO?: _WRAP_SIGNAL(bool change_event(const Glib::ArrayHandle<Glib::QueryQuark>& keys, int n_keys),
"change-event")
+ //TODO?: _WRAP_SIGNAL(bool change_event(const std::vector<Glib::QueryQuark>& keys, int n_keys),
"change-event")
#m4 _CONVERSION(`const char*',`const Glib::ustring&',__GCHARP_TO_USTRING)
_WRAP_SIGNAL(void changed(const Glib::ustring& key), "changed", detail_name key)
diff --git a/gio/src/settingsschema.hg b/gio/src/settingsschema.hg
index db768b8..c5f6c95 100644
--- a/gio/src/settingsschema.hg
+++ b/gio/src/settingsschema.hg
@@ -18,7 +18,6 @@
_CONFIGINCLUDE(giommconfig.h)
#include <giomm/settingsschemakey.h>
-#include <glibmm/arrayhandle.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
diff --git a/gio/src/unixfdlist.ccg b/gio/src/unixfdlist.ccg
index 92aef94..d24555c 100644
--- a/gio/src/unixfdlist.ccg
+++ b/gio/src/unixfdlist.ccg
@@ -21,7 +21,7 @@
namespace Gio
{
-UnixFDList::UnixFDList(const Glib::ArrayHandle<int>& fds)
+UnixFDList::UnixFDList(const std::vector<int>& fds)
: // Mark this class as non-derived to allow C++ vfuncs to be skipped.
Glib::ObjectBase(nullptr),
// g_unix_fd_list_new_from_array() must be called.
@@ -29,11 +29,11 @@ UnixFDList::UnixFDList(const Glib::ArrayHandle<int>& fds)
// _CONSTRUCT() + g_unit_fd_list_append() is not an alternative.
// g_unit_fd_list_append() duplicates the file descriptor,
// but g_unix_fd_list_new_from_array() does not.
- Glib::Object((GObject*)g_unix_fd_list_new_from_array(fds.data(), fds.size()))
+ Glib::Object((GObject*)g_unix_fd_list_new_from_array(Glib::ArrayHandler<int>::vector_to_array(fds).data(),
fds.size()))
{
}
-UnixFDList::UnixFDList(const Glib::ArrayHandle<int>& fds, int n_fds)
+UnixFDList::UnixFDList(const std::vector<int>& fds, int n_fds)
: // Mark this class as non-derived to allow C++ vfuncs to be skipped.
Glib::ObjectBase(nullptr),
// g_unix_fd_list_new_from_array() must be called.
@@ -41,28 +41,28 @@ UnixFDList::UnixFDList(const Glib::ArrayHandle<int>& fds, int n_fds)
// _CONSTRUCT() + g_unit_fd_list_append() is not an alternative.
// g_unit_fd_list_append() duplicates the file descriptor,
// but g_unix_fd_list_new_from_array() does not.
- Glib::Object((GObject*)g_unix_fd_list_new_from_array(fds.data(), n_fds))
+ Glib::Object((GObject*)g_unix_fd_list_new_from_array(Glib::ArrayHandler<int>::vector_to_array(fds).data(),
n_fds))
{
}
-const Glib::ArrayHandle<int>
+const std::vector<int>
UnixFDList::peek_fds() const
{
int length = 0;
const auto fds = g_unix_fd_list_peek_fds(const_cast<GUnixFDList*>(gobj()), &length);
// The array is terminated with a -1, but that terminating element is
// not included in the length that g_unix_fd_list_peek_fds() returns.
- return Glib::ArrayHandle<int>(fds, length, Glib::OWNERSHIP_NONE);
+ return Glib::ArrayHandler<int>::array_to_vector(fds, length, Glib::OWNERSHIP_NONE);
}
-Glib::ArrayHandle<int>
+std::vector<int>
UnixFDList::steal_fds()
{
int length = 0;
const auto fds = g_unix_fd_list_steal_fds(gobj(), &length);
// The array is terminated with a -1, but that terminating element is
// not included in the length that g_unix_fd_list_steal_fds() returns.
- return Glib::ArrayHandle<int>(fds, length, Glib::OWNERSHIP_DEEP);
+ return Glib::ArrayHandler<int>::array_to_vector(fds, length, Glib::OWNERSHIP_DEEP);
}
} // namespace Gio
diff --git a/gio/src/unixfdlist.hg b/gio/src/unixfdlist.hg
index 6525f32..b85804f 100644
--- a/gio/src/unixfdlist.hg
+++ b/gio/src/unixfdlist.hg
@@ -16,7 +16,6 @@
*/
#include <glibmm/object.h>
-#include <glibmm/arrayhandle.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
@@ -44,9 +43,9 @@ protected:
_CTOR_DEFAULT
_IGNORE(g_unix_fd_list_new)
- explicit UnixFDList(const Glib::ArrayHandle<int>& fds);
+ explicit UnixFDList(const std::vector<int>& fds);
- explicit UnixFDList(const Glib::ArrayHandle<int>& fds, int n_fds);
+ explicit UnixFDList(const std::vector<int>& fds, int n_fds);
_IGNORE(g_unix_fd_list_new_from_array)
public:
@@ -61,10 +60,10 @@ public:
* @param fds The list of file descriptors to use for creation.
* @return A new UnixFDList.
*/
- _WRAP_CREATE(const Glib::ArrayHandle<int>& fds)
+ _WRAP_CREATE(const std::vector<int>& fds)
_WRAP_METHOD_DOCS_ONLY(g_unix_fd_list_new_from_array)
- _WRAP_CREATE(const Glib::ArrayHandle<int>& fds, int n_fds)
+ _WRAP_CREATE(const std::vector<int>& fds, int n_fds)
_WRAP_METHOD(int get_length() const, g_unix_fd_list_get_length)
_WRAP_METHOD(int get(int index) const, g_unix_fd_list_get, errthrow)
@@ -78,7 +77,7 @@ public:
*
* @newin{2,28}
*/
- const Glib::ArrayHandle<int> peek_fds() const;
+ const std::vector<int> peek_fds() const;
_IGNORE(g_unix_fd_list_peek_fds)
/** Returns the array of file descriptors that is contained in this object.
@@ -93,7 +92,7 @@ public:
*
* @newin{2,28}
*/
- Glib::ArrayHandle<int> steal_fds();
+ std::vector<int> steal_fds();
_IGNORE(g_unix_fd_list_steal_fds)
_WRAP_METHOD_DOCS_ONLY(g_unix_fd_list_append)
diff --git a/gio/src/unixfdmessage.ccg b/gio/src/unixfdmessage.ccg
index 9d1afc2..a88cf4f 100644
--- a/gio/src/unixfdmessage.ccg
+++ b/gio/src/unixfdmessage.ccg
@@ -22,14 +22,14 @@
namespace Gio
{
-Glib::ArrayHandle<int>
+std::vector<int>
UnixFDMessage::steal_fds()
{
int length = 0;
const auto fds = g_unix_fd_message_steal_fds(gobj(), &length);
// The array is terminated with a -1, but that terminating element is
// not included in the length that g_unix_fd_message_steal_fds() returns.
- return Glib::ArrayHandle<int>(fds, length, Glib::OWNERSHIP_DEEP);
+ return Glib::ArrayHandler<int>::array_to_vector(fds, length, Glib::OWNERSHIP_DEEP);
}
} // namespace Gio
diff --git a/gio/src/unixfdmessage.hg b/gio/src/unixfdmessage.hg
index d54c8e6..f25dacc 100644
--- a/gio/src/unixfdmessage.hg
+++ b/gio/src/unixfdmessage.hg
@@ -15,7 +15,6 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <glibmm/arrayhandle.h>
#include <giomm/socketcontrolmessage.h>
_DEFS(giomm,gio)
@@ -72,7 +71,7 @@ public:
*
* @newin{2,28}
*/
- Glib::ArrayHandle<int> steal_fds();
+ std::vector<int> steal_fds();
_IGNORE(g_unix_fd_message_steal_fds)
_WRAP_PROPERTY("fd-list", Glib::RefPtr<UnixFDList>)
diff --git a/glib/glibmm.h b/glib/glibmm.h
index 153d65e..f3e01c1 100644
--- a/glib/glibmm.h
+++ b/glib/glibmm.h
@@ -84,7 +84,6 @@
//#include <glibmm/i18n.h> //This must be included by the application, after system headers such as
//<iostream>.
-#include <glibmm/arrayhandle.h>
#include <glibmm/balancedtree.h>
#include <glibmm/base64.h>
#ifndef GLIBMM_INCLUDED_FROM_WRAP_INIT_CC
diff --git a/glib/glibmm/containers.h b/glib/glibmm/containers.h
index 2382b3c..813383c 100644
--- a/glib/glibmm/containers.h
+++ b/glib/glibmm/containers.h
@@ -21,7 +21,6 @@
*/
#include <glibmmconfig.h>
-#include <glibmm/sarray.h> /* for backward compatibility */
#include <glibmm/wrap.h>
#include <glib.h>
#include <iterator>
diff --git a/glib/glibmm/filelist.am b/glib/glibmm/filelist.am
index 4bbb847..d250d9d 100644
--- a/glib/glibmm/filelist.am
+++ b/glib/glibmm/filelist.am
@@ -5,7 +5,6 @@ glibmm_files_built_h = $(glibmm_files_used_hg:.hg=.h) $(glibmm_files_h_m4:.m4=)
glibmm_files_built_ph = $(patsubst %.hg,private/%_p.h,$(glibmm_files_used_hg))
glibmm_files_extra_cc = \
- arrayhandle.cc \
base64.cc \
class.cc \
containers.cc \
@@ -40,7 +39,6 @@ glibmm_files_extra_cc = \
wrap.cc
glibmm_files_extra_h = \
- arrayhandle.h \
base64.h \
class.h \
containerhandle_shared.h \
diff --git a/glib/src/balancedtree.hg b/glib/src/balancedtree.hg
index a7628fc..4bf34a5 100644
--- a/glib/src/balancedtree.hg
+++ b/glib/src/balancedtree.hg
@@ -20,7 +20,8 @@ _DEFS(glibmm,glib)
#include <glibmm/refptr.h>
#include <glibmm/ustring.h>
#include <glibmm/error.h>
-#include <glibmm/arrayhandle.h>
+#include <sigc++/slot.h>
+#include <sigc++/bind.h>
#include <glib.h>
namespace Glib
diff --git a/glib/src/bytes.hg b/glib/src/bytes.hg
index 56da352..b4b1f2a 100644
--- a/glib/src/bytes.hg
+++ b/glib/src/bytes.hg
@@ -21,7 +21,6 @@ _DEFS(glibmm,glib)
#include <glibmm/refptr.h>
#include <glibmm/ustring.h>
#include <glibmm/error.h>
-#include <glibmm/arrayhandle.h>
#include <glib.h>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/glib/src/nodetree.hg b/glib/src/nodetree.hg
index bcec2dd..1587e0b 100644
--- a/glib/src/nodetree.hg
+++ b/glib/src/nodetree.hg
@@ -24,7 +24,6 @@ _DEFS(glibmm,glib)
#include <glibmm/refptr.h>
#include <glibmm/ustring.h>
#include <glibmm/error.h>
-#include <glibmm/arrayhandle.h>
#include <glib.h>
namespace Glib
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4a0d2fe..a3d7803 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -42,9 +42,7 @@ check_PROGRAMS = \
glibmm_variant/test \
glibmm_vector/test \
glibmm_bool_vector/test \
- glibmm_bool_arrayhandle/test \
glibmm_null_vectorutils/test \
- glibmm_null_containerhandle/test \
glibmm_refptr/test \
glibmm_refptr_sigc_bind/test \
glibmm_weakref/test \
@@ -114,11 +112,8 @@ glibmm_variant_test_SOURCES = glibmm_variant/main.cc
glibmm_vector_test_SOURCES = glibmm_vector/main.cc
glibmm_vector_test_LDADD = $(giomm_ldadd)
glibmm_bool_vector_test_SOURCES = glibmm_bool_vector/main.cc
-glibmm_bool_arrayhandle_test_SOURCES = glibmm_bool_arrayhandle/main.cc
glibmm_null_vectorutils_test_SOURCES = glibmm_null_vectorutils/main.cc
glibmm_null_vectorutils_test_LDADD = $(giomm_ldadd)
-glibmm_null_containerhandle_test_SOURCES = glibmm_null_containerhandle/main.cc
-glibmm_null_containerhandle_test_LDADD = $(giomm_ldadd)
glibmm_refptr_test_SOURCES = glibmm_refptr/main.cc
glibmm_refptr_sigc_bind_test_SOURCES = glibmm_refptr_sigc_bind/main.cc
glibmm_weakref_test_SOURCES = glibmm_weakref/main.cc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]