[libsoupmm] Wrap more API



commit c43754b944bb3d0279db4d4d6713c6c49ea4cd08
Author: Siavash Safi <siavash siavashs org>
Date:   Thu Aug 27 18:40:25 2009 +0430

    Wrap more API
    
    * libsoup/.gitignore:
    * libsoup/libsoupmm.h:
    * libsoup/libsoupmm/filelist.am:
    * libsoup/libsoupmm/status.cc:
    * libsoup/libsoupmm/status.h:
    * libsoup/src/address.ccg:
    * libsoup/src/address.hg:
    * libsoup/src/enums.ccg:
    * libsoup/src/enums.hg:
    * libsoup/src/filelist.am

 libsoup/.gitignore            |   11 +++++++----
 libsoup/libsoupmm.h           |    2 ++
 libsoup/libsoupmm/filelist.am |    4 ++--
 libsoup/libsoupmm/status.cc   |   37 +++++++++++++++++++++++++++++++++++++
 libsoup/libsoupmm/status.h    |   31 +++++++++++++++++++++++++++++++
 libsoup/src/address.ccg       |   40 ++++++++++++++++++++++++++++++++++++++++
 libsoup/src/address.hg        |    6 ++++++
 libsoup/src/enums.ccg         |   18 ++++++++++++++++++
 libsoup/src/enums.hg          |   26 ++++++++++++++++++++++++++
 libsoup/src/filelist.am       |    2 +-
 10 files changed, 170 insertions(+), 7 deletions(-)
---
diff --git a/libsoup/.gitignore b/libsoup/.gitignore
index 24a47f5..7c609c2 100644
--- a/libsoup/.gitignore
+++ b/libsoup/.gitignore
@@ -1,15 +1,18 @@
+/libsoupmmconfig.h
 /libsoupmm-*.pc
 /libsoupmm/address.cc
 /libsoupmm/address.h
 /libsoupmm/auth.cc
 /libsoupmm/auth.h
-/libsoupmm/message.h
+/libsoupmm/enums.cc
+/libsoupmm/enums.h
 /libsoupmm/message.cc
-/libsoupmm/message-body.h
+/libsoupmm/message.h
 /libsoupmm/message-body.cc
-/libsoupmm/session.h
+/libsoupmm/message-body.h
 /libsoupmm/session.cc
-/libsoupmm/uri.h
+/libsoupmm/session.h
 /libsoupmm/uri.cc
+/libsoupmm/uri.h
 /libsoupmm/wrap_init.cc
 /src/.stamps
diff --git a/libsoup/libsoupmm.h b/libsoup/libsoupmm.h
index 93fc917..e2c387c 100644
--- a/libsoup/libsoupmm.h
+++ b/libsoup/libsoupmm.h
@@ -29,9 +29,11 @@ extern const int libsoupmm_micro_version;
 
 #include <libsoupmm/address.h>
 #include <libsoupmm/auth.h>
+#include <libsoupmm/enums.h>
 #include <libsoupmm/message.h>
 #include <libsoupmm/message-body.h>
 #include <libsoupmm/session.h>
+#include <libsoupmm/status.h>
 #include <libsoupmm/uri.h>
 
 #endif /* !LIBSOUPMM_H */
diff --git a/libsoup/libsoupmm/filelist.am b/libsoup/libsoupmm/filelist.am
index 4d14bfc..8d08476 100644
--- a/libsoup/libsoupmm/filelist.am
+++ b/libsoup/libsoupmm/filelist.am
@@ -3,6 +3,6 @@
 files_built_cc = $(files_hg:.hg=.cc) wrap_init.cc
 files_built_h  = $(files_hg:.hg=.h)
 files_built_ph = $(patsubst %.hg,private/%_p.h,$(files_hg))
-files_extra_cc =
-files_extra_h  = wrap_init.h
+files_extra_cc = status.cc
+files_extra_h  = status.h wrap_init.h
 files_extra_ph =
diff --git a/libsoup/libsoupmm/status.cc b/libsoup/libsoupmm/status.cc
new file mode 100644
index 0000000..e6ad79a
--- /dev/null
+++ b/libsoup/libsoupmm/status.cc
@@ -0,0 +1,37 @@
+/* Copyright (c) 2009  Siavash Safi <siavashs siavashs org>
+ *
+ * This file is part of libsoupmm.
+ *
+ * libsoupmm is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License,
+ * or (at your option) any later version.
+ *
+ * libsoupmm is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glibmm.h>
+#include <libsoupmm/status.h>
+#include <libsoup/soup-status.h>
+
+namespace Soup
+{
+
+std::string status_get_phrase(guint status_code)
+{
+  return Glib::convert_const_gchar_ptr_to_stdstring(soup_status_get_phrase(status_code));
+}
+
+guint status_proxify(guint status_code)
+{
+  return soup_status_proxify(status_code);
+}
+
+} // namespace Soup
+
diff --git a/libsoup/libsoupmm/status.h b/libsoup/libsoupmm/status.h
new file mode 100644
index 0000000..429e044
--- /dev/null
+++ b/libsoup/libsoupmm/status.h
@@ -0,0 +1,31 @@
+/* Copyright (c) 2009  Siavash Safi <siavashs siavashs org>
+ *
+ * This file is part of libsoupmm.
+ *
+ * libsoupmm is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License,
+ * or (at your option) any later version.
+ *
+ * libsoupmm is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef LIBSOUPMM_STATUS_H_INCLUDED
+#define LIBSOUPMM_STATUS_H_INCLUDED
+
+namespace Soup
+{
+
+std::string status_get_phrase(guint status_code);
+
+guint status_proxify(guint status_code);
+
+} // namespace Soup
+
+#endif /* !LIBSOUPMM_STATUS_H_INCLUDED */
diff --git a/libsoup/src/address.ccg b/libsoup/src/address.ccg
index 602b24d..26f62e6 100644
--- a/libsoup/src/address.ccg
+++ b/libsoup/src/address.ccg
@@ -19,4 +19,44 @@
 namespace Soup
 {
 
+void
+SignalProxy_address_callback(SoupAddress*, guint status, void* data)
+{
+  SlotAddress* the_slot = static_cast<SlotAddress*>(data);
+
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
+  try
+  {
+  #endif //GLIBMM_EXCEPTIONS_ENABLED
+    (*the_slot)(status);
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
+  }
+  catch(...)
+  {
+    Glib::exception_handlers_invoke();
+  }
+  #endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  delete the_slot;
+}
+
+void
+Address::resolve_async(const SlotAddress& slot)
+{
+  SlotAddress* slot_copy = new SlotAddress(slot);
+  soup_address_resolve_async(gobj(), NULL, NULL, &SignalProxy_address_callback, slot_copy);
+}
+
+void
+Address::resolve_async(const Glib::RefPtr<Glib::MainContext>& async_context, const Glib::RefPtr<Gio::Cancellable>& cancellable, const SlotAddress& slot)
+{
+  SlotAddress* slot_copy = new SlotAddress(slot);
+  soup_address_resolve_async(gobj(), async_context->gobj(), cancellable->gobj(), &SignalProxy_address_callback, slot_copy);
+}
+
+guint Address::resolve_sync()
+{
+  return soup_address_resolve_sync(gobj(), NULL);
+}
+
 } // namespace Soup
diff --git a/libsoup/src/address.hg b/libsoup/src/address.hg
index 130067a..1139897 100644
--- a/libsoup/src/address.hg
+++ b/libsoup/src/address.hg
@@ -28,6 +28,8 @@ namespace Soup
 
 _WRAP_ENUM(AddressFamily, SoupAddressFamily, NO_GTYPE)
 
+typedef sigc::slot<void, guint > SlotAddress;
+
 class Address : public Glib::Object
 {
   _CLASS_GOBJECT(Address, SoupAddress, SOUP_ADDRESS, Glib::Object, GObject)
@@ -44,6 +46,10 @@ public:
   _WRAP_METHOD(guint get_port() const, soup_address_get_port)
   _WRAP_METHOD(bool is_resolved() const, soup_address_is_resolved)
 
+  void resolve_async(const SlotAddress& slot);
+  void resolve_async(const Glib::RefPtr<Glib::MainContext>& async_context, const Glib::RefPtr<Gio::Cancellable>& cancellable, const SlotAddress& slot);
+
+  guint resolve_sync();
 #m4 _CONVERSION(`const Glib::RefPtr<Gio::Cancellable>&', `GCancellable*', __CONVERT_REFPTR_TO_P)
   _WRAP_METHOD(guint resolve_sync(const Glib::RefPtr<Gio::Cancellable>& cancellable), soup_address_resolve_sync)
 
diff --git a/libsoup/src/enums.ccg b/libsoup/src/enums.ccg
new file mode 100644
index 0000000..5220824
--- /dev/null
+++ b/libsoup/src/enums.ccg
@@ -0,0 +1,18 @@
+/* Copyright (c) 2009  Siavash Safi <siavashs siavashs org>
+ *
+ * This file is part of libsoupmm.
+ *
+ * libsoupmm is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License,
+ * or (at your option) any later version.
+ *
+ * libsoupmm is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
diff --git a/libsoup/src/enums.hg b/libsoup/src/enums.hg
new file mode 100644
index 0000000..1c8b676
--- /dev/null
+++ b/libsoup/src/enums.hg
@@ -0,0 +1,26 @@
+/* Copyright (c) 2009  Siavash Safi <siavashs siavashs org>
+ *
+ * This file is part of libsoupmm.
+ *
+ * libsoupmm is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License,
+ * or (at your option) any later version.
+ *
+ * libsoupmm is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+_DEFS(libsoupmm,libsoup)
+
+namespace Soup
+{
+
+_WRAP_ENUM(KnownStatusCode, SoupKnownStatusCode, NO_GTYPE)
+
+} // namespace Soup
diff --git a/libsoup/src/filelist.am b/libsoup/src/filelist.am
index bb94a0f..c23db5b 100644
--- a/libsoup/src/filelist.am
+++ b/libsoup/src/filelist.am
@@ -8,5 +8,5 @@ files_defs =			\
 	libsoup_docs.xml	\
 	libsoup_docs_override.xml
 
-files_hg  = address.hg auth.hg message.hg message-body.hg session.hg uri.hg
+files_hg  = address.hg auth.hg enums.hg message.hg message-body.hg session.hg uri.hg
 files_ccg = $(files_hg:.hg=.ccg)



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