|
glibmm 2.31.0
|
A utility for converting between std::vector and GList. More...
#include <glibmm/vectorutils.h>
Public Types | |
| typedef Tr::CType | CType |
| typedef T | CppType |
| typedef std::vector< CppType > | VectorType |
| typedef Glib::Container_Helpers::GListKeeper < Tr > | GListKeeperType |
| typedef Glib::Container_Helpers::ListIterator < Tr > | ListIteratorType |
Static Public Member Functions | |
| static VectorType | list_to_vector (GList* glist, Glib::OwnershipType ownership) |
| static GListKeeperType | vector_to_list (const VectorType& vector) |
A utility for converting between std::vector and GList.
This would normally only be used by glibmm or gtkmm itself, or similar libraries that wrap C APIs.
For instance:
std::vector< Glib::RefPtr<Window> > Window::get_children() { return Glib::ListHandler<Glib::RefPtr<Window> >::list_to_vector(gdk_window_get_children(gobj()), Glib::OWNERSHIP_SHALLOW); }
or
void Window::set_icon_list(const std::vector< Glib::RefPtr<Gdk::Pixbuf> >& pixbufs) { gdk_window_set_icon_list(gobj(), Glib::ListHandler<Glib::RefPtr<Gdk::Pixbuf> >::vector_to_list(pixbufs).data ()); }
Note that usage below is wrong - data() returns a pointer to data owned by a temporary ListKeeper returned by vector_to_list(), which is destroyed at the end of this instruction. For details, see Glib::ListKeeper.
GList* glist = Glib::ListHandler<Glib::RefPtr<Gdk::Pixbuf> >::vector_to_list(pixbufs).data();
| typedef T Glib::ListHandler< T, Tr >::CppType |
| typedef Tr::CType Glib::ListHandler< T, Tr >::CType |
| typedef Glib::Container_Helpers::GListKeeper<Tr> Glib::ListHandler< T, Tr >::GListKeeperType |
| typedef Glib::Container_Helpers::ListIterator<Tr> Glib::ListHandler< T, Tr >::ListIteratorType |
| typedef std::vector<CppType> Glib::ListHandler< T, Tr >::VectorType |
| static VectorType Glib::ListHandler< T, Tr >::list_to_vector | ( | GList * | glist, |
| Glib::OwnershipType | ownership | ||
| ) | [static] |
| static GListKeeperType Glib::ListHandler< T, Tr >::vector_to_list | ( | const VectorType & | vector | ) | [static] |
1.7.4