glibmm r565 - in trunk: . gio/src



Author: murrayc
Date: Sun Feb  3 00:14:08 2008
New Revision: 565
URL: http://svn.gnome.org/viewvc/glibmm?rev=565&view=rev

Log:
2008-02-03  Murray Cumming  <murrayc murrayc com>

* gio/src/file.ccg:
* gio/src/file.hg: find_enclosing_mout(), append_to(): Reordered 
parameters and added overload without cancellable. Removed superfluous 
monitor_file() overload.

Modified:
   trunk/ChangeLog
   trunk/gio/src/bufferedinputstream.hg
   trunk/gio/src/datainputstream.hg
   trunk/gio/src/file.ccg
   trunk/gio/src/file.hg

Modified: trunk/gio/src/bufferedinputstream.hg
==============================================================================
--- trunk/gio/src/bufferedinputstream.hg	(original)
+++ trunk/gio/src/bufferedinputstream.hg	Sun Feb  3 00:14:08 2008
@@ -42,6 +42,7 @@
   _WRAP_METHOD(gsize peek(void* buffer, gsize offset, gsize count) const, g_buffered_input_stream_peek)
   _WRAP_METHOD(const void* peek_buffer(gsize& count) const,  g_buffered_input_stream_peek_buffer)
   _WRAP_METHOD(gssize fill(gssize count, const Glib::RefPtr<Cancellable>& cancellable), g_buffered_input_stream_fill, errthrow)
+
   /** non-cancellable version of fill()
    */
 #ifdef GLIBMM_EXCEPTIONS_ENABLED

Modified: trunk/gio/src/datainputstream.hg
==============================================================================
--- trunk/gio/src/datainputstream.hg	(original)
+++ trunk/gio/src/datainputstream.hg	Sun Feb  3 00:14:08 2008
@@ -31,7 +31,7 @@
 /**
  * An implementation of BufferedInputStream that allows for high-level data
  * manipulation of arbitrary data (including binary operations).
-
+ *
  * @newin2p16
  */
 class DataInputStream : public Gio::BufferedInputStream
@@ -47,7 +47,10 @@
   _WRAP_METHOD(DataStreamByteOrder get_byte_order() const, g_data_input_stream_get_byte_order)
   _WRAP_METHOD(void set_newline_type(DataStreamNewlineType type), g_data_input_stream_set_newline_type)
   _WRAP_METHOD(DataStreamNewlineType get_newline_type() const, g_data_input_stream_get_newline_type)
+
+  //TODO: Make read_byte() const? Does it change some state/position?
   _WRAP_METHOD(guchar read_byte(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_byte, errthrow)
+
   /** non-cancellable version of read_byte()
    */
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
@@ -75,6 +78,7 @@
 #endif //GLIBMM_EXCEPTIONS_ENABLED
 
   _WRAP_METHOD(gint32 read_int32(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_int32, errthrow)
+
   /** non-cancellable version of read_int32()
    */
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
@@ -102,6 +106,7 @@
 #endif //GLIBMM_EXCEPTIONS_ENABLED
 
   _WRAP_METHOD(guint64 read_uint64(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_uint64, errthrow)
+
   /** non-cancellable version of read_uint64()
    */
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
@@ -119,6 +124,7 @@
 #else
   std::string read_line(const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error);
 #endif //GLIBMM_EXCEPTIONS_ENABLED
+
   /** non-cancellable version of read_line()
    */
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
@@ -133,6 +139,7 @@
 #else
   std::string read_until(const std::string& stop_chars, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error);
 #endif //GLIBMM_EXCEPTIONS_ENABLED
+
   /** non-cancellable version of read_until()
    */
 #ifdef GLIBMM_EXCEPTIONS_ENABLED

Modified: trunk/gio/src/file.ccg
==============================================================================
--- trunk/gio/src/file.ccg	(original)
+++ trunk/gio/src/file.ccg	Sun Feb  3 00:14:08 2008
@@ -1658,4 +1658,66 @@
   return retvalue;
 }
 
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::RefPtr<FileOutputStream> File::append_to(const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags)
+#else
+Glib::RefPtr<FileOutputStream> File::append_to(const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  Glib::RefPtr<FileOutputStream> retvalue = Glib::wrap(g_file_append_to(gobj(), ((GFileCreateFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  if(retvalue)
+    retvalue->reference(); //The function does not do a ref for us.
+  return retvalue;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::RefPtr<FileOutputStream> File::append_to(FileCreateFlags flags)
+#else
+Glib::RefPtr<FileOutputStream> File::append_to(FileCreateFlags flags, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  Glib::RefPtr<FileOutputStream> retvalue = Glib::wrap(g_file_append_to(gobj(), ((GFileCreateFlags)(flags)), NULL, &(gerror)));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  if(retvalue)
+    retvalue->reference(); //The function does not do a ref for us.
+  return retvalue;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::RefPtr<Mount> File::find_enclosing_mount()
+#else
+Glib::RefPtr<Mount> File::find_enclosing_mount(std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  Glib::RefPtr<Mount> retvalue = Glib::wrap(g_file_find_enclosing_mount(gobj(), NULL, &(gerror)));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  return retvalue;
+}
+
 } // namespace Gio

Modified: trunk/gio/src/file.hg
==============================================================================
--- trunk/gio/src/file.hg	(original)
+++ trunk/gio/src/file.hg	Sun Feb  3 00:14:08 2008
@@ -209,9 +209,57 @@
   _WRAP_METHOD(Glib::RefPtr<FileInputStream> read_finish(const Glib::RefPtr<AsyncResult>& result),
                g_file_read_finish,
                refreturn, errthrow)
-  _WRAP_METHOD(Glib::RefPtr<FileOutputStream> append_to(FileCreateFlags flags, const Glib::RefPtr<Cancellable>& cancellable),
-               g_file_append_to,
-               refreturn, errthrow)
+
+
+  /** Gets an output stream for appending data to the file. If
+   * the file doesn't already exist it is created.
+   * 
+   * By default files created are generally readable by everyone,
+   * but if you pass FILE_CREATE_PRIVATE in @a flags the file
+   * will be made readable only to the current user, to the level that
+   * is supported on the target filesystem.
+   * 
+   * The operation can be cancelled by
+   * triggering the cancellable object from another thread. If the operation
+   * was cancelled, the error IO_ERROR_CANCELLED will be returned. 
+   * 
+   * Some filesystems don't allow all filenames, and may
+   * return an G_IO_ERROR_INVALID_FILENAME error.
+   * If the file is a directory the G_IO_ERROR_IS_DIRECTORY error will be
+   * returned. Other errors are possible too, and depend on what kind of
+   * filesystem the file is on.
+   * @param flags A set of FileCreateFlags.
+   * @param cancellable Optional Cancellable object.
+   * @return A FileOutputStream.
+   */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  Glib::RefPtr<FileOutputStream> append_to(const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags = FILE_CREATE_NONE);
+#else
+  Glib::RefPtr<FileOutputStream> append_to(const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  /** Gets an output stream for appending data to the file. If
+   * the file doesn't already exist it is created.
+   * 
+   * By default files created are generally readable by everyone,
+   * but if you pass FILE_CREATE_PRIVATE in @a flags the file
+   * will be made readable only to the current user, to the level that
+   * is supported on the target filesystem.
+   * 
+   * Some filesystems don't allow all filenames, and may
+   * return an G_IO_ERROR_INVALID_FILENAME error.
+   * If the file is a directory the G_IO_ERROR_IS_DIRECTORY error will be
+   * returned. Other errors are possible too, and depend on what kind of
+   * filesystem the file is on.
+   * @param flags A set of FileCreateFlags.
+   * @return A FileOutputStream.
+   */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  Glib::RefPtr<FileOutputStream> append_to(FileCreateFlags flags = FILE_CREATE_NONE);
+#else
+  Glib::RefPtr<FileOutputStream> append_to(FileCreateFlags flags, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+  _IGNORE(g_file_append_to)
 
   //We renamed this to create_file from (g_file_create()), to avoid confusion with static create() methods, 
   //but I would still like to choose a different word, but can't think of a good one. murrayc.
@@ -613,6 +661,20 @@
   _WRAP_METHOD(Glib::RefPtr<Mount> find_enclosing_mount(const Glib::RefPtr<Cancellable>& cancellable), 
                g_file_find_enclosing_mount, retreturn, errthrow)
 
+  /** Gets a Mount for the File. 
+   * 
+   * If the FileIface for the file does not have a mount (e.g. possibly a 
+   * remote share), an error will be set to IO_ERROR_NOT_FOUND and an empty RefPtr 
+   * will be returned.
+   *
+   * @param cancellable Cancellable object.
+   * @return A Mount where the file is located.
+   */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  Glib::RefPtr<Mount> find_enclosing_mount();
+#else
+  Glib::RefPtr<Mount> find_enclosing_mount(std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
 
 
   /** Asynchronously gets the mount for the file.
@@ -1307,8 +1369,6 @@
 #endif //GLIBMM_EXCEPTIONS_ENABLED
   _IGNORE(g_file_monitor_directory)
 
-  _WRAP_METHOD(Glib::RefPtr<FileMonitor> monitor_file(FileMonitorFlags flags, const Glib::RefPtr<Cancellable>& cancellable), g_file_monitor_file, errthrow)
-
   /** Obtains a file monitor for the given file. If no file notification
    * mechanism exists, then regular polling of the file is used.
    * 
@@ -1340,6 +1400,7 @@
 #else
   Glib::RefPtr<FileMonitor> monitor_file(FileMonitorFlags flags, std::auto_ptr<Glib::Error>& error);
 #endif //GLIBMM_EXCEPTIONS_ENABLED
+  _IGNORE(g_file_monitor_file)
 
 
   //TODO: Documentation.



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