diff options
author | Murray Cumming <murrayc@murrayc.com> | 2008-01-23 09:21:24 +0000 |
---|---|---|
committer | Murray Cumming <murrayc@src.gnome.org> | 2008-01-23 09:21:24 +0000 |
commit | 05f93d80001fb857bd1844854481ef2a5f6959ed (patch) | |
tree | 507f84cc1ed7326847fa283892d97502cf71d1a0 /gio/src/file.ccg | |
parent | 9ba22fdf516d978654d2f7796185b1f792d43bf2 (diff) | |
download | glibmm-05f93d80001fb857bd1844854481ef2a5f6959ed.tar.gz |
Added a read() method overload with no cancellable parameter. Try loading
2008-01-23 Murray Cumming <murrayc@murrayc.com>
* gio/src/file.ccg:
* gio/src/file.hg: Added a read() method overload with no
cancellable parameter.
* tests/giomm_simple/main.cc: Try loading the contents of a file.
Seems to work, though there is an unknown GError domain when the file
does not exist.
svn path=/trunk/; revision=536
Diffstat (limited to 'gio/src/file.ccg')
-rw-r--r-- | gio/src/file.ccg | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gio/src/file.ccg b/gio/src/file.ccg index fea3f4ff..de79b19b 100644 --- a/gio/src/file.ccg +++ b/gio/src/file.ccg @@ -1146,4 +1146,25 @@ Glib::RefPtr<FileMonitor> File::monitor_file(FileMonitorFlags flags, std::auto_ return retvalue; } +#ifdef GLIBMM_EXCEPTIONS_ENABLED +Glib::RefPtr<FileInputStream> File::read() +#else +Glib::RefPtr<FileInputStream> File::read(std::auto_ptr<Glib::Error>& error) +#endif //GLIBMM_EXCEPTIONS_ENABLED +{ + GError* gerror = 0; + Glib::RefPtr<FileInputStream> retvalue = Glib::wrap(g_file_read(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 + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + } // namespace Gio |