summaryrefslogtreecommitdiff
path: root/gio/src
diff options
context:
space:
mode:
Diffstat (limited to 'gio/src')
-rw-r--r--gio/src/resolver.ccg16
-rw-r--r--gio/src/resolver.hg12
-rw-r--r--gio/src/srvtarget.hg23
3 files changed, 22 insertions, 29 deletions
diff --git a/gio/src/resolver.ccg b/gio/src/resolver.ccg
index 093f6981..df3e0df1 100644
--- a/gio/src/resolver.ccg
+++ b/gio/src/resolver.ccg
@@ -19,6 +19,22 @@
#include <glibmm/error.h>
#include "slot_async.h"
+namespace {
+
+struct SrvTargetListTraits
+{
+ using CppType = Gio::SrvTarget;
+ using CType = const GSrvTarget*;
+ using CTypeNonConst = GSrvTarget*;
+
+ static CType to_c_type(const CppType& item) { return item.gobj(); }
+ static CType to_c_type(CType ptr) { return ptr; }
+ static CppType to_cpp_type(CType item) { return CppType(const_cast<CTypeNonConst>(item), true /* take_copy */); }
+ static void release_c_type(CType item) { g_srv_target_free(const_cast<CTypeNonConst>(item)); }
+};
+
+} // anonymous namespace
+
namespace Gio
{
diff --git a/gio/src/resolver.hg b/gio/src/resolver.hg
index 67258e56..3b162242 100644
--- a/gio/src/resolver.hg
+++ b/gio/src/resolver.hg
@@ -67,8 +67,8 @@ public:
// g_resolver_free_addresses is just a C convenience function
_IGNORE(g_resolver_free_addresses)
-#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<InetAddress> >',`$2($3, Glib::OWNERSHIP_DEEP)')
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<InetAddress> > lookup_by_name(const Glib::ustring& hostname, const Glib::RefPtr<Cancellable>& cancellable{?}), g_resolver_lookup_by_name, errthrow)
+#m4 _CONVERSION(`GList*',`std::vector<Glib::RefPtr<InetAddress>>',`Glib::ListHandler<Glib::RefPtr<InetAddress>>::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector<Glib::RefPtr<InetAddress>> lookup_by_name(const Glib::ustring& hostname, const Glib::RefPtr<Cancellable>& cancellable{?}), g_resolver_lookup_by_name, errthrow)
/** Begins asynchronously resolving hostname to determine its associated IP address(es), and eventually calls @a slot, which must call
* lookup_by_name_finish() to get the result. See lookup_by_name() for more details.
@@ -88,7 +88,7 @@ public:
void lookup_by_name_async(const Glib::ustring& hostname, const SlotAsyncReady& slot);
_IGNORE(g_resolver_lookup_by_name_async)
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<InetAddress> > lookup_by_name_finish(const Glib::RefPtr<AsyncResult>& result), g_resolver_lookup_by_name_finish, errthrow)
+ _WRAP_METHOD(std::vector<Glib::RefPtr<InetAddress>> lookup_by_name_finish(const Glib::RefPtr<AsyncResult>& result), g_resolver_lookup_by_name_finish, errthrow)
_WRAP_METHOD(Glib::ustring lookup_by_address(const Glib::RefPtr<InetAddress>& address, const Glib::RefPtr<Cancellable>& cancellable{?}), g_resolver_lookup_by_address, errthrow)
@@ -112,8 +112,8 @@ public:
_WRAP_METHOD(Glib::ustring lookup_by_address_finish(const Glib::RefPtr<AsyncResult>& result), g_resolver_lookup_by_address_finish, errthrow)
-#m4 _CONVERSION(`GList*',`ListHandle_SrvTarget',`$2($3, Glib::OWNERSHIP_DEEP)')
- _WRAP_METHOD(ListHandle_SrvTarget lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, const Glib::RefPtr<Cancellable>& cancellable{?}), g_resolver_lookup_service, errthrow)
+#m4 _CONVERSION(`GList*',`std::vector<SrvTarget>',`Glib::ListHandler<SrvTarget, SrvTargetListTraits>::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector<SrvTarget> lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, const Glib::RefPtr<Cancellable>& cancellable{?}), g_resolver_lookup_service, errthrow)
/** Begins asynchronously performing a DNS SRV lookup for the given service and protocol in the given domain, and eventually calls callback,
* which must call lookup_service_finish() to get the final result. See glookup_service() for more details.
@@ -137,7 +137,7 @@ public:
void lookup_service_async(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, const SlotAsyncReady& slot);
_IGNORE(g_resolver_lookup_service_async)
- _WRAP_METHOD(ListHandle_SrvTarget lookup_service_finish(const Glib::RefPtr<AsyncResult>& result), g_resolver_lookup_service_finish, errthrow)
+ _WRAP_METHOD(std::vector<SrvTarget> lookup_service_finish(const Glib::RefPtr<AsyncResult>& result), g_resolver_lookup_service_finish, errthrow)
#m4 _CONVERSION(`GList*',`std::vector<Glib::VariantContainerBase>',`Glib::ListHandler<Glib::VariantContainerBase>::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
diff --git a/gio/src/srvtarget.hg b/gio/src/srvtarget.hg
index edaf02fd..f5d79609 100644
--- a/gio/src/srvtarget.hg
+++ b/gio/src/srvtarget.hg
@@ -15,12 +15,6 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <glibmm/listhandle.h>
-
-// unfortunately we need to include the C header for the type traits
-// implementation
-#include <gio/gio.h>
-
_DEFS(giomm,gio)
namespace Gio
@@ -59,23 +53,6 @@ public:
};
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-
-struct SrvTargetListTraits
-{
- using CppType = Gio::SrvTarget;
- using CType = const GSrvTarget*;
- using CTypeNonConst = GSrvTarget*;
-
- static CType to_c_type(const CppType& item) { return item.gobj(); }
- static CType to_c_type(CType ptr) { return ptr; }
- static CppType to_cpp_type(CType item) { return CppType(const_cast<CTypeNonConst>(item), true /* take_copy */); }
- static void release_c_type(CType item) { g_srv_target_free(const_cast<CTypeNonConst>(item)); }
-};
-
-#endif // DOXYGEN_SHOULD_SKIP_THIS
-
-using ListHandle_SrvTarget = Glib::ListHandle<Gio::SrvTarget, SrvTargetListTraits>;
} // namespace Gio