glibmm r509 - in trunk: . gio/src glib/src tools/m4



Author: murrayc
Date: Tue Jan 15 12:23:43 2008
New Revision: 509
URL: http://svn.gnome.org/viewvc/glibmm?rev=509&view=rev

Log:
2008-01-15  Murray Cumming  <murrayc murrayc com>

* tools/m4/Makefile_list_of_sources.am_fragment:
* tools/m4/convert_gio.m4:
* tools/m4/convert_glib.m4:
* tools/m4/convert_gtkmm.m4: Moved the gio conversions into 
their own .m4 file, to make it easier to find them.

* gio/src/cancellable.ccg:
* gio/src/cancellable.hg: Use _WRAP_METHOD() for get_current(), 
which also fixes the refcounting.
* glib/src/uriutils.hg: Added documentation and default parameter 
values.

Added:
   trunk/tools/m4/convert_gio.m4
      - copied, changed from r508, /trunk/tools/m4/convert_glib.m4
Modified:
   trunk/ChangeLog
   trunk/gio/src/cancellable.ccg
   trunk/gio/src/cancellable.hg
   trunk/glib/src/uriutils.hg
   trunk/tools/m4/Makefile_list_of_sources.am_fragment
   trunk/tools/m4/convert_glib.m4
   trunk/tools/m4/convert_gtkmm.m4

Modified: trunk/gio/src/cancellable.ccg
==============================================================================
--- trunk/gio/src/cancellable.ccg	(original)
+++ trunk/gio/src/cancellable.ccg	Tue Jan 15 12:23:43 2008
@@ -21,11 +21,5 @@
 
 namespace Gio {
 
-// TODO: should we somehow shield from possible NULL with an exception?
-Glib::RefPtr<Cancellable>
-Cancellable::get_current()
-{
-  return Glib::wrap(g_cancellable_get_current());
-}
 
 } // namespace Gio

Modified: trunk/gio/src/cancellable.hg
==============================================================================
--- trunk/gio/src/cancellable.hg	(original)
+++ trunk/gio/src/cancellable.hg	Tue Jan 15 12:23:43 2008
@@ -53,12 +53,7 @@
   //This is safe to call from another thread.
   _WRAP_METHOD(void cancel(), g_cancellable_cancel)
 
-  _IGNORE(g_cancellable_get_current)
-
-  /** Gets the top cancellable from the stack.
-   * @result a Cancellable from the top of the stack, or an invalid RefPtr if the stack is empty.
-   */
-  static Glib::RefPtr<Cancellable> get_current();
+  _WRAP_METHOD(static Glib::RefPtr<Cancellable> get_current(), g_cancellable_get_current, refreturn)
 
   _WRAP_METHOD(void push_current(),
                g_cancellable_push_current)

Modified: trunk/glib/src/uriutils.hg
==============================================================================
--- trunk/glib/src/uriutils.hg	(original)
+++ trunk/glib/src/uriutils.hg	Tue Jan 15 12:23:43 2008
@@ -32,30 +32,55 @@
  * Various uri-related functions.
  */
 
-//TODO: Documentation: See http://bugzilla.gnome.org/show_bug.cgi?id=508773
 
-/**
+/** Unescapes a whole escaped string.
+ *
+ * @param escaped_string An escaped string to be unescaped.
+ * @param illegal_characters A string of illegal characters not to be allowed.
+ * @result An unescaped version of @a escaped_string.
+ * 
  * @ingroup UriUtils
  * @newin2p16
  */
-std::string uri_unescape_string(const std::string& escaped_string, const std::string& illegal_characters);
+std::string uri_unescape_string(const std::string& escaped_string, const std::string& illegal_characters = std::string());
 
 //TODO: Use iterator? 
 //char *   g_uri_unescape_segment      (const char *escaped_string,
 //				      const char *escaped_string_end,
 //				      const char *illegal_characters);
 
-/**
+/** Gets the scheme portion of a URI. RFC 3986 decodes the scheme as:
+ * @code
+ * URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] 
+ * @endcode
+ * Common schemes include "file", "http", "svn+ssh", etc.
+ *
+ * @param uri
+ * @result The "Scheme" component of the URI, or an empty string on error. 
+ * 
  * @ingroup UriUtils
  * @newin2p16
  */
 std::string uri_get_scheme(const std::string& uri);
 
-/**
+/** Escapes a string for use in a URI.
+ *
+ * Normally all characters that are not "unreserved" (i.e. ASCII alphanumerical
+ * characters plus dash, dot, underscore and tilde) are escaped.
+ * But if you specify characters in @a reserved_chars_allowed they are not
+ * escaped. This is useful for the "reserved" characters in the URI
+ * specification, since those are allowed unescaped in some portions of
+ * a URI.
+ *
+ * @param unescaped The unescaped input string.
+ * @param reserved_chars_allowed A string of reserved characters that are allowed to be used.
+ * @param allow_utf8 true if the result can include UTF-8 characters.
+ * @result An escaped version of @a unescaped.
+ *
  * @ingroup UriUtils
  * @newin2p16
  */
-std::string uri_escape_string(const std::string& unescaped, const std::string& reserved_chars_allowed, bool allow_utf8 = true);
+std::string uri_escape_string(const std::string& unescaped, const std::string& reserved_chars_allowed = std::string(), bool allow_utf8 = true);
 
 } // namespace Glib
 

Modified: trunk/tools/m4/Makefile_list_of_sources.am_fragment
==============================================================================
--- trunk/tools/m4/Makefile_list_of_sources.am_fragment	(original)
+++ trunk/tools/m4/Makefile_list_of_sources.am_fragment	Tue Jan 15 12:23:43 2008
@@ -3,6 +3,6 @@
 		 class_interface.m4 class_opaque_refcounted.m4 class_opaque_copyable.m4 \
 		 gerror.m4 \
 		 compare.m4 convert.m4 convert_base.m4 convert_gtkmm.m4 convert_atk.m4 convert_gdk.m4 \
-		 convert_glib.m4 convert_gtk.m4 convert_pango.m4 ctor.m4 doc.m4 enum.m4 list.m4 member.m4 \
+		 convert_glib.m4 convert_gio.m4 convert_gtk.m4 convert_pango.m4 ctor.m4 doc.m4 enum.m4 list.m4 member.m4 \
 		 method.m4 property.m4 signal.m4 vfunc.m4
 

Copied: trunk/tools/m4/convert_gio.m4 (from r508, /trunk/tools/m4/convert_glib.m4)
==============================================================================
--- /trunk/tools/m4/convert_glib.m4	(original)
+++ trunk/tools/m4/convert_gio.m4	Tue Jan 15 12:23:43 2008
@@ -1,31 +1,3 @@
-dnl 
-dnl Glib C names have prefix 'G' but C++ namespace Glib
-dnl 
-define(`_CONV_GLIB_ENUM',`dnl
-_CONVERSION(`G$1', `$1', (($1)(__ARG3__)))
-_CONVERSION(`G$1', `Glib::$1', ((Glib::$1)(__ARG3__)))
-_CONVERSION(`$1', `G$1', ((G$1)(__ARG3__)))
-_CONVERSION(`Glib::$1', `G$1', ((G$1)(__ARG3__)))
-')dnl
-
-_EQUAL(gchar,char)
-_EQUAL(gchar*,char*)
-_EQUAL(gchar**,char**)
-_EQUAL(gint**,int**)
-_EQUAL(gchar**,char*[])
-_EQUAL(const gchar*,const char*)
-_EQUAL(const-gchar*,const char*)
-_EQUAL(gpointer*,void**)
-
-_CONV_GLIB_ENUM(IOStatus)
-_CONV_GLIB_ENUM(IOFlags)
-_CONV_GLIB_ENUM(IOCondition)
-_CONV_GLIB_ENUM(SeekType)
-_CONV_GLIB_ENUM(OptionArg)
-_CONV_GLIB_ENUM(KeyFileFlags)
-_CONV_GLIB_ENUM(RegexCompileFlags)
-_CONV_GLIB_ENUM(RegexMatchFlags)
-
 _CONV_ENUM(G,PasswordSave)
 _CONV_ENUM(G,MountOperationResult)
 _CONV_ENUM(G,FileAttributeType)
@@ -38,51 +10,6 @@
 _CONV_ENUM(G,OutputStreamSpliceFlags)
 _CONV_ENUM(G,AppInfoCreateFlags)
 
-_CONVERSION(`gunichar&',`gunichar*',`&($3)')
-_CONVERSION(`gsize&',`gsize*',`&($3)')
-
-
-# Strings:
-define(`__GCHARP_TO_USTRING',`Glib::convert_const_gchar_ptr_to_ustring($`'3)')
-define(`__GCHARP_TO_STDSTRING',`Glib::convert_const_gchar_ptr_to_stdstring($`'3)')
-
-_CONVERSION(`const Glib::ustring&',`const char*',`$3.c_str()')
-_CONVERSION(`const std::string&',`const char*',`$3.c_str()')
-_CONVERSION(`const Glib::ustring&',`gchar*',`const_cast<gchar*>($3.c_str())')
-_CONVERSION(`gchar*',`Glib::ustring',__GCHARP_TO_USTRING)
-_CONVERSION(`const-gchar*',`Glib::ustring',__GCHARP_TO_USTRING)
-_CONVERSION(`const gchar*',`Glib::ustring',__GCHARP_TO_USTRING)
-_CONVERSION(`const char*',`Glib::ustring',__GCHARP_TO_USTRING)
-_CONVERSION(`const char*',`std::string',__GCHARP_TO_STDSTRING)
-_CONVERSION(`const gchar*',`const Glib::ustring&',__GCHARP_TO_USTRING)
-_CONVERSION(`const char*',`const-gchar*',`$3')
-_CONVERSION(`const-gchar*',`const char*',`$3')
-_CONVERSION(`const char*',`const std::string&',__GCHARP_TO_STDSTRING)
-_CONVERSION(`char*',`std::string',__GCHARP_TO_STDSTRING)
-_CONVERSION(`std::string', `char*', `g_strdup(($3).c_str())')
-_CONVERSION(`const std::string&', `char*', `g_strdup(($3).c_str())')
-_CONVERSION(`Glib::ustring', `char*', `g_strdup(($3).c_str())')
-
-_CONVERSION(`return-gchar*',`Glib::ustring',`Glib::convert_return_gchar_ptr_to_ustring($3)')
-_CONVERSION(`return-gchar*',`std::string',`Glib::convert_return_gchar_ptr_to_stdstring($3)')
-_CONVERSION(`return-char*',`Glib::ustring',`Glib::convert_return_gchar_ptr_to_ustring($3)')
-
-_CONVERSION(`const Glib::RefPtr<Glib::Object>&',`GObject*',__CONVERT_REFPTR_TO_P)
-_CONVERSION(`const Glib::RefPtr<const Glib::Object>&',`GObject*',__CONVERT_CONST_REFPTR_TO_P_SUN(Glib::Object))
-_CONVERSION(`GObject*',`Glib::RefPtr<Glib::Object>',`Glib::wrap($3)')
-_CONVERSION(`GObject*',`Glib::RefPtr<const Glib::Object>',`Glib::wrap($3)')
-
-_CONVERSION(`GRegex*',`Glib::RefPtr<Regex>',`Glib::wrap($3)')
-_CONVERSION(`GRegex*',`Glib::RefPtr<const Regex>',`Glib::wrap($3)')
-
-_CONVERSION(`Glib::ValueBase&',`GValue*',`($3).gobj()')
-_CONVERSION(`const Glib::ValueBase&',`const GValue*',`($3).gobj()')
-_CONVERSION(`const Glib::ValueBase&',`GValue*',`const_cast<GValue*>(($3).gobj())')
-_CONVERSION(`GValue*', `Glib::ValueBase&', `*reinterpret_cast<Glib::ValueBase*>($3)')
-_CONVERSION(`const GValue*', `const Glib::ValueBase&', `*reinterpret_cast<const Glib::ValueBase*>($3)')
-
-_CONVERSION(`OptionGroup&',`GOptionGroup*',`($3).gobj()')
-#_CONVERSION(`GOptionGroup*',`OptionGroup',`Glib::wrap(($3), true /* take_copy */)')
 
 # AppInfo
 _CONVERSION(`GAppInfo*',`Glib::RefPtr<AppInfo>',`Glib::wrap($3)')
@@ -97,6 +24,8 @@
 
 # Cancellable
 _CONVERSION(`const Glib::RefPtr<Cancellable>&',`GCancellable*',__CONVERT_CONST_REFPTR_TO_P)
+_CONVERSION(`GCancellable*', `Glib::RefPtr<Cancellable>', `Glib::wrap($3)')
+
 
 # Drive
 _CONVERSION(`GDrive*',`Glib::RefPtr<Drive>',`Glib::wrap($3)')

Modified: trunk/tools/m4/convert_glib.m4
==============================================================================
--- trunk/tools/m4/convert_glib.m4	(original)
+++ trunk/tools/m4/convert_glib.m4	Tue Jan 15 12:23:43 2008
@@ -26,17 +26,6 @@
 _CONV_GLIB_ENUM(RegexCompileFlags)
 _CONV_GLIB_ENUM(RegexMatchFlags)
 
-_CONV_ENUM(G,PasswordSave)
-_CONV_ENUM(G,MountOperationResult)
-_CONV_ENUM(G,FileAttributeType)
-_CONV_ENUM(G,FileAttributeInfoFlags)
-_CONV_ENUM(G,FileCopyFlags)
-_CONV_ENUM(G,FileCreateFlags)
-_CONV_ENUM(G,FileMonitorFlags)
-_CONV_ENUM(G,FileQueryInfoFlags)
-_CONV_ENUM(G,FileType)
-_CONV_ENUM(G,OutputStreamSpliceFlags)
-_CONV_ENUM(G,AppInfoCreateFlags)
 
 _CONVERSION(`gunichar&',`gunichar*',`&($3)')
 _CONVERSION(`gsize&',`gsize*',`&($3)')
@@ -84,64 +73,3 @@
 _CONVERSION(`OptionGroup&',`GOptionGroup*',`($3).gobj()')
 #_CONVERSION(`GOptionGroup*',`OptionGroup',`Glib::wrap(($3), true /* take_copy */)')
 
-# AppInfo
-_CONVERSION(`GAppInfo*',`Glib::RefPtr<AppInfo>',`Glib::wrap($3)')
-_CONVERSION(`const Glib::ListHandle<std::string>&',`GList*',`$3.data()')
-_CONVERSION(`const Glib::RefPtr<AppLaunchContext>&',`GAppLaunchContext*',__CONVERT_REFPTR_TO_P)
-_CONVERSION(`const Glib::RefPtr<AppInfo>&',`GAppInfo*',__CONVERT_REFPTR_TO_P)
-
-# AsyncResult
-_CONVERSION(`Glib::RefPtr<Glib::Object>',`GObject*',__CONVERT_REFPTR_TO_P)
-_CONVERSION(`const Glib::RefPtr<AsyncResult>&',`GAsyncResult*',__CONVERT_REFPTR_TO_P)
-_CONVERSION(`Glib::RefPtr<AsyncResult>&',`GAsyncResult*',__CONVERT_REFPTR_TO_P)
-
-# Cancellable
-_CONVERSION(`const Glib::RefPtr<Cancellable>&',`GCancellable*',__CONVERT_CONST_REFPTR_TO_P)
-
-# Drive
-_CONVERSION(`GDrive*',`Glib::RefPtr<Drive>',`Glib::wrap($3)')
-
-# File
-_CONVERSION(`return-char*',`std::string',`Glib::convert_return_gchar_ptr_to_stdstring($3)')
-_CONVERSION(`Glib::RefPtr<File>',`GFile*',__CONVERT_REFPTR_TO_P)
-_CONVERSION(`const Glib::RefPtr<File>&',`GFile*',__CONVERT_CONST_REFPTR_TO_P)
-_CONVERSION(`GFile*',`Glib::RefPtr<File>',`Glib::wrap($3)')
-_CONVERSION(`GFile*',`const Glib::RefPtr<File>&',`Glib::wrap($3, true)')
-
-# FileAttribute
-_CONVERSION(`GFileAttributeValue*',`FileAttributeValue',`Glib::wrap($3)')
-_CONVERSION(`const FileAttributeValue&',`const GFileAttributeValue*',`$3.gobj()')
-_CONVERSION(`GFileAttributeInfoList*',`Glib::RefPtr<FileAttributeInfoList>',`Glib::wrap($3)')
-
-#FileEnumerator
-_CONVERSION(`GFileEnumerator*',`Glib::RefPtr<FileEnumerator>',`Glib::wrap($3)')
-
-# FileInfo
-_CONVERSION(`GFileInfo*',`Glib::RefPtr<FileInfo>',`Glib::wrap($3)')
-_CONVERSION(`Glib::RefPtr<FileInfo>&',`GFileInfo*',__CONVERT_REFPTR_TO_P)
-_CONVERSION(`const Glib::RefPtr<FileInfo>&',`GFileInfo*',__CONVERT_REFPTR_TO_P)
-_CONVERSION(`char**',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3)')
-_CONVERSION(`Glib::TimeVal&', `GTimeVal*', static_cast<$2>(&$3))
-_CONVERSION(`const Glib::TimeVal&', `GTimeVal*', const_cast<GTimeVal*>(static_cast<const GTimeVal*>(&$3)))
-_CONVERSION(`const Glib::RefPtr<FileAttributeMatcher>&',`GFileAttributeMatcher*',__CONVERT_CONST_REFPTR_TO_P)
-_CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<FileInfo> >',__FL2H_SHALLOW)
-
-# FileInputStream
-_CONVERSION(`GFileInputStream*',`Glib::RefPtr<FileInputStream>',`Glib::wrap($3)')
-
-# FileOutputStream
-_CONVERSION(`GFileOutputStream*',`Glib::RefPtr<FileOutputStream>',`Glib::wrap($3)')
-
-# Icon
-_CONVERSION(`GIcon*',`Glib::RefPtr<Icon>',`Glib::wrap($3)')
-_CONVERSION(`const Glib::RefPtr<Icon>&',`GIcon*',__CONVERT_CONST_REFPTR_TO_P)
-
-# InputStream
-_CONVERSION(`const Glib::RefPtr<InputStream>&',`GInputStream*',__CONVERT_CONST_REFPTR_TO_P)
-
-# MountOptions
-_CONVERSION(`GPasswordSave',`PasswordSave',`($2)$3')
-_CONVERSION(`PasswordSave',`GPasswordSave',`($2)$3')
-
-#Volume
-_CONVERSION(`GVolume*',`Glib::RefPtr<Volume>',`Glib::wrap($3)')

Modified: trunk/tools/m4/convert_gtkmm.m4
==============================================================================
--- trunk/tools/m4/convert_gtkmm.m4	(original)
+++ trunk/tools/m4/convert_gtkmm.m4	Tue Jan 15 12:23:43 2008
@@ -6,3 +6,4 @@
 include(convert_gdk.m4)
 include(convert_atk.m4)
 include(convert_glib.m4)
+include(convert_gio.m4)



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