diff options
author | Murray Cumming <murrayc@murrayc.com> | 2010-05-31 13:16:28 +0200 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2010-05-31 13:16:28 +0200 |
commit | de7e9208edb460830accf5835afcbbf9ac4d212b (patch) | |
tree | d74cd224716e60e11723a3ba2777f1a757c218fe | |
parent | f510673363137d691f5063bc68d9fa7bb3ef9709 (diff) | |
download | glibmm-de7e9208edb460830accf5835afcbbf9ac4d212b.tar.gz |
Remove the reduced API options and code, as discussed on mailing list.
* configure.ac: Removed the --enable-api-exceptions, --enable-api-properties,
--enable-api-vfuncs and --enable-api-default-signal-handlers options.
* build/reduced.m4: Removed.
* tools/m4/*.m4:
* tools/pm/Output.pm: Remove any use of ifdefs and auto_ptr for reduced API.
* *.[hg|ccg|h|cc]: Remove the idefed code.
95 files changed, 29 insertions, 3457 deletions
@@ -1,3 +1,14 @@ +2010-05-31 Murray Cumming <murrayc@murrayc.com> + + Remove the reduced API options and code, as discussed on mailing list. + + * configure.ac: Removed the --enable-api-exceptions, --enable-api-properties, + --enable-api-vfuncs and --enable-api-default-signal-handlers options. + * build/reduced.m4: Removed. + * tools/m4/*.m4: + * tools/pm/Output.pm: Remove any use of ifdefs and auto_ptr for reduced API. + * *.[hg|ccg|h|cc]: Remove the idefed code. + 2010-05-30 Daniel Elstner <danielk@openismus.com> Avoid compiler warning in TimeVal::as_double() diff --git a/build/reduced.m4 b/build/reduced.m4 deleted file mode 100644 index fb78a17d..00000000 --- a/build/reduced.m4 +++ /dev/null @@ -1,79 +0,0 @@ -## GLIBMM_ARG_ENABLE_API_PROPERTIES() -## -## Provide the --enable-api-properties configure argument, enabled -## by default. -## -AC_DEFUN([GLIBMM_ARG_ENABLE_API_PROPERTIES], -[ - AC_ARG_ENABLE([api-properties], - [ --enable-api-properties Build properties API. - [[default=yes]]], - [glibmm_enable_api_properties="$enableval"], - [glibmm_enable_api_properties='yes']) - - if test "x$glibmm_enable_api_properties" = "xyes"; then - { - AC_DEFINE([GLIBMM_PROPERTIES_ENABLED],[1], [Defined when the --enable-api-properties configure argument was given]) - } - fi -]) - -## GLIBMM_ARG_ENABLE_API_VFUNCS() -## -## Provide the --enable-api-vfuncs configure argument, enabled -## by default. -## -AC_DEFUN([GLIBMM_ARG_ENABLE_API_VFUNCS], -[ - AC_ARG_ENABLE([api-vfuncs], - [ --enable-api-vfuncs Build vfuncs API. - [[default=yes]]], - [glibmm_enable_api_vfuncs="$enableval"], - [glibmm_enable_api_vfuncs='yes']) - - if test "x$glibmm_enable_api_vfuncs" = "xyes"; then - { - AC_DEFINE([GLIBMM_VFUNCS_ENABLED],[1], [Defined when the --enable-api-vfuncs configure argument was given]) - } - fi -]) - -## GLIBMM_ARG_ENABLE_API_EXCEPTIONS() -## -## Provide the --enable-api-exceptions configure argument, enabled -## by default. -## -AC_DEFUN([GLIBMM_ARG_ENABLE_API_EXCEPTIONS], -[ - AC_ARG_ENABLE([api-exceptions], - [ --enable-api-exceptions Build exceptions API. - [[default=yes]]], - [glibmm_enable_api_exceptions="$enableval"], - [glibmm_enable_api_exceptions='yes']) - - if test "x$glibmm_enable_api_exceptions" = "xyes"; then - { - AC_DEFINE([GLIBMM_EXCEPTIONS_ENABLED],[1], [Defined when the --enable-api-exceptions configure argument was given]) - } - fi -]) - -## GLIBMM_ARG_ENABLE_API_DEFAULT_SIGNAL_HANDLERS() -## -## Provide the --enable-api-default-signal-handlers configure argument, enabled -## by default. -## -AC_DEFUN([GLIBMM_ARG_ENABLE_API_DEFAULT_SIGNAL_HANDLERS], -[ - AC_ARG_ENABLE([api-default-signal-handlers], - [ --enable-api-default-signal-handlers Build default signal handlers API. - [[default=yes]]], - [glibmm_enable_api_default_signal_handlers="$enableval"], - [glibmm_enable_api_default_signal_handlers='yes']) - - if test "x$glibmm_enable_api_default_signal_handlers" = "xyes"; then - { - AC_DEFINE([GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED],[1], [Defined when the --enable-api-default-signal-handlers configure argument was given]) - } - fi -]) diff --git a/configure.ac b/configure.ac index 0638cdc2..1fcf8686 100644 --- a/configure.ac +++ b/configure.ac @@ -118,10 +118,12 @@ MM_ARG_ENABLE_WARNINGS([GLIBMM_WXXFLAGS], # Offer the ability to omit some API from the library, # to reduce the code size: MM_ARG_DISABLE_DEPRECATED_API([GLIBMM GIOMM]) -GLIBMM_ARG_ENABLE_API_EXCEPTIONS -GLIBMM_ARG_ENABLE_API_PROPERTIES -GLIBMM_ARG_ENABLE_API_VFUNCS -GLIBMM_ARG_ENABLE_API_DEFAULT_SIGNAL_HANDLERS + +# These are just defined to avoid breaking old code: +AC_DEFINE([GLIBMM_EXCEPTIONS_ENABLED],[1], [This is always set. This is only for backwards compatibility.]) +AC_DEFINE([GLIBMM_PROPERTIES_ENABLED],[1], [This is always set. This is only for backwards compatibility.]) +AC_DEFINE([GLIBMM_VFUNCS_ENABLED],[1], [This is always set. This is only for backwards compatibility.]) +AC_DEFINE([GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED],[1], [This is always set. This is only for backwards compatibility.]) AC_CONFIG_FILES([Makefile tools/Makefile diff --git a/examples/iochannel_stream/fdstream.cc b/examples/iochannel_stream/fdstream.cc index b1b6a37a..be97676f 100644 --- a/examples/iochannel_stream/fdstream.cc +++ b/examples/iochannel_stream/fdstream.cc @@ -49,12 +49,7 @@ void fdstreambuf::create_iochannel(int fd, bool manage) { iochannel_ = Glib::IOChannel::create_from_fd(fd); - #ifdef GLIBMM_EXCEPTIONS_ENABLED iochannel_->set_encoding(""); - #else - std::auto_ptr<Glib::Error> ex; - iochannel_->set_encoding("", ex); - #endif //GLIBMM_EXCEPTIONS_ENABLED iochannel_->set_buffered(true); iochannel_->set_close_on_unref(manage); @@ -83,7 +78,6 @@ int fdstreambuf::sync() if (!iochannel_) return -1; - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { iochannel_->flush(); @@ -94,16 +88,6 @@ int fdstreambuf::sync() error_condition.code = io_error.code(); return -1; } - #else - std::auto_ptr<Glib::Error> io_error; - iochannel_->flush(io_error); - if(io_error.get()) - { - error_condition.error = true; - error_condition.code = (Glib::IOChannelError::Code)io_error->code(); - return -1; - } - #endif //GLIBMM_EXCEPTIONS_ENABLED return 0; } @@ -113,7 +97,6 @@ void fdstreambuf::close_iochannel() iochannel_->set_close_on_unref(false); reset(); - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { iochannel_->close(true); @@ -123,15 +106,6 @@ void fdstreambuf::close_iochannel() error_condition.error = true; error_condition.code = io_error.code(); } - #else - std::auto_ptr<Glib::Error> io_error; - iochannel_->close(true, io_error); - if(io_error.get()) - { - error_condition.error = true; - error_condition.code = (Glib::IOChannelError::Code)io_error->code(); - } - #endif //GLIBMM_EXCEPTIONS_ENABLED } @@ -141,7 +115,6 @@ fdstreambuf::traits_type::int_type fdstreambuf::overflow(int_type c) { if(!traits_type::eq_int_type(c, traits_type::eof())) { - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { gsize result = 0; @@ -154,18 +127,6 @@ fdstreambuf::traits_type::int_type fdstreambuf::overflow(int_type c) error_condition.code = io_error.code(); return traits_type::eof(); } - #else - std::auto_ptr<Glib::Error> io_error; - gsize result = 0; - char write_char = c; - iochannel_->write(&write_char, 1, result, io_error); - if(io_error.get()) - { - error_condition.error = true; - error_condition.code = (Glib::IOChannelError::Code)io_error->code(); - return traits_type::eof();; - } - #endif //GLIBMM_EXCEPTIONS_ENABLED } return traits_type::not_eof(c); } @@ -180,7 +141,6 @@ std::streamsize fdstreambuf::xsputn(const char* source, std::streamsize num) // will only do a short write in the event of stream failure, so there is no // need to check result and have a second bite (byte) at it as would be // necessary with Unix write() - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { iochannel_->write(source, num, result); @@ -191,16 +151,6 @@ std::streamsize fdstreambuf::xsputn(const char* source, std::streamsize num) error_condition.code = io_error.code(); result = 0; } - #else - std::auto_ptr<Glib::Error> io_error; - iochannel_->write(source, num, result, io_error); - if(io_error.get()) - { - error_condition.error = true; - error_condition.code = (Glib::IOChannelError::Code)io_error->code(); - result = 0; - } - #endif //GLIBMM_EXCEPTIONS_ENABLED return result; } @@ -218,7 +168,6 @@ fdstreambuf::traits_type::int_type fdstreambuf::underflow() // now insert a character into the bump position gsize result = 0; - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { iochannel_->read(putback_buffer + 1, 1, result); @@ -229,16 +178,6 @@ fdstreambuf::traits_type::int_type fdstreambuf::underflow() error_condition.code = io_error.code(); return traits_type::eof(); } - #else - std::auto_ptr<Glib::Error> io_error; - iochannel_->read(putback_buffer + 1, 1, result, io_error); - if(io_error.get()) - { - error_condition.error = true; - error_condition.code = (Glib::IOChannelError::Code)io_error->code(); - return traits_type::eof(); - } - #endif //GLIBMM_EXCEPTIONS_ENABLED // some other error - is this possible? In case it is, cater for it if (result == 0) @@ -282,42 +221,24 @@ std::streamsize fdstreambuf::xsgetn(char* dest, std::streamsize num) // read up to everything else we need with Glib::IOChannel::read() gsize result = 0; - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #else - std::auto_ptr<Glib::Error> io_error; - #endif //GLIBMM_EXCEPTIONS_ENABLED do { - #ifdef GLIBMM_EXCEPTIONS_ENABLED iochannel_->read(dest + chars_read, num - chars_read, result); - #else - iochannel_->read(dest + chars_read, - num - chars_read, - result, io_error); - #endif //GLIBMM_EXCEPTIONS_ENABLED if (result > 0) chars_read += result; } while (result > 0 && result < static_cast<gsize>(num - chars_read)); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(Glib::IOChannelError& io_error) - #else - if(io_error.get()) - #endif //GLIBMM_EXCEPTIONS_ENABLED { error_condition.error = true; - #ifdef GLIBMM_EXCEPTIONS_ENABLED error_condition.code = io_error.code(); - #else - error_condition.code = (Glib::IOChannelError::Code)io_error->code(); - #endif //GLIBMM_EXCEPTIONS_ENABLED return chars_read; } diff --git a/examples/keyfile/main.cc b/examples/keyfile/main.cc index 03915eb0..533bc532 100644 --- a/examples/keyfile/main.cc +++ b/examples/keyfile/main.cc @@ -27,7 +27,6 @@ int main(int, char**) Glib::KeyFile keyfile; -#ifdef GLIBMM_EXCEPTIONS_ENABLED // An exception will be thrown if the file is not there, or if the file is incorrectly formatted: try { @@ -76,45 +75,6 @@ int main(int, char**) { std::cerr << "Exception while getting list value: " << ex.what() << std::endl; } -#else /* !GLIBMM_EXCEPTIONS_ENABLED */ - std::auto_ptr<Glib::Error> ex; - - if(!keyfile.load_from_file(filepath, Glib::KeyFileFlags(), ex)) - { - std::cerr << "Exception while loading key file: " << ex->what() << std::endl; - return 1; - } - - // Try to get a value that is not in the file: - { - const Glib::ustring value = keyfile.get_value("somegroup", "somekey", ex); - if (!ex.get()) - std::cout << "somekey value=" << value << std::endl; - else - std::cerr << "Exception while getting value: " << ex->what() << std::endl; - } - - // Try to get a value that is in the file: - { - const Glib::ustring value = keyfile.get_value("First Group", "Welcome", ex); - if (!ex.get()) - std::cout << "Welcome value=" << value << std::endl; - else - std::cerr << "Exception while getting value: " << ex->what() << std::endl; - } - - // Try to get a list of integers that is in the file: - { - const std::vector<int> values = keyfile.get_integer_list("Another Group", "Numbers", ex); - if (!ex.get()) - { - for(std::vector<int>::const_iterator p = values.begin(); p != values.end(); ++p) - std::cout << "Number list value: item=" << *p << std::endl; - } - else - std::cerr << "Exception while getting list value: " << ex->what() << std::endl; - } -#endif /* !GLIBMM_EXCEPTIONS_ENABLED */ return 0; } diff --git a/examples/markup/parser.cc b/examples/markup/parser.cc index 84d6cbc1..30423a66 100644 --- a/examples/markup/parser.cc +++ b/examples/markup/parser.cc @@ -23,20 +23,11 @@ namespace { -#ifndef GLIBMM_EXCEPTIONS_ENABLED -//This is an alternative, to use when we have disabled exceptions: -std::auto_ptr<Glib::Error> processing_error; -#endif //GLIBMM_EXCEPTIONS_ENABLED void file_get_contents(const std::string& filename, Glib::ustring& contents) { - #ifdef GLIBMM_EXCEPTIONS_ENABLED const Glib::RefPtr<Glib::IOChannel> channel = Glib::IOChannel::create_from_file(filename, "r"); channel->read_to_end(contents); - #else - const Glib::RefPtr<Glib::IOChannel> channel = Glib::IOChannel::create_from_file(filename, "r", processing_error); - channel->read_to_end(contents, processing_error); - #endif //GLIBMM_EXCEPTIONS_ENABLED } Glib::ustring trim_whitespace(const Glib::ustring& text) @@ -146,29 +137,19 @@ int main(int argc, char** argv) DumpParser parser; Glib::Markup::ParseContext context (parser); - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED Glib::ustring contents; file_get_contents(argv[1], contents); context.parse(contents); context.end_parse(); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(const Glib::Error& error) { std::cerr << argv[1] << ": " << error.what() << std::endl; return 1; } - #else - if(processing_error.get()) - { - std::cerr << argv[1] << ": " << processing_error->what() << std::endl; - return 1; - } - #endif //GLIBMM_EXCEPTIONS_ENABLED return 0; diff --git a/examples/options/main.cc b/examples/options/main.cc index 9f1f5699..4e9a6ac4 100644 --- a/examples/options/main.cc +++ b/examples/options/main.cc @@ -116,7 +116,6 @@ int main(int argc, char** argv) ExampleOptionGroup group; context.set_main_group(group); - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { context.parse(argc, argv); @@ -125,14 +124,6 @@ int main(int argc, char** argv) { std::cout << "Exception: " << ex.what() << std::endl; } - #else - std::auto_ptr<Glib::Error> ex; - context.parse(argc, argv, ex); - if(ex.get()) - { - std::cout << "Exception: " << ex->what() << std::endl; - } - #endif //GLIBMM_EXCEPTIONS_ENABLED std::cout << "parsed values: " << std::endl << " foo = " << group.m_arg_foo << std::endl << diff --git a/examples/properties/properties_example.cc b/examples/properties/properties_example.cc index 0f7578b8..90111408 100644 --- a/examples/properties/properties_example.cc +++ b/examples/properties/properties_example.cc @@ -19,7 +19,6 @@ #include <iostream> // This example will not work without properties support -#ifdef GLIBMM_PROPERTIES_ENABLED // A class that contains properties must inherit from Glib::Object (or a class // that inherits from Glib::Object) class Person : public Glib::Object @@ -58,11 +57,9 @@ void on_lastname_changed () { std::cout << "- lastname changed!" << std::endl; } void on_age_changed () { std::cout << "- age changed!" << std::endl; } -#endif // GLIBMM_PROPERTIES_ENABLED int main(int, char**) { -#ifdef GLIBMM_PROPERTIES_ENABLED Glib::init (); Person p; // Register some handlers that will be called when the values of the @@ -82,5 +79,4 @@ int main(int, char**) std::cout << "Done changing the properties of 'p'" << std::endl; return 0; -#endif // GLIBMM_PROPERTIES_ENABLED } diff --git a/examples/regex/main.cc b/examples/regex/main.cc index 6873f81d..cc128ab2 100644 --- a/examples/regex/main.cc +++ b/examples/regex/main.cc @@ -24,15 +24,7 @@ int main(int, char**) Glib::init(); /* Reusing one regex pattern: */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<Glib::Regex> regex = Glib::Regex::create("(a)?(b)"); -#else - std::auto_ptr<Glib::Error> error; - Glib::RefPtr<Glib::Regex> regex = Glib::Regex::create("(a)?(b)", - Glib::RegexCompileFlags(), - Glib::RegexMatchFlags(), - error); -#endif std::cout << "Pattern=" << regex->get_pattern() << ", with string=abcd, result=" << std::boolalpha << regex->match("abcd") diff --git a/examples/thread/dispatcher.cc b/examples/thread/dispatcher.cc index dafd16a3..d5d7d8b0 100644 --- a/examples/thread/dispatcher.cc +++ b/examples/thread/dispatcher.cc @@ -151,9 +151,7 @@ Application::Application() // Note that unless you're targetting an embedded platform, you can assume // exceptions to be enabled. The #ifdef is only here to make the example // compile in either case; you may ignore it otherwise. -#ifdef GLIBMM_EXCEPTIONS_ENABLED try -#endif { for (std::vector<ThreadProgress*>::size_type i = 0; i < progress_threads_.size(); ++i) { @@ -164,7 +162,6 @@ Application::Application() sigc::bind<1>(sigc::mem_fun(*this, &Application::on_progress_finished), progress)); } } -#ifdef GLIBMM_EXCEPTIONS_ENABLED catch (...) { // In your own code, you should preferably use a smart pointer @@ -173,7 +170,6 @@ Application::Application() DeletePtr<ThreadProgress*>()); throw; } -#endif } Application::~Application() diff --git a/gio/giomm/slot_async.cc b/gio/giomm/slot_async.cc index 9edf2d2b..e51601fd 100644 --- a/gio/giomm/slot_async.cc +++ b/gio/giomm/slot_async.cc @@ -27,19 +27,15 @@ SignalProxy_async_callback(GObject*, GAsyncResult* res, void* data) { Gio::SlotAsyncReady* the_slot = static_cast<Gio::SlotAsyncReady*>(data); - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<Gio::AsyncResult> result = Glib::wrap(res, true /* take copy */); (*the_slot)(result); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED delete the_slot; } diff --git a/gio/src/appinfo.ccg b/gio/src/appinfo.ccg index c3cd4be0..e5146da0 100644 --- a/gio/src/appinfo.ccg +++ b/gio/src/appinfo.ccg @@ -23,18 +23,10 @@ namespace Gio { -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<AppInfo> AppInfo::create_from_commandline(const std::string& commandline, const std::string& application_name, AppInfoCreateFlags flags) -#else -Glib::RefPtr<AppInfo> -AppInfo::create_from_commandline(const std::string& commandline, - const std::string& application_name, - AppInfoCreateFlags flags, - std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GAppInfo* capp_info = 0; GError* gerror = 0; @@ -45,31 +37,18 @@ AppInfo::create_from_commandline(const std::string& commandline, &gerror); if (gerror) -#ifdef GLIBMM_EXCEPTIONS_ENABLED ::Glib::Error::throw_exception(gerror); -#else - error = ::Glib::Error::throw_exception(gerror); -#endif //GLIBMM_EXCEPTIONS_ENABLED return Glib::wrap(capp_info); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool AppInfo::launch_default_for_uri(const std::string& uri) -#else -bool AppInfo::launch_default_for_uri(const std::string& uri, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; const bool retvalue = g_app_info_launch_default_for_uri(uri.c_str(), 0, &(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; } diff --git a/gio/src/appinfo.hg b/gio/src/appinfo.hg index 03f91d20..9ec30337 100644 --- a/gio/src/appinfo.hg +++ b/gio/src/appinfo.hg @@ -17,9 +17,7 @@ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED #include <exception> -#endif #include <string> @@ -80,16 +78,9 @@ class AppInfo : public Glib::Interface _CLASS_INTERFACE(AppInfo, GAppInfo, G_APP_INFO, GAppInfoIface) public: -#ifdef GLIBMM_EXCEPTIONS_ENABLED static Glib::RefPtr<AppInfo> create_from_commandline(const std::string& commandline, const std::string& application_name, AppInfoCreateFlags flags); -#else - static Glib::RefPtr<AppInfo> create_from_commandline(const std::string& commandline, - const std::string& application_name, - AppInfoCreateFlags flags, - std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED //_IGNORE(g_app_info_dup) _IGNORE(g_app_info_equal) @@ -144,11 +135,7 @@ public: _WRAP_METHOD(static void reset_type_associations(const std::string& content_type), g_app_info_reset_type_associations) _WRAP_METHOD(static bool launch_default_for_uri(const std::string& uri, const Glib::RefPtr<AppLaunchContext>& context), g_app_info_launch_default_for_uri, errthrow) // same as above but without optional AppLaunchContext -#ifdef GLIBMM_EXCEPTIONS_ENABLED static bool launch_default_for_uri(const std::string& uri); -#else - static bool launch_default_for_uri(const std::string& uri, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED protected: //_WRAP_VFUNC(Glib::RefPtr<AppInfo> dup(), "dup") diff --git a/gio/src/bufferedinputstream.ccg b/gio/src/bufferedinputstream.ccg index 2e573a97..cba9383c 100644 --- a/gio/src/bufferedinputstream.ccg +++ b/gio/src/bufferedinputstream.ccg @@ -27,21 +27,12 @@ Glib::RefPtr<BufferedInputStream> BufferedInputStream::create_sized(const Glib:: return Glib::RefPtr<Gio::BufferedInputStream>(new BufferedInputStream(base_stream, size)); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED gssize BufferedInputStream::fill(gssize count) -#else -gssize BufferedInputStream::fill(gssize count, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; const gssize retvalue = g_buffered_input_stream_fill(const_cast<GBufferedInputStream*>(gobj()), count, 0, &(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; } @@ -81,21 +72,12 @@ void BufferedInputStream::fill_async(const SlotAsyncReady& slot, slot_copy); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED int BufferedInputStream::read_byte() -#else -int BufferedInputStream::read_byte(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; const int retvalue = g_buffered_input_stream_read_byte(gobj(), 0, &(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; diff --git a/gio/src/bufferedinputstream.hg b/gio/src/bufferedinputstream.hg index b7ae1c91..85c86a7f 100644 --- a/gio/src/bufferedinputstream.hg +++ b/gio/src/bufferedinputstream.hg @@ -61,11 +61,7 @@ public: /** non-cancellable version of fill() */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED gssize fill(gssize count); -#else - gssize fill(gssize count, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_buffered_input_stream_fill_async) @@ -101,11 +97,7 @@ public: /** Non-cancellable version of read_byte(). */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED int read_byte(); -#else - int read_byte(std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_PROPERTY("buffer-size", guint) diff --git a/gio/src/datainputstream.ccg b/gio/src/datainputstream.ccg index 97479781..fb46f326 100644 --- a/gio/src/datainputstream.ccg +++ b/gio/src/datainputstream.ccg @@ -23,157 +23,85 @@ namespace Gio { -#ifdef GLIBMM_EXCEPTIONS_ENABLED guchar DataInputStream::read_byte() -#else -guchar DataInputStream::read_byte(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; const guchar retvalue = g_data_input_stream_read_byte(gobj(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED gint16 DataInputStream::read_int16() -#else -gint16 DataInputStream::read_int16(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; const gint16 retvalue = g_data_input_stream_read_int16(gobj(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED guint16 DataInputStream::read_uint16() -#else -guint16 DataInputStream::read_uint16(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; const guint16 retvalue = g_data_input_stream_read_uint16(gobj(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED gint32 DataInputStream::read_int32() -#else -gint32 DataInputStream::read_int32(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; const gint32 retvalue = g_data_input_stream_read_int32(gobj(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED guint32 DataInputStream::read_uint32() -#else -guint32 DataInputStream::read_uint32(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; const guint32 retvalue = g_data_input_stream_read_uint32(gobj(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED gint64 DataInputStream::read_int64() -#else -gint64 DataInputStream::read_int64(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; const gint64 retvalue = g_data_input_stream_read_int64(gobj(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED guint64 DataInputStream::read_uint64() -#else -guint64 DataInputStream::read_uint64(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; const guint64 retvalue = g_data_input_stream_read_uint64(gobj(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool DataInputStream::read_line(std::string& line, const Glib::RefPtr<Cancellable>& cancellable) -#else -bool DataInputStream::read_line(std::string& line, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; char* c_line = g_data_input_stream_read_line(gobj(), 0, // pass NULL since we can easily determine the length from the returned std::string 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 (c_line) { line = c_line; g_free (c_line); @@ -183,24 +111,15 @@ bool DataInputStream::read_line(std::string& line, const Glib::RefPtr<Cancellabl return false; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool DataInputStream::read_line(std::string& line) -#else -bool DataInputStream::read_line(std::string& line, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; char* c_line = g_data_input_stream_read_line(gobj(), 0, // pass NULL since we can easily determine the length from the returned std::string 0, &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 (c_line) { line = c_line; g_free(c_line); @@ -224,22 +143,13 @@ void DataInputStream::read_line_async(const SlotAsyncReady& slot, const Glib::Re slot_copy); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool DataInputStream::read_line_finish(const Glib::RefPtr<AsyncResult>& result, std::string& data) -#else -bool DataInputStream::read_line_finish(const Glib::RefPtr<AsyncResult>& result, std::string& data, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gsize size = 0; gchar* buffer = g_data_input_stream_read_line_finish(gobj(), Glib::unwrap(result), &size, &(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 bool retval = false; if(buffer && size) @@ -252,11 +162,7 @@ bool DataInputStream::read_line_finish(const Glib::RefPtr<AsyncResult>& result, return retval; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool DataInputStream::read_until(std::string& data, const std::string& stop_chars, const Glib::RefPtr<Cancellable>& cancellable) -#else -bool DataInputStream::read_until(std::string& data, const std::string& stop_chars, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; char* c_str = g_data_input_stream_read_until(gobj(), @@ -264,13 +170,8 @@ bool DataInputStream::read_until(std::string& data, const std::string& stop_char 0, // pass NULL since we can easily determine the length from the returned std::string 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 (c_str) { data = c_str; g_free (c_str); @@ -282,11 +183,7 @@ bool DataInputStream::read_until(std::string& data, const std::string& stop_char /** non-cancellable version of read_until() */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool DataInputStream::read_until(std::string& data, const std::string& stop_chars) -#else -bool DataInputStream::read_until(std::string& data, const std::string& stop_chars, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; char* c_str = g_data_input_stream_read_until(gobj(), @@ -294,13 +191,8 @@ bool DataInputStream::read_until(std::string& data, const std::string& stop_char 0, // pass NULL since we can easily determine the length from the returned std::string 0, &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 (c_str) { data = c_str; g_free (c_str); @@ -324,22 +216,13 @@ void DataInputStream::read_until_async(const std::string& stop_chars, const Slot slot_copy); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool DataInputStream::read_until_finish(const Glib::RefPtr<AsyncResult>& result, std::string& data) -#else -bool DataInputStream::read_until_finish(const Glib::RefPtr<AsyncResult>& result, std::string& data, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gsize size = 0; gchar* buffer = g_data_input_stream_read_until_finish(gobj(), Glib::unwrap(result), &size, &(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 bool retval = false; if(buffer && size) diff --git a/gio/src/datainputstream.hg b/gio/src/datainputstream.hg index c3e2ea64..21e5c471 100644 --- a/gio/src/datainputstream.hg +++ b/gio/src/datainputstream.hg @@ -54,70 +54,42 @@ public: /** non-cancellable version of read_byte() */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED guchar read_byte(); -#else - guchar read_byte(std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(gint16 read_int16(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_int16, errthrow) /** non-cancellable version of read_int16() */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED gint16 read_int16(); -#else - gint16 read_int16(std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(guint16 read_uint16(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_uint16, errthrow) //TODO: Real documentation: /** non-cancellable version of read_uint16() */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED guint16 read_uint16(); -#else - guint16 read_uint16(std::auto_ptr<Glib::Error>& error); -#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 gint32 read_int32(); -#else - gint32 read_int32(std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(guint32 read_uint32(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_uint32, errthrow) /** non-cancellable version of read_uint32() */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED guint32 read_uint32(); -#else - guint32 read_uint32(std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(gint64 read_int64(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_int64, errthrow) /** non-cancellable version of read_int64() */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED gint64 read_int64(); -#else - gint64 read_int64(std::auto_ptr<Glib::Error>& error); -#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 guint64 read_uint64(); -#else - guint64 read_uint64(std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED //Note that we return a bool because we can't use std::string to distinguish between an empty string and a NULL. @@ -132,11 +104,7 @@ public: * @param cancellable A cancellable object. * @result true if the read succeeded without error. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool read_line(std::string& line, const Glib::RefPtr<Cancellable>& cancellable); -#else - bool read_line(std::string& line, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_data_input_stream_read_line) /** A non-cancellable version of read_line(). @@ -144,11 +112,7 @@ public: * @param data A string to fill with the read data (without the newlines). * @result true if the read succeeded without error. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool read_line(std::string& line); -#else - bool read_line(std::string& line, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** The asynchronous version of read_until(). It is * an error to have two outstanding calls to this function. @@ -167,11 +131,7 @@ public: * @param data A string to fill with the read data. * @result true if the read succeeded without error. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED bool read_line_finish(const Glib::RefPtr<AsyncResult>& result, std::string& data); - #else - bool read_line_finish(const Glib::RefPtr<AsyncResult>& result, std::string& data, std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_data_input_stream_read_line_finish) /** Reads a string from the data input stream, up to the first @@ -182,11 +142,7 @@ public: * @param cancellable A cancellable object. * @result true if the read succeeded without error. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool read_until(std::string& data, const std::string& stop_chars, const Glib::RefPtr<Cancellable>& cancellable); -#else - bool read_until(std::string& data, const std::string& stop_chars, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_data_input_stream_read_until) /** A non-cancellable version of read_until(). @@ -194,11 +150,7 @@ public: * @param data A string to fill with the read data. * @result true if the read succeeded without error. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool read_until(std::string& data, const std::string& stop_chars); -#else - bool read_until(std::string& data, const std::string& stop_chars, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** The asynchronous version of read_until(). It is * an error to have two outstanding calls to this function. @@ -218,11 +170,7 @@ public: * @param data A string to fill with the read data. * @result true if the read succeeded without error. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED bool read_until_finish(const Glib::RefPtr<AsyncResult>& result, std::string& data); - #else - bool read_until_finish(const Glib::RefPtr<AsyncResult>& result, std::string& data, std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_data_input_stream_read_until_finish) _WRAP_PROPERTY("byte-order", DataStreamByteOrder) diff --git a/gio/src/dataoutputstream.ccg b/gio/src/dataoutputstream.ccg index 10629a09..0dfae52c 100644 --- a/gio/src/dataoutputstream.ccg +++ b/gio/src/dataoutputstream.ccg @@ -22,157 +22,85 @@ namespace Gio { -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool DataOutputStream::put_byte(guchar data) -#else -bool DataOutputStream::put_byte(guchar data, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; const guchar retvalue = g_data_output_stream_put_byte(gobj(), data, 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool DataOutputStream::put_int16(gint16 data) -#else -bool DataOutputStream::put_int16(gint16 data, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; const gint16 retvalue = g_data_output_stream_put_int16(gobj(), data, 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool DataOutputStream::put_uint16(guint16 data) -#else -bool DataOutputStream::put_uint16(guint16 data, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; const guint16 retvalue = g_data_output_stream_put_uint16(gobj(), data, 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool DataOutputStream::put_int32(gint32 data) -#else -bool DataOutputStream::put_int32(gint32 data, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; const gint32 retvalue = g_data_output_stream_put_int32(gobj(), data, 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool DataOutputStream::put_uint32(guint32 data) -#else -bool DataOutputStream::put_uint32(guint32 data, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; const guint32 retvalue = g_data_output_stream_put_uint32(gobj(), data, 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool DataOutputStream::put_int64(gint64 data) -#else -bool DataOutputStream::put_int64(gint64 data, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; const gint64 retvalue = g_data_output_stream_put_int64(gobj(), data, 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool DataOutputStream::put_uint64(guint64 data) -#else -bool DataOutputStream::put_uint64(guint64 data, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; guint64 retvalue = g_data_output_stream_put_uint64(gobj(), data, 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool DataOutputStream::put_string(std::string str) -#else -bool DataOutputStream::put_string(std::string str, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; const bool retval = g_data_output_stream_put_string(gobj(), str.c_str (), 0, &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 retval; } diff --git a/gio/src/dataoutputstream.hg b/gio/src/dataoutputstream.hg index 5b7660f9..1bf382d6 100644 --- a/gio/src/dataoutputstream.hg +++ b/gio/src/dataoutputstream.hg @@ -52,77 +52,45 @@ public: /** non-cancellable version of put_byte() */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool put_byte(guchar data); -#else - bool put_byte(guchar data, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool put_int16(gint16 data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_int16, errthrow) /** non-cancellable version of put_int16() */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool put_int16(gint16 data); -#else - bool put_int16(gint16 data, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool put_uint16(guint16 data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_uint16, errthrow) /** non-cancellable version of put_uint16() */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool put_uint16(guint16 data); -#else - bool put_uint16(guint16 data, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool put_int32(gint32 data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_int32, errthrow) /** non-cancellable version of put_int32() */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool put_int32(gint32 data); -#else - bool put_int32(gint32 data, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool put_uint32(guint32 data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_uint32, errthrow) /** non-cancellable version of put_uint32() */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool put_uint32(guint32 data); -#else - bool put_uint32(guint32 data, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool put_int64(gint64 data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_int64, errthrow) /** non-cancellable version of put_int64() */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool put_int64(gint64 data); -#else - bool put_int64(gint64 data, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool put_uint64(guint64 data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_uint64, errthrow) /** non-cancellable version of put_uint64() */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool put_uint64(guint64 data); -#else - bool put_uint64(guint64 data, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool put_string(std::string str, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_string, errthrow) /** non-cancellable version of put_string() */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool put_string(std::string str); -#else - bool put_string(std::string str, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_PROPERTY("byte-order", DataStreamByteOrder) }; diff --git a/gio/src/file.ccg b/gio/src/file.ccg index c539d03d..c5ade793 100644 --- a/gio/src/file.ccg +++ b/gio/src/file.ccg @@ -37,20 +37,16 @@ SignalProxy_file_progress_callback(goffset current_num_bytes, { Gio::File::SlotFileProgress* the_slot = static_cast<Gio::File::SlotFileProgress*>(data); - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED (*the_slot)(current_num_bytes, total_num_bytes); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED } // Same as SignalProxy_async_callback, except that this one knows that @@ -62,22 +58,18 @@ SignalProxy_file_ready_callback(GObject*, GAsyncResult* res, void* data) CopySlots* slot_pair = static_cast<CopySlots*>(data); Gio::SlotAsyncReady* the_slot = slot_pair->second; - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED if(*the_slot) { Glib::RefPtr<Gio::AsyncResult> result = Glib::wrap(res, true /* take copy */); (*the_slot)(result); } - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED delete the_slot; delete slot_pair->first; // progress slot @@ -92,20 +84,16 @@ SignalProxy_load_partial_contents_read_more_callback(const char* file_contents, bool result = false; - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED result = (*the_slot)(file_contents, file_size); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED return result; } @@ -119,19 +107,15 @@ SignalProxy_load_partial_contents_ready_callback(GObject*, GAsyncResult* res, vo LoadPartialSlots* slot_pair = static_cast<LoadPartialSlots*>(data); Gio::SlotAsyncReady* the_slot = slot_pair->second; - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<Gio::AsyncResult> result = Glib::wrap(res, true /* take copy */); (*the_slot)(result); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED delete the_slot; delete slot_pair->first; // read_more slot @@ -399,40 +383,22 @@ File::replace_readwrite_async(const SlotAsyncReady& slot, const std::string& eta slot_copy); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> File::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags) const -#else -Glib::RefPtr<FileInfo> File::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error) const -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_query_info(const_cast<GFile*>(gobj()), attributes.c_str(), ((GFileQueryInfoFlags)(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 return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> File::query_info(const std::string& attributes, FileQueryInfoFlags flags) const -#else -Glib::RefPtr<FileInfo> File::query_info(const std::string& attributes, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error) const -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_query_info(const_cast<GFile*>(gobj()), attributes.c_str(), ((GFileQueryInfoFlags)(flags)), 0, &(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; } @@ -482,40 +448,22 @@ File::query_info_async(const SlotAsyncReady& slot, const std::string& attributes } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> File::query_filesystem_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes) -#else -Glib::RefPtr<FileInfo> File::query_filesystem_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_query_filesystem_info(gobj(), attributes.c_str(), 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 return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> File::query_filesystem_info(const std::string& attributes) -#else -Glib::RefPtr<FileInfo> File::query_filesystem_info(const std::string& attributes, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_query_filesystem_info(gobj(), attributes.c_str(), 0, &(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; } @@ -552,40 +500,22 @@ File::query_filesystem_info_async(const SlotAsyncReady& slot, const std::string& slot_copy); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileEnumerator> File::enumerate_children(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags) -#else -Glib::RefPtr<FileEnumerator> File::enumerate_children(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileEnumerator> retvalue = Glib::wrap(g_file_enumerate_children(gobj(), attributes.c_str(), ((GFileQueryInfoFlags)(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 return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileEnumerator> File::enumerate_children(const std::string& attributes, FileQueryInfoFlags flags) -#else -Glib::RefPtr<FileEnumerator> File::enumerate_children(const std::string& attributes, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileEnumerator> retvalue = Glib::wrap(g_file_enumerate_children(gobj(), attributes.c_str(), ((GFileQueryInfoFlags)(flags)), 0, &(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; } @@ -624,21 +554,12 @@ File::enumerate_children_async(const SlotAsyncReady& slot, const std::string& at slot_copy); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<File> File::set_display_name(const Glib::ustring& display_name) -#else -Glib::RefPtr<File> File::set_display_name(const Glib::ustring& display_name, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<File> retvalue = Glib::wrap(g_file_set_display_name(gobj(), display_name.c_str(), 0, &(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; @@ -676,13 +597,8 @@ File::set_display_name_async(const Glib::ustring& display_name, const SlotAsyncR slot_copy); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::copy(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags) -#else -bool -File::copy(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool res; @@ -702,24 +618,14 @@ File::copy(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, delete slot_copy; -#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 res; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::copy(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, FileCopyFlags flags) -#else -bool -File::copy(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool res; @@ -739,24 +645,14 @@ File::copy(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, delete slot_copy; -#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 res; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::copy(const Glib::RefPtr<File>& destination, FileCopyFlags flags) -#else -bool -File::copy(const Glib::RefPtr<File>& destination, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool res = g_file_copy(gobj(), @@ -767,13 +663,8 @@ File::copy(const Glib::RefPtr<File>& destination, FileCopyFlags flags, std::auto 0, &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 res; } @@ -878,13 +769,8 @@ File::copy_async(const Glib::RefPtr<File>& destination, slot_ready_copy); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::move(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags) -#else -bool -File::move(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool res; @@ -904,24 +790,14 @@ File::move(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, delete slot_copy; -#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 res; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::move(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, FileCopyFlags flags) -#else -bool -File::move(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool res; @@ -941,24 +817,14 @@ File::move(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, delete slot_copy; -#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 res; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::move(const Glib::RefPtr<File>& destination, FileCopyFlags flags) -#else -bool -File::move(const Glib::RefPtr<File>& destination, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool res; @@ -971,13 +837,8 @@ File::move(const Glib::RefPtr<File>& destination, FileCopyFlags flags, std::auto 0, &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 res; } @@ -1016,16 +877,9 @@ File::set_attributes_async(const Glib::RefPtr<FileInfo>& info, const SlotAsyncRe slot_copy); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::set_attributes_finish(const Glib::RefPtr<AsyncResult>& result, const Glib::RefPtr<FileInfo>& info) -#else -bool -File::set_attributes_finish(const Glib::RefPtr<AsyncResult>& result, - const Glib::RefPtr<FileInfo>& info, - std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; GFileInfo* cinfo = Glib::unwrap(info); @@ -1036,132 +890,73 @@ File::set_attributes_finish(const Glib::RefPtr<AsyncResult>& result, &cinfo, &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 res; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::set_attribute_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags) -#else -bool File::set_attribute_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_file_set_attribute_string(gobj(), attribute.c_str(), value.c_str(), ((GFileQueryInfoFlags)(flags)), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::set_attribute_byte_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags) -#else -bool File::set_attribute_byte_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_file_set_attribute_byte_string(gobj(), attribute.c_str(), value.c_str(), ((GFileQueryInfoFlags)(flags)), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::set_attribute_uint32(const std::string& attribute, guint32 value, FileQueryInfoFlags flags) -#else -bool File::set_attribute_uint32(const std::string& attribute, guint32 value, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_file_set_attribute_uint32(gobj(), attribute.c_str(), value, ((GFileQueryInfoFlags)(flags)), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::set_attribute_int32(const std::string& attribute, gint32 value, FileQueryInfoFlags flags) -#else -bool File::set_attribute_int32(const std::string& attribute, gint32 value, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_file_set_attribute_int32(gobj(), attribute.c_str(), value, ((GFileQueryInfoFlags)(flags)), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::set_attribute_uint64(const std::string& attribute, guint64 value, FileQueryInfoFlags flags) -#else -bool File::set_attribute_uint64(const std::string& attribute, guint64 value, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_file_set_attribute_uint64(gobj(), attribute.c_str(), value, ((GFileQueryInfoFlags)(flags)), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::set_attribute_int64(const std::string& attribute, gint64 value, FileQueryInfoFlags flags) -#else -bool File::set_attribute_int64(const std::string& attribute, gint64 value, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_file_set_attribute_int64(gobj(), attribute.c_str(), value, ((GFileQueryInfoFlags)(flags)), 0, &(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; @@ -1516,22 +1311,13 @@ File::load_partial_contents_async(const SlotReadMore& slot_read_more, slots); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED void File::replace_contents(const char* contents, gsize length, const std::string& etag, std::string& new_etag, const Glib::RefPtr<Cancellable>& cancellable, bool make_backup, FileCreateFlags flags) -#else -void File::replace_contents(const char* contents, gsize length, const std::string& etag, std::string& new_etag, const Glib::RefPtr<Cancellable>& cancellable, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gchar* c_etag_new = 0; g_file_replace_contents(gobj(), contents, length, etag.empty() ? 0 : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, 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(c_etag_new) new_etag = c_etag_new; @@ -1539,22 +1325,13 @@ void File::replace_contents(const char* contents, gsize length, const std::strin new_etag = std::string(); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED void File::replace_contents(const char* contents, gsize length, const std::string& etag, std::string& new_etag, bool make_backup, FileCreateFlags flags) -#else -void File::replace_contents(const char* contents, gsize length, const std::string& etag, std::string& new_etag, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gchar* c_etag_new = 0; g_file_replace_contents(gobj(), contents, length, etag.empty() ? 0 : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, 0, &(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(c_etag_new) new_etag = c_etag_new; @@ -1562,22 +1339,13 @@ void File::replace_contents(const char* contents, gsize length, const std::strin new_etag = std::string(); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED void File::replace_contents(const std::string& contents, const std::string& etag, std::string& new_etag, const Glib::RefPtr<Cancellable>& cancellable, bool make_backup, FileCreateFlags flags) -#else -void File::replace_contents(const std::string& contents, const std::string& etag, std::string& new_etag, const Glib::RefPtr<Cancellable>& cancellable, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gchar* c_etag_new = 0; g_file_replace_contents(gobj(), contents.c_str(), contents.size(), etag.empty() ? 0 : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, 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(c_etag_new) new_etag = c_etag_new; @@ -1585,22 +1353,13 @@ void File::replace_contents(const std::string& contents, const std::string& etag new_etag = std::string(); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED void File::replace_contents(const std::string& contents, const std::string& etag, std::string& new_etag, bool make_backup, FileCreateFlags flags) -#else -void File::replace_contents(const std::string& contents, const std::string& etag, std::string& new_etag, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gchar* c_etag_new = 0; g_file_replace_contents(gobj(), contents.c_str(), contents.size(), etag.empty() ? 0 : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, 0, &(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(c_etag_new) new_etag = c_etag_new; @@ -1704,22 +1463,13 @@ File::replace_contents_async(const SlotAsyncReady& slot, slot_copy); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED void File::replace_contents_finish(const Glib::RefPtr<AsyncResult>& result, std::string& new_etag) -#else -void File::replace_contents_finish(const Glib::RefPtr<AsyncResult>& result, std::string& new_etag, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gchar* c_new_etag = 0; g_file_replace_contents_finish(gobj(), Glib::unwrap(result), &c_new_etag, &(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(c_new_etag) new_etag = c_new_etag; @@ -1728,214 +1478,115 @@ void File::replace_contents_finish(const Glib::RefPtr<AsyncResult>& result, std: } -#ifdef GLIBMM_EXCEPTIONS_ENABLED void File::replace_contents_finish(const Glib::RefPtr<AsyncResult>& result) -#else -void File::replace_contents_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; g_file_replace_contents_finish(gobj(), Glib::unwrap(result), 0, &(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 } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileOutputStream> File::replace(const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag, bool make_backup, FileCreateFlags flags) -#else -Glib::RefPtr<FileOutputStream> File::replace(const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileOutputStream> retvalue = Glib::wrap(g_file_replace(gobj(), etag.empty() ? 0 : etag.c_str(), static_cast<int>(make_backup), ((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 return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileOutputStream> File::replace(const std::string& etag, bool make_backup, FileCreateFlags flags) -#else -Glib::RefPtr<FileOutputStream> File::replace(const std::string& etag, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileOutputStream> retvalue = Glib::wrap(g_file_replace(gobj(), etag.empty() ? 0 : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileIOStream> File::replace_readwrite(const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag, bool make_backup, FileCreateFlags flags) -#else -Glib::RefPtr<FileIOStream> File::replace_readwrite(const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileIOStream> retvalue = Glib::wrap(g_file_replace_readwrite(gobj(), etag.empty() ? 0 : etag.c_str(), static_cast<int>(make_backup), ((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 return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileIOStream> File::replace_readwrite(const std::string& etag, bool make_backup, FileCreateFlags flags) -#else -Glib::RefPtr<FileIOStream> File::replace_readwrite(const std::string& etag, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileIOStream> retvalue = Glib::wrap(g_file_replace_readwrite(gobj(), etag.empty() ? 0 : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileMonitor> File::monitor_directory(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags) -#else -Glib::RefPtr<FileMonitor> File::monitor_directory(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileMonitor> retvalue = Glib::wrap(g_file_monitor_directory(gobj(), ((GFileMonitorFlags)(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 return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileMonitor> File::monitor_directory(FileMonitorFlags flags) -#else -Glib::RefPtr<FileMonitor> File::monitor_directory(FileMonitorFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileMonitor> retvalue = Glib::wrap(g_file_monitor_directory(gobj(), ((GFileMonitorFlags)(flags)), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileMonitor> File::monitor_file(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags) -#else -Glib::RefPtr<FileMonitor> File::monitor_file(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileMonitor> retvalue = Glib::wrap(g_file_monitor_file(gobj(), ((GFileMonitorFlags)(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 return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileMonitor> File::monitor_file(FileMonitorFlags flags) -#else -Glib::RefPtr<FileMonitor> File::monitor_file(FileMonitorFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileMonitor> retvalue = Glib::wrap(g_file_monitor_file(gobj(), ((GFileMonitorFlags)(flags)), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileMonitor> File::monitor(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags) -#else -Glib::RefPtr<FileMonitor> File::monitor(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileMonitor> retvalue = Glib::wrap(g_file_monitor(gobj(), ((GFileMonitorFlags)(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 return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileMonitor> File::monitor(FileMonitorFlags flags) -#else -Glib::RefPtr<FileMonitor> File::monitor(FileMonitorFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileMonitor> retvalue = Glib::wrap(g_file_monitor(gobj(), ((GFileMonitorFlags)(flags)), 0, &(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; } @@ -2027,21 +1678,12 @@ void File::poll_mountable(const SlotAsyncReady& slot) slot_copy); } -#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(), 0, &(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; } @@ -2074,51 +1716,28 @@ void File::find_enclosing_mount_async(const SlotAsyncReady& slot, int io_priorit slot_copy); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::set_attributes_from_info(const Glib::RefPtr<FileInfo>& info, const Glib::RefPtr<Cancellable>& cancellable, FileQueryInfoFlags flags) -#else -bool File::set_attributes_from_info(const Glib::RefPtr<FileInfo>& info, const Glib::RefPtr<Cancellable>& cancellable, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_file_set_attributes_from_info(gobj(), Glib::unwrap(info), ((GFileQueryInfoFlags)(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 return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::set_attributes_from_info(const Glib::RefPtr<FileInfo>& info, FileQueryInfoFlags flags) -#else -bool File::set_attributes_from_info(const Glib::RefPtr<FileInfo>& info, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_file_set_attributes_from_info(gobj(), Glib::unwrap(info), ((GFileQueryInfoFlags)(flags)), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::copy_attributes(const Glib::RefPtr<File>& destination, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags) -#else -bool -File::copy_attributes(const Glib::RefPtr<File>& destination, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool res; @@ -2129,24 +1748,14 @@ File::copy_attributes(const Glib::RefPtr<File>& destination, const Glib::RefPtr< 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 return res; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::copy_attributes(const Glib::RefPtr<File>& destination, FileCopyFlags flags) -#else -bool -File::copy_attributes(const Glib::RefPtr<File>& destination, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool res; @@ -2157,463 +1766,251 @@ File::copy_attributes(const Glib::RefPtr<File>& destination, FileCopyFlags flags 0, &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 res; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileOutputStream> File::create_file(const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags) -#else -Glib::RefPtr<FileOutputStream> File::create_file(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_create(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 return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileOutputStream> File::create_file(FileCreateFlags flags) -#else -Glib::RefPtr<FileOutputStream> File::create_file(FileCreateFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileOutputStream> retvalue = Glib::wrap(g_file_create(gobj(), ((GFileCreateFlags)(flags)), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileIOStream> File::create_file_readwrite(const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags) -#else -Glib::RefPtr<FileIOStream> File::create_file_readwrite(const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileIOStream> retvalue = Glib::wrap(g_file_create_readwrite(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 return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileIOStream> File::create_file_readwrite(FileCreateFlags flags) -#else -Glib::RefPtr<FileIOStream> File::create_file_readwrite(FileCreateFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileIOStream> retvalue = Glib::wrap(g_file_create_readwrite(gobj(), ((GFileCreateFlags)(flags)), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::remove() -#else -bool File::remove(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_file_delete(gobj(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::trash() -#else -bool File::trash(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_file_trash(gobj(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::make_directory() -#else -bool File::make_directory(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_file_make_directory(gobj(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::make_directory_with_parents() -#else -bool File::make_directory_with_parents(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; const bool retvalue = g_file_make_directory_with_parents(gobj(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::make_symbolic_link(const std::string& symlink_value) -#else -bool File::make_symbolic_link(const std::string& symlink_value, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_file_make_symbolic_link(gobj(), symlink_value.c_str(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileAttributeInfoList> File::query_settable_attributes() -#else -Glib::RefPtr<FileAttributeInfoList> File::query_settable_attributes(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileAttributeInfoList> retvalue = Glib::wrap(g_file_query_settable_attributes(gobj(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileAttributeInfoList> File::query_writable_namespaces() -#else -Glib::RefPtr<FileAttributeInfoList> File::query_writable_namespaces(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileAttributeInfoList> retvalue = Glib::wrap(g_file_query_writable_namespaces(gobj(), 0, &(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; } -#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 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)), 0, &(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; } -#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(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<AppInfo> File::query_default_handler() -#else -Glib::RefPtr<AppInfo> File::query_default_handler(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<AppInfo> retvalue = Glib::wrap(g_file_query_default_handler(gobj(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::load_contents(const Glib::RefPtr<Cancellable>& cancellable, char*& contents, gsize& length, std::string& etag_out) -#else -bool File::load_contents(const Glib::RefPtr<Cancellable>& cancellable, char*& contents, gsize& length, std::string& etag_out, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gchar* cetag_out = 0; bool retvalue = g_file_load_contents(gobj(), Glib::unwrap(cancellable), &contents, &(length), &cetag_out, &(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 etag_out = Glib::convert_return_gchar_ptr_to_stdstring(cetag_out); return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::load_contents(const Glib::RefPtr<Cancellable>& cancellable, char*& contents, gsize& length) -#else -bool File::load_contents(const Glib::RefPtr<Cancellable>& cancellable, char*& contents, gsize& length, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_file_load_contents(gobj(), Glib::unwrap(cancellable), &contents, &(length), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::load_contents(char*& contents, gsize& length, std::string& etag_out) -#else -bool File::load_contents(char*& contents, gsize& length, std::string& etag_out, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gchar* cetag_out = 0; bool retvalue = g_file_load_contents(gobj(), 0, &contents, &(length), &cetag_out, &(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 etag_out = Glib::convert_return_gchar_ptr_to_stdstring(cetag_out); return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::load_contents(char*& contents, gsize& length) -#else -bool File::load_contents(char*& contents, gsize& length, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_file_load_contents(gobj(), 0, &contents, &(length), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::load_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length, std::string& etag_out) -#else -bool File::load_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length, std::string& etag_out, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gchar* cetag_out = 0; bool retvalue = g_file_load_contents_finish(gobj(), Glib::unwrap(result), &contents, &(length), &cetag_out, &(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 etag_out = Glib::convert_return_gchar_ptr_to_stdstring(cetag_out); return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::load_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length) -#else -bool File::load_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_file_load_contents_finish(gobj(), Glib::unwrap(result), &contents, &(length), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::load_partial_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length, std::string& etag_out) -#else -bool File::load_partial_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length, std::string& etag_out, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gchar* cetag_out = 0; bool retvalue = g_file_load_partial_contents_finish(gobj(), Glib::unwrap(result), &contents, &(length), &cetag_out, &(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 etag_out = Glib::convert_return_gchar_ptr_to_stdstring(cetag_out); return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool File::load_partial_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length) -#else -bool File::load_partial_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_file_load_partial_contents_finish(gobj(), Glib::unwrap(result), &contents, &(length), 0, &(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; } diff --git a/gio/src/file.hg b/gio/src/file.hg index 4681b832..b6131b1e 100644 --- a/gio/src/file.hg +++ b/gio/src/file.hg @@ -198,11 +198,7 @@ public: * Other errors are possible too, and depend on what kind of filesystem the file is on. * @return FileInputStream or an empty RefPtr on error. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInputStream> read(); - #else - Glib::RefPtr<FileInputStream> read(std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED /** Asynchronously opens the file for reading. * For more details, see read() which is the synchronous version of this call. @@ -250,11 +246,7 @@ public: * @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. @@ -272,11 +264,7 @@ public: * @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() and g_file_create_readwrite), to avoid confusion with static create() methods, @@ -307,11 +295,7 @@ public: * @param flags a set of FileCreateFlags. * @return A FileOutputStream for the newly created file. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileOutputStream> create_file(const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags = FILE_CREATE_NONE); -#else - Glib::RefPtr<FileOutputStream> create_file(const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Creates a new file and returns an output stream for writing to it. * The file must not already exist. @@ -334,11 +318,7 @@ public: * @param flags a set of FileCreateFlags. * @return A FileOutputStream for the newly created file. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileOutputStream> create_file(FileCreateFlags flags = FILE_CREATE_NONE); -#else - Glib::RefPtr<FileOutputStream> create_file(FileCreateFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_create) /** Creates a new file and returns a stream for reading and writing to it. @@ -370,11 +350,7 @@ public: * @param flags a set of FileCreateFlags. * @return A FileOutputStream for the newly created file. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileIOStream> create_file_readwrite(const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags = FILE_CREATE_NONE); -#else - Glib::RefPtr<FileIOStream> create_file_readwrite(const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Creates a new file and returns a stream for reading and writing to it. * The file must not already exist. @@ -401,11 +377,7 @@ public: * @param flags a set of FileCreateFlags. * @return A FileOutputStream for the newly created file. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileIOStream> create_file_readwrite(FileCreateFlags flags = FILE_CREATE_NONE); -#else - Glib::RefPtr<FileIOStream> create_file_readwrite(FileCreateFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_create_readwrite) @@ -443,11 +415,7 @@ public: * @param flags A set of FileCreateFlags. * @return A FileOutputStream. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileOutputStream> replace(const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag = std::string(), bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); -#else - Glib::RefPtr<FileOutputStream> replace(const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Returns an output stream for overwriting the file, possibly creating a backup copy of the file first. @@ -480,11 +448,7 @@ public: * @param flags A set of FileCreateFlags. * @return A FileOutputStream. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileOutputStream> replace(const std::string& etag = std::string(), bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); -#else - Glib::RefPtr<FileOutputStream> replace(const std::string& etag, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_replace) @@ -684,11 +648,7 @@ public: * * @newin2p24 */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileIOStream> replace_readwrite(const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag = std::string(), bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); -#else - Glib::RefPtr<FileIOStream> replace_readwrite(const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Returns an output stream for overwriting the file in readwrite mode, possibly creating a backup copy of the file first. @@ -708,11 +668,7 @@ public: * * @newin2p24 */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileIOStream> replace_readwrite(const std::string& etag = std::string(), bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); -#else - Glib::RefPtr<FileIOStream> replace_readwrite(const std::string& etag, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_replace_readwrite) @@ -790,11 +746,7 @@ public: * @param flags: A set of FileQueryInfoFlags. * @result a FileInfo for the file, or an empty RefPtr on error. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes = "*", FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE) const; - #else - Glib::RefPtr<FileInfo> query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error) const; - #endif //GLIBMM_EXCEPTIONS_ENABLED /** Gets the requested information about the file. The result * is a FileInfo object that contains key-value attributes (such as the type or size @@ -822,11 +774,7 @@ public: * @param flags: A set of FileQueryInfoFlags. * @result a FileInfo for the file, or an empty RefPtr on error. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> query_info(const std::string& attributes = "*", FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE) const; - #else - Glib::RefPtr<FileInfo> query_info(const std::string& attributes, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error) const; - #endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_query_info) @@ -931,11 +879,7 @@ public: * @param attributes An attribute query string. * @return A FileInfo or an empty RefPtr if there was an error. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> query_filesystem_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes = "*"); -#else - Glib::RefPtr<FileInfo> query_filesystem_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Similar to query_info(), but obtains information * about the filesystem the file is on, rather than the file itself. @@ -958,11 +902,7 @@ public: * @param attributes An attribute query string. * @return A FileInfo or an empty RefPtr if there was an error. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> query_filesystem_info(const std::string& attributes = "*"); -#else - Glib::RefPtr<FileInfo> query_filesystem_info(const std::string& attributes, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_query_filesystem_info) _WRAP_METHOD(Glib::RefPtr<Mount> find_enclosing_mount(const Glib::RefPtr<Cancellable>& cancellable), @@ -1016,11 +956,7 @@ public: * @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. @@ -1080,11 +1016,7 @@ public: * @param flags A set of FileQueryInfoFlags. * @return A FileEnumerator if successful. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileEnumerator> enumerate_children(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes = "*", FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE); -#else - Glib::RefPtr<FileEnumerator> enumerate_children(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_enumerate_children) /** Gets the requested information about the files in a directory. The result @@ -1107,11 +1039,7 @@ public: * @param flags A set of FileQueryInfoFlags. * @return A FileEnumerator if successful. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileEnumerator> enumerate_children(const std::string& attributes = "*", FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE); -#else - Glib::RefPtr<FileEnumerator> enumerate_children(const std::string& attributes, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_enumerate_children) @@ -1167,11 +1095,7 @@ public: * @param display_name A string. * @return A Glib::File specifying what the file was renamed to, or an empty RefPtr if there was an error. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<File> set_display_name(const Glib::ustring& display_name); -#else - Glib::RefPtr<File> set_display_name(const Glib::ustring& display_name, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Asynchronously sets the display name for a given Gio::File. For the synchronous version of this function, see set_display_name(). @@ -1207,11 +1131,7 @@ public: * * @return <tt>true</tt> if the file was deleted. <tt>false</tt> otherwise. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool remove(); -#else - bool remove(std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool trash(const Glib::RefPtr<Cancellable>& cancellable), g_file_trash, @@ -1224,11 +1144,7 @@ public: * * @return <tt>true</tt> on successful trash, <tt>false</tt> otherwise. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool trash(); -#else - bool trash(std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** A signal handler would be, for instance: @@ -1256,24 +1172,12 @@ public: * * If you are interested in copying the Gio::File object itself (not the on-disk file), see File::dup(). */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool copy(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags = FILE_COPY_NONE); -#else - bool copy(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //TODO: Documentation. -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool copy(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, FileCopyFlags flags = FILE_COPY_NONE); -#else - bool copy(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error); -#endif -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool copy(const Glib::RefPtr<File>& destination, FileCopyFlags flags = FILE_COPY_NONE); -#else - bool copy(const Glib::RefPtr<File>& destination, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_copy) /** Copies the file to the location specified by @a destination asynchronously. @@ -1365,23 +1269,11 @@ public: * * If the source is a directory and the target does not exist, or FILE_COPY_OVERWRITE is specified and the target is a file, then a Gio::Error with WOULD_RECURSE may be thrown (if the native move operation isn't available). */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool move(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags = FILE_COPY_NONE); -#else - bool move(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error); -#endif -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool move(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, FileCopyFlags flags = FILE_COPY_NONE); -#else - bool move(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error); -#endif -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool move(const Glib::RefPtr<File>& destination, FileCopyFlags flags = FILE_COPY_NONE); -#else - bool move(const Glib::RefPtr<File>& destination, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_move) _WRAP_METHOD(bool make_directory(const Glib::RefPtr<Cancellable>& cancellable), @@ -1398,11 +1290,7 @@ public: * * @return <tt>true</tt> on successful creation, <tt>false</tt> otherwise. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool make_directory(); -#else - bool make_directory(std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool make_directory_with_parents(const Glib::RefPtr<Cancellable>& cancellable), @@ -1417,11 +1305,7 @@ public: * * @newin{2,18} */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool make_directory_with_parents(); -#else - bool make_directory_with_parents(std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool make_symbolic_link(const std::string& symlink_value, const Glib::RefPtr<Cancellable>& cancellable), g_file_make_symbolic_link, @@ -1432,11 +1316,7 @@ public: * @param symlink_value A string with the value of the new symlink. * @return <tt>true</tt> on the creation of a new symlink, <tt>false</tt> otherwise. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool make_symbolic_link(const std::string& symlink_value); -#else - bool make_symbolic_link(const std::string& symlink_value, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(Glib::RefPtr<FileAttributeInfoList> query_settable_attributes(const Glib::RefPtr<Cancellable>& cancellable), g_file_query_settable_attributes, @@ -1447,11 +1327,7 @@ public: * Returns: a FileAttributeInfoList describing the settable attributes. * @return A FileAttributeInfoList describing the settable attributes. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileAttributeInfoList> query_settable_attributes(); -#else - Glib::RefPtr<FileAttributeInfoList> query_settable_attributes(std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(Glib::RefPtr<FileAttributeInfoList> query_writable_namespaces(const Glib::RefPtr<Cancellable>& cancellable), g_file_query_writable_namespaces, @@ -1463,11 +1339,7 @@ public: * * @return A FileAttributeInfoList describing the writable namespaces. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileAttributeInfoList> query_writable_namespaces(); -#else - Glib::RefPtr<FileAttributeInfoList> query_writable_namespaces(std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /* This seems to be very generic (see the gpointer parameter), @@ -1498,11 +1370,7 @@ public: * @param flags A set of FileQueryInfoFlags. * @return <tt>true</tt> if there was any error, <tt>false</tt> otherwise. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool set_attributes_from_info(const Glib::RefPtr<FileInfo>& info, const Glib::RefPtr<Cancellable>& cancellable, FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE); -#else - bool set_attributes_from_info(const Glib::RefPtr<FileInfo>& info, const Glib::RefPtr<Cancellable>& cancellable, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Tries to set all attributes in the FileInfo on the target values, * not stopping on the first error. @@ -1520,11 +1388,7 @@ public: * @param flags A set of FileQueryInfoFlags. * @return <tt>true</tt> if there was any error, <tt>false</tt> otherwise. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool set_attributes_from_info(const Glib::RefPtr<FileInfo>& info, FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE); -#else - bool set_attributes_from_info(const Glib::RefPtr<FileInfo>& info, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_set_attributes_from_info) @@ -1555,11 +1419,7 @@ public: _IGNORE(g_file_set_attributes_async) _IGNORE(g_file_set_attributes_finish) // takes GFileInfo** -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool set_attributes_finish(const Glib::RefPtr<AsyncResult>& result, const Glib::RefPtr<FileInfo>& info); -#else - bool set_attributes_finish(const Glib::RefPtr<AsyncResult>& result, const Glib::RefPtr<FileInfo>& info, std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool set_attribute_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable), g_file_set_attribute_string, @@ -1573,11 +1433,7 @@ public: * @param flags FileQueryInfoFlags. * @return <tt>true</tt> if the @a attribute was successfully set, <tt>false</tt> otherwise. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool set_attribute_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags); -#else - bool set_attribute_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool set_attribute_byte_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable), g_file_set_attribute_byte_string, @@ -1593,11 +1449,7 @@ public: * @return <tt>true</tt> if the @a attribute was successfully set to @a value * in the @a file, <tt>false</tt> otherwise. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool set_attribute_byte_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags); -#else - bool set_attribute_byte_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool set_attribute_uint32(const std::string& attribute, guint32 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable), g_file_set_attribute_uint32, @@ -1612,11 +1464,7 @@ public: * @return <tt>true</tt> if the @a attribute was successfully set to @a value * in the @a file, <tt>false</tt> otherwise. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool set_attribute_uint32(const std::string& attribute, guint32 value, FileQueryInfoFlags flags); -#else - bool set_attribute_uint32(const std::string& attribute, guint32 value, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool set_attribute_int32(const std::string& attribute, gint32 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable), g_file_set_attribute_int32, @@ -1631,11 +1479,7 @@ public: * @return <tt>true</tt> if the @a attribute was successfully set to @a value * in the @a file, <tt>false</tt> otherwise. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool set_attribute_int32(const std::string& attribute, gint32 value, FileQueryInfoFlags flags); -#else - bool set_attribute_int32(const std::string& attribute, gint32 value, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool set_attribute_uint64(const std::string& attribute, guint64 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable), g_file_set_attribute_uint64, @@ -1650,11 +1494,7 @@ public: * @return <tt>true</tt> if the @a attribute was successfully set to @a value * in the @a file, <tt>false</tt> otherwise. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool set_attribute_uint64(const std::string& attribute, guint64 value, FileQueryInfoFlags flags); -#else - bool set_attribute_uint64(const std::string& attribute, guint64 value, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool set_attribute_int64(const std::string& attribute, gint64 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable), g_file_set_attribute_int64, @@ -1668,11 +1508,7 @@ public: * @param flags A FileQueryInfoFlags. * @return <tt>true</tt> if the @a attribute was successfully set, <tt>false</tt> otherwise. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool set_attribute_int64(const std::string& attribute, gint64 value, FileQueryInfoFlags flags); -#else - bool set_attribute_int64(const std::string& attribute, gint64 value, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Starts a @a mount_operation, mounting the volume that contains the file. * @@ -1915,11 +1751,7 @@ public: * @param flags A set of FileMonitorFlags. * @result true if the attributes were copied successfully, false otherwise. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool copy_attributes(const Glib::RefPtr<File>& destination, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags = FILE_COPY_NONE); -#else - bool copy_attributes(const Glib::RefPtr<File>& destination, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error); -#endif /** Copies the file attributes from @a source to @a destination. * @@ -1933,11 +1765,7 @@ public: * @param flags A set of FileMonitorFlags. * @result true if the attributes were copied successfully, false otherwise. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool copy_attributes(const Glib::RefPtr<File>& destination, FileCopyFlags flags = FILE_COPY_NONE); -#else - bool copy_attributes(const Glib::RefPtr<File>& destination, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error); -#endif _IGNORE(g_file_copy_attributes) /** Obtains a directory monitor for the given file. @@ -1950,11 +1778,7 @@ public: * @param flags A set of FileMonitorFlags. * @return A FileMonitor for the file. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileMonitor> monitor_directory(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags = FILE_MONITOR_NONE); -#else - Glib::RefPtr<FileMonitor> monitor_directory(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Obtains a directory monitor for the given file. * This may fail if directory monitoring is not supported. @@ -1962,11 +1786,7 @@ public: * @param flags A set of FileMonitorFlags. * @return A FileMonitor for the file. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileMonitor> monitor_directory(FileMonitorFlags flags = FILE_MONITOR_NONE); -#else - Glib::RefPtr<FileMonitor> monitor_directory(FileMonitorFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_monitor_directory) /** Obtains a file monitor for the given file. If no file notification @@ -1979,11 +1799,7 @@ public: * @param A Cancellable object. * @return A FileMonitor for the file. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileMonitor> monitor_file(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags = FILE_MONITOR_NONE); -#else - Glib::RefPtr<FileMonitor> monitor_file(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Obtains a file monitor for the given file. If no file notification * mechanism exists, then regular polling of the file is used. @@ -1995,11 +1811,7 @@ public: * @param A Cancellable object. * @return A FileMonitor for the file. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileMonitor> monitor_file(FileMonitorFlags flags = FILE_MONITOR_NONE); -#else - Glib::RefPtr<FileMonitor> monitor_file(FileMonitorFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_monitor_file) @@ -2015,11 +1827,7 @@ public: * * @newin{2,18} */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileMonitor> monitor(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags = FILE_MONITOR_NONE); -#else - Glib::RefPtr<FileMonitor> monitor(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Obtains a file monitor for the given file. If no file notification * mechanism exists, then regular polling of the file is used. @@ -2033,11 +1841,7 @@ public: * * @newin{2,18} */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileMonitor> monitor(FileMonitorFlags flags = FILE_MONITOR_NONE); -#else - Glib::RefPtr<FileMonitor> monitor(FileMonitorFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_monitor) //TODO: The documentation for these start/stop/poll_mountable functions needs to be improved once we've figured out what they do and what the C documentation means. murrayc. @@ -2178,11 +1982,7 @@ public: * * @result A AppInfo if the handle was found, or an empty RefPtr if there were errors. **/ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<AppInfo> query_default_handler(); -#else - Glib::RefPtr<AppInfo> query_default_handler(std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED //TODO: Something better than char*& for contents? /** Loads the content of the file into memory, returning the size of the data. @@ -2196,11 +1996,7 @@ public: * @param length A location to place the length of the contents of the file. * @param etag_out A location to place the current entity tag for the file. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool load_contents(const Glib::RefPtr<Cancellable>& cancellable, char*& contents, gsize& length, std::string& etag_out); -#else - bool load_contents(const Glib::RefPtr<Cancellable>& cancellable, char*& contents, gsize& length, std::string& etag_out, std::auto_ptr<Glib::Error>& error); -#endif /** Loads the content of the file into memory, returning the size of the data. * The data is always zero terminated, but this is not included in the resultant @a length. * @@ -2212,11 +2008,7 @@ public: * @param length A location to place the length of the contents of the file. * @newin{2,22} */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool load_contents(const Glib::RefPtr<Cancellable>& cancellable, char*& contents, gsize& length); -#else - bool load_contents(const Glib::RefPtr<Cancellable>& cancellable, char*& contents, gsize& length, std::auto_ptr<Glib::Error>& error); -#endif //TODO: Something better than char*& for contents? /** Loads the content of the file into memory, returning the size of the data. * The data is always zero terminated, but this is not included in the resultant @a length. @@ -2225,12 +2017,7 @@ public: * @param length A location to place the length of the contents of the file. * @param etag_out A location to place the current entity tag for the file. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool load_contents(char*& contents, gsize& length, std::string& etag_out); -#else - bool load_contents(char*& contents, gsize& length, std::string& etag_out, - std::auto_ptr<Glib::Error>& error); -#endif /** Loads the content of the file into memory, returning the size of the data. * The data is always zero terminated, but this is not included in the resultant @a length. * @@ -2238,11 +2025,7 @@ public: * @param length A location to place the length of the contents of the file. * @newin{2,22} */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool load_contents(char*& contents, gsize& length); -#else - bool load_contents(char*& contents, gsize& length, std::auto_ptr<Glib::Error>& error); -#endif _IGNORE(g_file_load_contents) /** Starts an asynchronous load of the file's contents. @@ -2281,11 +2064,7 @@ public: * @return <tt>true</tt> if the load was successful. If <tt>false</tt> and @a error is * present, it will be set appropriately. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool load_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length, std::string& etag_out); -#else - bool load_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length, std::string& etag_out, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Finishes an asynchronous load of the @a file's contents. * The contents are placed in @a contents, and @a length is set to the @@ -2298,11 +2077,7 @@ public: * present, it will be set appropriately. * @newin{2,22} */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool load_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length); -#else - bool load_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_load_contents_finish) @@ -2352,11 +2127,7 @@ public: * @return <tt>true</tt> if the load was successful. If <tt>false</tt> and @a error is * present, it will be set appropriately. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool load_partial_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length, std::string& etag_out); -#else - bool load_partial_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length, std::string& etag_out, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Finishes an asynchronous partial load operation that was started * with load_partial_contents_async(). @@ -2367,11 +2138,7 @@ public: * present, it will be set appropriately. * @newin{2,22} */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool load_partial_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length); -#else - bool load_partial_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_load_partial_contents_finish) /** Replaces the contents of the file with @a contents of @a length bytes. @@ -2397,11 +2164,7 @@ public: * for the document. * @param cancellable A Cancellable object. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED void replace_contents(const char* contents, gsize length, const std::string& etag, std::string& new_etag, const Glib::RefPtr<Cancellable>& cancellable, bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); -#else - void replace_contents(const char* contents, gsize length, const std::string& etag, std::string& new_etag, const Glib::RefPtr<Cancellable>& cancellable, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Replaces the contents of the file with @a contents of @a length bytes. * @@ -2421,11 +2184,7 @@ public: * @param new_etag A location to a new entity tag * for the document. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED void replace_contents(const char* contents, gsize length, const std::string& etag, std::string& new_etag, bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); -#else - void replace_contents(const char* contents, gsize length, const std::string& etag, std::string& new_etag, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Replaces the contents of the file with @a contents. * @@ -2449,11 +2208,7 @@ public: * for the document. * @param cancellable A Cancellable object. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED void replace_contents(const std::string& contents, const std::string& etag, std::string& new_etag, const Glib::RefPtr<Cancellable>& cancellable, bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); -#else - void replace_contents(const std::string& contents, const std::string& etag, std::string& new_etag, const Glib::RefPtr<Cancellable>& cancellable, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Replaces the contents of the file with @a contents. * @@ -2472,11 +2227,7 @@ public: * @param new_etag A location to a new entity tag * for the document. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED void replace_contents(const std::string& contents, const std::string& etag, std::string& new_etag, bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); -#else - void replace_contents(const std::string& contents, const std::string& etag, std::string& new_etag, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_replace_contents) @@ -2580,11 +2331,7 @@ public: * @param new_etag A location of a new entity tag * for the document. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED void replace_contents_finish(const Glib::RefPtr<AsyncResult>& result, std::string& etag); -#else - void replace_contents_finish(const Glib::RefPtr<AsyncResult>& result, std::string& etag, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Finishes an asynchronous replace of the given file . See * replace_contents_async(). Sets @a new_etag to the new entity @@ -2592,11 +2339,7 @@ public: * @param result A AsyncResult. * for the document. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED void replace_contents_finish(const Glib::RefPtr<AsyncResult>& result); -#else - void replace_contents_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_replace_contents_finish) _WRAP_METHOD(bool supports_thread_contexts() const, g_file_supports_thread_contexts) diff --git a/gio/src/fileenumerator.ccg b/gio/src/fileenumerator.ccg index 84ad2880..840efc4e 100644 --- a/gio/src/fileenumerator.ccg +++ b/gio/src/fileenumerator.ccg @@ -91,40 +91,22 @@ FileEnumerator::close_async(int io_priority, slot_copy); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> FileEnumerator::next_file() -#else -Glib::RefPtr<FileInfo> FileEnumerator::next_file(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_enumerator_next_file(gobj(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool FileEnumerator::close() -#else -bool FileEnumerator::close(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_file_enumerator_close(gobj(), 0, &(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; } diff --git a/gio/src/fileenumerator.hg b/gio/src/fileenumerator.hg index f92a1d26..3ce9b896 100644 --- a/gio/src/fileenumerator.hg +++ b/gio/src/fileenumerator.hg @@ -60,11 +60,7 @@ public: /** * @return A FileInfo or an empty RefPtr on error or end of enumerator. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> next_file(); - #else - Glib::RefPtr<FileInfo> next_file(std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool close(const Glib::RefPtr<Cancellable>& cancellable), g_file_enumerator_close, @@ -78,11 +74,7 @@ public: * are released as early as possible. * @return #<tt>true</tt> on success or an empty RefPtr on error. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED bool close(); - #else - bool close(std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED /** Request information for a number of files from the enumerator asynchronously. diff --git a/gio/src/fileinputstream.ccg b/gio/src/fileinputstream.ccg index 6f1d50c1..9dc275e2 100644 --- a/gio/src/fileinputstream.ccg +++ b/gio/src/fileinputstream.ccg @@ -24,40 +24,22 @@ namespace Gio { -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> FileInputStream::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes) -#else -Glib::RefPtr<FileInfo> FileInputStream::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_input_stream_query_info(gobj(), g_strdup((attributes).c_str()), 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 return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> FileInputStream::query_info(const std::string& attributes) -#else -Glib::RefPtr<FileInfo> FileInputStream::query_info(const std::string& attributes, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_input_stream_query_info(gobj(), g_strdup((attributes).c_str()), 0, &(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; } diff --git a/gio/src/fileinputstream.hg b/gio/src/fileinputstream.hg index 2fe2cdf6..08d56266 100644 --- a/gio/src/fileinputstream.hg +++ b/gio/src/fileinputstream.hg @@ -58,11 +58,7 @@ public: * @param cancellable A Cancellable object. * @return A FileInfo, or an empty RefPtr on error. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes = "*"); -#else - Glib::RefPtr<FileInfo> query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Queries a file input stream the given @a attributes. This function blocks * while querying the stream. For the asynchronous (non-blocking) version @@ -73,11 +69,7 @@ public: * @param attributes A file attribute query string. * @return A FileInfo, or an empty RefPtr on error. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> query_info(const std::string& attributes = "*"); -#else - Glib::RefPtr<FileInfo> query_info(const std::string& attributes, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_input_stream_query_info) diff --git a/gio/src/fileiostream.ccg b/gio/src/fileiostream.ccg index 9447d8a0..5ae6ac50 100644 --- a/gio/src/fileiostream.ccg +++ b/gio/src/fileiostream.ccg @@ -24,40 +24,22 @@ namespace Gio { -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> FileIOStream::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes) -#else -Glib::RefPtr<FileInfo> FileIOStream::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_io_stream_query_info(gobj(), g_strdup((attributes).c_str()), 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 return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> FileIOStream::query_info(const std::string& attributes) -#else -Glib::RefPtr<FileInfo> FileIOStream::query_info(const std::string& attributes, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_io_stream_query_info(gobj(), g_strdup((attributes).c_str()), 0, &(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; } diff --git a/gio/src/fileiostream.hg b/gio/src/fileiostream.hg index d12ebe8e..e23f81ce 100644 --- a/gio/src/fileiostream.hg +++ b/gio/src/fileiostream.hg @@ -56,11 +56,7 @@ public: * @param cancellable A Cancellable object. * @return A FileInfo, or an empty RefPtr on error. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes = "*"); -#else - Glib::RefPtr<FileInfo> query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Queries a file input stream the given @a attributes. This function blocks * while querying the stream. For the asynchronous (non-blocking) version @@ -71,11 +67,7 @@ public: * @param attributes A file attribute query string. * @return A FileInfo, or an empty RefPtr on error. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> query_info(const std::string& attributes = "*"); -#else - Glib::RefPtr<FileInfo> query_info(const std::string& attributes, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_input_stream_query_info) diff --git a/gio/src/fileoutputstream.ccg b/gio/src/fileoutputstream.ccg index 1bc25cb7..e46308cb 100644 --- a/gio/src/fileoutputstream.ccg +++ b/gio/src/fileoutputstream.ccg @@ -26,42 +26,24 @@ namespace Gio { -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> FileOutputStream::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes) -#else -Glib::RefPtr<FileInfo> FileOutputStream::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_output_stream_query_info(gobj(), g_strdup((attributes).c_str()), 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<FileInfo> FileOutputStream::query_info(const std::string& attributes) -#else -Glib::RefPtr<FileInfo> FileOutputStream::query_info(const std::string& attributes, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_output_stream_query_info(gobj(), g_strdup((attributes).c_str()), 0, &(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. diff --git a/gio/src/fileoutputstream.hg b/gio/src/fileoutputstream.hg index 3db4f7af..abfc53ed 100644 --- a/gio/src/fileoutputstream.hg +++ b/gio/src/fileoutputstream.hg @@ -72,11 +72,7 @@ public: * @param attributes A file attribute query string. * @return A FileInfo for the stream, or an empty RefPtr on error. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes = "*"); -#else - Glib::RefPtr<FileInfo> query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Queries a file output stream for the given @a attributes . * This function blocks while querying the stream. For the asynchronous @@ -99,11 +95,7 @@ public: * @param attributes A file attribute query string. * @return A FileInfo for the stream, or an empty RefPtr on error. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileInfo> query_info(const std::string& attributes = "*"); -#else - Glib::RefPtr<FileInfo> query_info(const std::string& attributes, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_output_stream_query_info) diff --git a/gio/src/icon.ccg b/gio/src/icon.ccg index fa39ac5c..cbf860b1 100644 --- a/gio/src/icon.ccg +++ b/gio/src/icon.ccg @@ -29,21 +29,12 @@ Icon::equal(const Glib::RefPtr<Icon>& other) const const_cast<GIcon*>(other->gobj()))); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<Icon> Icon::create(const std::string& str) -#else -Glib::RefPtr<Icon> Icon::create(const std::string& str, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; GIcon* icon = g_icon_new_for_string(str.c_str(), &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 Glib::wrap(icon); } diff --git a/gio/src/icon.hg b/gio/src/icon.hg index 579b86ce..b6d78e67 100644 --- a/gio/src/icon.hg +++ b/gio/src/icon.hg @@ -46,11 +46,7 @@ class Icon : public Glib::Interface public: // We can't just use a _WRAP_CREATE macro here since this is an abstract // interface class, so implement it by hand -#ifdef GLIBMM_EXCEPTIONS_ENABLED static Glib::RefPtr<Icon> create(const std::string& str); -#else - static Glib::RefPtr<Icon> create(const std::string& str, std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_icon_new_for_string) _WRAP_METHOD(guint hash() const, g_icon_hash) _WRAP_METHOD(std::string to_string() const, g_icon_to_string) diff --git a/gio/src/inputstream.ccg b/gio/src/inputstream.ccg index 27d59bb5..9b1eeebc 100644 --- a/gio/src/inputstream.ccg +++ b/gio/src/inputstream.ccg @@ -24,79 +24,43 @@ namespace Gio { -#ifdef GLIBMM_EXCEPTIONS_ENABLED gssize InputStream::read(void* buffer, gsize count) -#else -gssize InputStream::read(void* buffer, gsize count, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gssize retvalue = g_input_stream_read(gobj(), buffer, count, 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool InputStream::read_all(void* buffer, gsize count, gsize& bytes_read) -#else -bool InputStream::read_all(void* buffer, gsize count, gsize& bytes_read, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_input_stream_read_all(gobj(), buffer, count, &(bytes_read), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED gssize InputStream::skip(gsize count) -#else -gssize InputStream::skip(gsize count, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gssize retvalue = g_input_stream_skip(gobj(), count, 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool InputStream::close() -#else -bool InputStream::close(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_input_stream_close(gobj(), 0, &(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; } diff --git a/gio/src/inputstream.hg b/gio/src/inputstream.hg index 2c9a5bdb..427d447b 100644 --- a/gio/src/inputstream.hg +++ b/gio/src/inputstream.hg @@ -61,11 +61,7 @@ public: * @param count The number of bytes that will be read from the stream. * @return Number of bytes read, or -1 on error. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED gssize read(void* buffer, gsize count); - #else - gssize read(void* buffer, gsize count, std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED //TODO: for glibmm 2.17/18, we should decide whether to provide a read() // function as below, which would presumably read until EOL, or one with @@ -96,11 +92,7 @@ public: * @param bytes_read Location to store the number of bytes that was read from the stream. * @return <tt>true</tt> on success, <tt>false</tt> if there was an error. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED bool read_all(void* buffer, gsize count, gsize& bytes_read); - #else - bool read_all(void* buffer, gsize count, gsize& bytes_read, std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED //TODO: bool read_all(std::string& buffer, gsize count, gsize& bytes_read, const Glib::RefPtr<Cancellable>& cancellable); //TODO: bool read_all(std::string& buffer, gsize count, gsize& bytes_read) @@ -121,11 +113,7 @@ public: * @param count The number of bytes that will be skipped from the stream. * @return Number of bytes skipped, or -1 on error. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED gssize skip(gsize count); - #else - gssize skip(gsize count, std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool close(const Glib::RefPtr<Cancellable>& cancellable), g_input_stream_close, @@ -151,11 +139,7 @@ public: * * @return <tt>true</tt> on success, <tt>false</tt> on failure. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED bool close(); - #else - bool close(std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED /** Request an asynchronous read of @a count bytes from the stream into the buffer * starting at @a buffer. When the operation is finished @a slot will be called. diff --git a/gio/src/iostream.ccg b/gio/src/iostream.ccg index ef19006c..ac12d922 100644 --- a/gio/src/iostream.ccg +++ b/gio/src/iostream.ccg @@ -26,21 +26,12 @@ namespace Gio -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool IOStream::close() -#else -bool IOStream::close(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_io_stream_close(gobj(), 0, &(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; } diff --git a/gio/src/iostream.hg b/gio/src/iostream.hg index c0ba315e..af5f60f9 100644 --- a/gio/src/iostream.hg +++ b/gio/src/iostream.hg @@ -45,11 +45,7 @@ public: _WRAP_METHOD(Glib::RefPtr<OutputStream> get_output_stream(), g_io_stream_get_output_stream, refreturn) _WRAP_METHOD(bool close(const Glib::RefPtr<Cancellable>& cancellable), g_io_stream_close, errthrow) -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool close(); -#else -bool close(std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED void close_async(const SlotAsyncReady&slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority=Glib::PRIORITY_DEFAULT); void close_async(const SlotAsyncReady& slot, int io_priority = Glib::PRIORITY_DEFAULT); diff --git a/gio/src/loadableicon.ccg b/gio/src/loadableicon.ccg index 0a506b1e..34b024b2 100644 --- a/gio/src/loadableicon.ccg +++ b/gio/src/loadableicon.ccg @@ -24,13 +24,8 @@ namespace Gio { -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<InputStream> LoadableIcon::load(int size, Glib::ustring& type, const Glib::RefPtr<Cancellable>& cancellable) -#else -Glib::RefPtr<InputStream> -LoadableIcon::load(int size, Glib::ustring& type, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { char* c_type; GError* gerror = 0; @@ -40,13 +35,8 @@ LoadableIcon::load(int size, Glib::ustring& type, const Glib::RefPtr<Cancellable &c_type, 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 type = c_type; g_free(c_type); @@ -55,13 +45,8 @@ LoadableIcon::load(int size, Glib::ustring& type, const Glib::RefPtr<Cancellable return retval; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<InputStream> LoadableIcon::load(int size, Glib::ustring& type) -#else -Glib::RefPtr<InputStream> -LoadableIcon::load(int size, Glib::ustring& type, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { char* c_type; GError* gerror = 0; @@ -71,13 +56,8 @@ LoadableIcon::load(int size, Glib::ustring& type, std::auto_ptr<Glib::Error>& er &c_type, 0, &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 type = c_type; g_free(c_type); diff --git a/gio/src/loadableicon.hg b/gio/src/loadableicon.hg index 647d1323..54b1fffb 100644 --- a/gio/src/loadableicon.hg +++ b/gio/src/loadableicon.hg @@ -50,18 +50,10 @@ public: * * @return a InputStream to read the icon from. **/ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<InputStream> load(int size, Glib::ustring& type, const Glib::RefPtr<Cancellable>& cancellable); -#else - Glib::RefPtr<InputStream> load(int size, Glib::ustring& type, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Non-cancellable version of load() */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<InputStream> load(int size, Glib::ustring& type); -#else - Glib::RefPtr<InputStream> load(int size, Glib::ustring& type, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED //TODO: 'type' can be NULL as well, but I don't really want to add 2 more //overloads -- one cancellable, and one not... diff --git a/gio/src/mount.ccg b/gio/src/mount.ccg index 4f821a97..31778693 100644 --- a/gio/src/mount.ccg +++ b/gio/src/mount.ccg @@ -277,34 +277,20 @@ void Mount::guess_content_type(bool force_rescan) 0); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED void Mount::guess_content_type_sync(const Glib::RefPtr<Cancellable>& cancellable, bool force_rescan) -#else -void Mount::guess_content_type_sync(const Glib::RefPtr<Cancellable>& cancellable, bool force_rescan, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; g_mount_guess_content_type_sync(gobj(), force_rescan, Glib::unwrap(cancellable), &gerror); if(gerror) -#ifndef GLIBMM_EXCEPTIONS_ENABLED - error = -#endif //GLIBMM_EXCEPTIONS_ENABLED ::Glib::Error::throw_exception(gerror); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED void Mount::guess_content_type_sync(bool force_rescan) -#else -void Mount::guess_content_type_sync(bool force_rescan, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; g_mount_guess_content_type_sync(gobj(), force_rescan, 0, &gerror); if(gerror) -#ifndef GLIBMM_EXCEPTIONS_ENABLED - error = -#endif //GLIBMM_EXCEPTIONS_ENABLED ::Glib::Error::throw_exception(gerror); } diff --git a/gio/src/mount.hg b/gio/src/mount.hg index c62ffe8b..987b0317 100644 --- a/gio/src/mount.hg +++ b/gio/src/mount.hg @@ -197,13 +197,8 @@ public: void guess_content_type(bool force_rescan = true); _IGNORE(g_mount_guess_content_type) -#ifdef GLIBMM_EXCEPTIONS_ENABLED void guess_content_type_sync(const Glib::RefPtr<Cancellable>& cancellable, bool force_rescan = true); void guess_content_type_sync(bool force_rescan = true); -#else - void guess_content_type_sync(const Glib::RefPtr<Cancellable>& cancellable, bool force_rescan, std::auto_ptr<Glib::Error>& error); - void guess_content_type_sync(bool force_rescan, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_mount_guess_content_type_sync) #m4 _CONVERSION(`gchar**',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)') diff --git a/gio/src/outputstream.ccg b/gio/src/outputstream.ccg index 17daedea..25e545c8 100644 --- a/gio/src/outputstream.ccg +++ b/gio/src/outputstream.ccg @@ -153,192 +153,102 @@ OutputStream::close_async(const SlotAsyncReady& slot, int io_priority) } -#ifdef GLIBMM_EXCEPTIONS_ENABLED gssize OutputStream::write(const void* buffer, gsize count) -#else -gssize OutputStream::write(const void* buffer, gsize count, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gssize retvalue = g_output_stream_write(gobj(), buffer, count, 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED gssize OutputStream::write(const std::string& buffer, const Glib::RefPtr<Cancellable>& cancellable) -#else -gssize OutputStream::write(const std::string& buffer, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gssize retvalue = g_output_stream_write(gobj(), buffer.data(), buffer.size(), 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 return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED gssize OutputStream::write(const std::string& buffer) -#else -gssize OutputStream::write(const std::string& buffer, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gssize retvalue = g_output_stream_write(gobj(), buffer.data(), buffer.size(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool OutputStream::write_all(const void* buffer, gsize count, gsize& bytes_written) -#else -bool OutputStream::write_all(const void* buffer, gsize count, gsize& bytes_written, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_output_stream_write_all(gobj(), buffer, count, &(bytes_written), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool OutputStream::write_all(const std::string& buffer, gsize& bytes_written, const Glib::RefPtr<Cancellable>& cancellable) -#else -bool OutputStream::write_all(const std::string& buffer, gsize& bytes_written, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_output_stream_write_all(gobj(), buffer.data(), buffer.size(), &(bytes_written), 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 return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool OutputStream::write_all(const std::string& buffer, gsize& bytes_written) -#else -bool OutputStream::write_all(const std::string& buffer, gsize& bytes_written, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_output_stream_write_all(gobj(), buffer.data(), buffer.size(), &(bytes_written), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED gssize OutputStream::splice(const Glib::RefPtr<InputStream>& source, const Glib::RefPtr<Cancellable>& cancellable, OutputStreamSpliceFlags flags) -#else -gssize OutputStream::splice(const Glib::RefPtr<InputStream>& source, const Glib::RefPtr<Cancellable>& cancellable, OutputStreamSpliceFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gssize retvalue = g_output_stream_splice(gobj(), Glib::unwrap(source), ((GOutputStreamSpliceFlags)(flags)), 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 return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED gssize OutputStream::splice(const Glib::RefPtr<InputStream>& source, OutputStreamSpliceFlags flags) -#else -gssize OutputStream::splice(const Glib::RefPtr<InputStream>& source, OutputStreamSpliceFlags flags, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gssize retvalue = g_output_stream_splice(gobj(), Glib::unwrap(source), ((GOutputStreamSpliceFlags)(flags)), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool OutputStream::flush() -#else -bool OutputStream::flush(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_output_stream_flush(gobj(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool OutputStream::close() -#else -bool OutputStream::close(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_output_stream_close(gobj(), 0, &(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; } diff --git a/gio/src/outputstream.hg b/gio/src/outputstream.hg index e525245d..13cffbfd 100644 --- a/gio/src/outputstream.hg +++ b/gio/src/outputstream.hg @@ -63,11 +63,7 @@ public: * @param count The number of bytes to write. * @return Number of bytes written, or -1 on error. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED gssize write(const void* buffer, gsize count); - #else - gssize write(const void* buffer, gsize count, std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED /** Tries to write @a count bytes from @a buffer into the stream. Will block * during the operation. @@ -86,11 +82,7 @@ public: * @param cancellable Cancellable object. * @return Number of bytes written, or -1 on error. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED gssize write(const std::string& buffer, const Glib::RefPtr<Cancellable>& cancellable); - #else - gssize write(const std::string& buffer, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED /** Tries to write @a count bytes from @a buffer into the stream. Will block * during the operation. @@ -107,11 +99,7 @@ public: * @param buffer The buffer containing the data to write. * @return Number of bytes written, or -1 on error. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED gssize write(const std::string& buffer); - #else - gssize write(const std::string& buffer, std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool write_all(const void* buffer, gsize count, gsize& bytes_written, const Glib::RefPtr<Cancellable>& cancellable), @@ -136,11 +124,7 @@ public: * written to the stream. * @return <tt>true</tt> on success, <tt>false</tt> if there was an error. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED bool write_all(const void* buffer, gsize count, gsize& bytes_written); - #else - bool write_all(const void* buffer, gsize count, gsize& bytes_written, std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED /** Tries to write @a count bytes from @a buffer into the stream. Will block * during the operation. @@ -160,11 +144,7 @@ public: * @param cancellable Cancellable object. * @return <tt>true</tt> on success, <tt>false</tt> if there was an error. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED bool write_all(const std::string& buffer, gsize& bytes_written, const Glib::RefPtr<Cancellable>& cancellable); - #else - bool write_all(const std::string& buffer, gsize& bytes_written, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED /** Tries to write @a count bytes from @a buffer into the stream. Will block * during the operation. @@ -183,11 +163,7 @@ public: * written to the stream. * @return <tt>true</tt> on success, <tt>false</tt> if there was an error. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED bool write_all(const std::string& buffer, gsize& bytes_written); - #else - bool write_all(const std::string& buffer, gsize& bytes_written, std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED /** Splices an input stream into an output stream. * @@ -197,11 +173,7 @@ public: * ignore. * @return A #gssize containing the size of the data spliced. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED gssize splice(const Glib::RefPtr<InputStream>& source, const Glib::RefPtr<Cancellable>& cancellable, OutputStreamSpliceFlags flags = OUTPUT_STREAM_SPLICE_NONE); - #else - gssize splice(const Glib::RefPtr<InputStream>& source, const Glib::RefPtr<Cancellable>& cancellable, OutputStreamSpliceFlags flags, std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED /** Splices an input stream into an output stream. * @@ -210,11 +182,7 @@ public: * ignore. * @return A #gssize containing the size of the data spliced. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED gssize splice(const Glib::RefPtr<InputStream>& source, OutputStreamSpliceFlags flags = OUTPUT_STREAM_SPLICE_NONE); - #else - gssize splice(const Glib::RefPtr<InputStream>& source, OutputStreamSpliceFlags flags, std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_output_stream_splice) _WRAP_METHOD(bool flush(const Glib::RefPtr<Cancellable>& cancellable), @@ -232,11 +200,7 @@ public: * @param cancellable Optional cancellable object. * @return <tt>true</tt> on success, <tt>false</tt> on error. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED bool flush(); - #else - bool flush(std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool close(const Glib::RefPtr<Cancellable>& cancellable), g_output_stream_close, @@ -274,11 +238,7 @@ public: * @param cancellable Optional cancellable object. * @return <tt>true</tt> on success, <tt>false</tt> on failure. */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED bool close(); - #else - bool close(std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED /** Request an asynchronous write of @a count bytes from @a buffer into * the stream. When the operation is finished @a slot will be called. diff --git a/gio/src/resolver.ccg b/gio/src/resolver.ccg index e7be91b8..4134c598 100644 --- a/gio/src/resolver.ccg +++ b/gio/src/resolver.ccg @@ -33,61 +33,34 @@ void Resolver::set_default(const Glib::RefPtr<Resolver>& resolver) g_resolver_set_default(Glib::unwrap(resolver)); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ListHandle< Glib::RefPtr<InetAddress> > Resolver::lookup_by_name(const Glib::ustring& hostname) -#else -Glib::ListHandle< Glib::RefPtr<InetAddress> > Resolver::lookup_by_name(const Glib::ustring& hostname, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::ListHandle< Glib::RefPtr<InetAddress> > retvalue = Glib::ListHandle< Glib::RefPtr<InetAddress> >(g_resolver_lookup_by_name(gobj(), hostname.c_str(), 0, &(gerror)), Glib::OWNERSHIP_SHALLOW); -#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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring Resolver::lookup_by_address(const Glib::RefPtr<InetAddress>& address) -#else -Glib::ustring Resolver::lookup_by_address(const Glib::RefPtr<InetAddress>& address, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::ustring retvalue = Glib::convert_return_gchar_ptr_to_ustring(g_resolver_lookup_by_address(gobj(), const_cast<GInetAddress*>(Glib::unwrap(address)), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED ListHandle_SrvTarget Resolver::lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain) -#else -ListHandle_SrvTarget Resolver::lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; ListHandle_SrvTarget retvalue = ListHandle_SrvTarget(g_resolver_lookup_service(gobj(), service.c_str(), protocol.c_str(), domain.c_str(), 0, &(gerror)), Glib::OWNERSHIP_SHALLOW); -#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; diff --git a/gio/src/resolver.hg b/gio/src/resolver.hg index 245c6dfb..f3ffe437 100644 --- a/gio/src/resolver.hg +++ b/gio/src/resolver.hg @@ -60,11 +60,7 @@ public: #m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<InetAddress> >',`$2($3, Glib::OWNERSHIP_SHALLOW)') _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) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ListHandle< Glib::RefPtr<InetAddress> > lookup_by_name(const Glib::ustring& hostname); -#else - Glib::ListHandle< Glib::RefPtr<InetAddress> > lookup_by_name(const Glib::ustring& hostname, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED void lookup_by_name_async(const Glib::ustring& hostname, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable); void lookup_by_name_async(const Glib::ustring& hostname, const SlotAsyncReady& slot); _IGNORE(g_resolver_lookup_by_name_async) @@ -72,11 +68,7 @@ public: #m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<InetAddress> >',`$2($3, Glib::OWNERSHIP_SHALLOW)') _WRAP_METHOD(Glib::ustring lookup_by_address(const Glib::RefPtr<InetAddress>& address, const Glib::RefPtr<Cancellable>& cancellable), g_resolver_lookup_by_address, errthrow) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring lookup_by_address(const Glib::RefPtr<InetAddress>& address); -#else - Glib::ustring lookup_by_address(const Glib::RefPtr<InetAddress>& address, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED void lookup_by_address_async(const Glib::RefPtr<InetAddress>& address, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable); void lookup_by_address_async(const Glib::RefPtr<InetAddress>& address, const SlotAsyncReady& slot); _IGNORE(g_resolver_lookup_by_address_async) @@ -84,11 +76,7 @@ public: #m4 _CONVERSION(`GList*',`ListHandle_SrvTarget',`$2($3, Glib::OWNERSHIP_SHALLOW)') _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) -#ifdef GLIBMM_EXCEPTIONS_ENABLED ListHandle_SrvTarget lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain); -#else - ListHandle_SrvTarget lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED void lookup_service_async(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable); 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) diff --git a/gio/src/seekable.ccg b/gio/src/seekable.ccg index a979ae1d..52534f61 100644 --- a/gio/src/seekable.ccg +++ b/gio/src/seekable.ccg @@ -23,41 +23,23 @@ namespace Gio { -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool Seekable::seek(goffset offset, Glib::SeekType type) -#else -bool Seekable::seek(goffset offset, Glib::SeekType type, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_seekable_seek(gobj(), offset, ((GSeekType)(type)), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool Seekable::truncate(goffset offset) -#else -bool Seekable::truncate(goffset offset, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_seekable_truncate(gobj(), offset, 0, &(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; } diff --git a/gio/src/seekable.hg b/gio/src/seekable.hg index 6e94f4ae..df8ae008 100644 --- a/gio/src/seekable.hg +++ b/gio/src/seekable.hg @@ -61,11 +61,7 @@ public: * @return <tt>true</tt> if successful. If an error * has occurred, this function will return <tt>false</tt>. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool seek(goffset offset, Glib::SeekType type); -#else - bool seek(goffset offset, Glib::SeekType type, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool can_truncate() const, g_seekable_can_truncate) @@ -78,11 +74,7 @@ public: * @return <tt>true</tt> if successful. If an error * has occured, this function will return <tt>false</tt>. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool truncate(goffset offset); -#else - bool truncate(goffset offset, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED //_WRAP_VFUNC(goffset tell() const, tell) //_WRAP_VFUNC(goffset can_seek() const, can_seek) diff --git a/gio/src/socket.ccg b/gio/src/socket.ccg index 516dbea8..9c3f1e42 100644 --- a/gio/src/socket.ccg +++ b/gio/src/socket.ccg @@ -24,199 +24,98 @@ namespace Gio { -#ifdef GLIBMM_EXCEPTIONS_ENABLED Socket::Socket(SocketFamily family, SocketType type, SocketProtocol protocol, const Glib::RefPtr<Cancellable>& cancellable) -#else -Socket::Socket(SocketFamily family, SocketType type, SocketProtocol protocol, - std::auto_ptr<Glib::Error>& error, - const Glib::RefPtr<Cancellable>& cancellable) -#endif //GLIBMM_EXCEPTIONS_ENABLED : _CONSTRUCT("family", int(family), "type", int(type), "protocol", int(protocol)) { -#ifdef GLIBMM_EXCEPTIONS_ENABLED init(cancellable); -#else - init(cancellable, error); -#endif //GLIBMM_EXCEPTIONS_ENABLED } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Socket::Socket(int fd, const Glib::RefPtr<Cancellable>& cancellable) -#else -Socket::Socket(int fd, std::auto_ptr<Glib::Error>& error, - const Glib::RefPtr<Cancellable>& cancellable) -#endif //GLIBMM_EXCEPTIONS_ENABLED : _CONSTRUCT("fd", fd) { -#ifdef GLIBMM_EXCEPTIONS_ENABLED init(cancellable); -#else - init(cancellable, error); -#endif //GLIBMM_EXCEPTIONS_ENABLED } -#ifdef GLIBMM_EXCEPTIONS_ENABLED // static Glib::RefPtr<Socket> Socket::create(SocketFamily family, SocketType type, SocketProtocol protocol, const Glib::RefPtr<Cancellable>& cancellable) -#else -Glib::RefPtr<Socket> Socket::create(SocketFamily family, SocketType type, SocketProtocol protocol, - std::auto_ptr<Glib::Error>& error, - const Glib::RefPtr<Cancellable>& cancellable) -#endif //GLIBMM_EXCEPTIONS_ENABLED { -#ifdef GLIBMM_EXCEPTIONS_ENABLED return Glib::RefPtr<Socket>(new Socket(family, type, protocol, cancellable)); -#else - return Glib::RefPtr<Socket>(new Socket(family, type, protocol, error, cancellable)); -#endif //GLIBMM_EXCEPTIONS_ENABLED } -#ifdef GLIBMM_EXCEPTIONS_ENABLED // static Glib::RefPtr<Socket> Socket::create_from_fd(int fd, const Glib::RefPtr<Cancellable>& cancellable) -#else -Glib::RefPtr<Socket> Socket::create_from_fd(int fd, std::auto_ptr<Glib::Error>& error, - const Glib::RefPtr<Cancellable>& cancellable) -#endif //GLIBMM_EXCEPTIONS_ENABLED { -#ifdef GLIBMM_EXCEPTIONS_ENABLED return Glib::RefPtr<Socket>(new Socket(fd, cancellable)); -#else - return Glib::RefPtr<Socket>(new Socket(fd, error, cancellable)); -#endif //GLIBMM_EXCEPTIONS_ENABLED } -#ifdef GLIBMM_EXCEPTIONS_ENABLED void Socket::connect(const Glib::RefPtr<SocketAddress>& address) -#else -void Socket::connect(const Glib::RefPtr<SocketAddress>& address, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; g_socket_connect(gobj(), const_cast<GSocketAddress*>(Glib::unwrap(address)), 0, &(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 } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<Socket> Socket::accept() -#else -Glib::RefPtr<Socket> Socket::accept(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<Socket> retvalue = Glib::wrap(g_socket_accept(gobj(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED gssize Socket::receive(char* buffer, gsize size) -#else -gssize Socket::receive(char* buffer, gsize size, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gssize retvalue = g_socket_receive(gobj(), buffer, size, 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED gssize Socket::send(const gchar* buffer, gsize size) -#else -gssize Socket::send(const gchar* buffer, gsize size, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gssize retvalue = g_socket_send(gobj(), buffer, size, 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED gssize Socket::send_to(const Glib::RefPtr<SocketAddress>& address, const char* buffer, gsize size) -#else -gssize Socket::send_to(const Glib::RefPtr<SocketAddress>& address, const char* buffer, gsize size, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; gssize retvalue = g_socket_send_to(gobj(), const_cast<GSocketAddress*>(Glib::unwrap(address)), buffer, size, 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED void Socket::condition_wait(Glib::IOCondition condition) -#else -void Socket::condition_wait(Glib::IOCondition condition, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; g_socket_condition_wait(gobj(), ((GIOCondition)(condition)), 0, &(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 } -#ifdef GLIBMM_EXCEPTIONS_ENABLED gssize Socket::receive_from(Glib::RefPtr<SocketAddress>& address, char* buffer, gsize size, const Glib::RefPtr<Cancellable>& cancellable) -#else -gssize Socket::receive_from(Glib::RefPtr<SocketAddress>& address, char* buffer, gsize size, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; GSocketAddress* caddr = 0; gssize retvalue = g_socket_receive_from(gobj(), &caddr, buffer, size, 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 (caddr) address = Glib::wrap (caddr); @@ -224,22 +123,13 @@ gssize Socket::receive_from(Glib::RefPtr<SocketAddress>& address, char* buffer, return retvalue; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED gssize Socket::receive_from(Glib::RefPtr<SocketAddress>& address, char* buffer, gsize size) -#else -gssize Socket::receive_from(Glib::RefPtr<SocketAddress>& address, char* buffer, gsize size, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; GSocketAddress* caddr = 0; gssize retvalue = g_socket_receive_from(gobj(), &caddr, buffer, size, 0, &(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 (caddr) address = Glib::wrap (caddr); diff --git a/gio/src/socket.hg b/gio/src/socket.hg index ea747e1e..30df9db3 100644 --- a/gio/src/socket.hg +++ b/gio/src/socket.hg @@ -90,106 +90,54 @@ class Socket : public Glib::Object, public Initable _IMPLEMENTS_INTERFACE(Initable) protected: -#ifdef GLIBMM_EXCEPTIONS_ENABLED Socket(SocketFamily family, SocketType type, SocketProtocol protocol, const Glib::RefPtr<Cancellable>& cancellable); -#else - Socket(SocketFamily family, SocketType type, SocketProtocol protocol, - std::auto_ptr<Glib::Error>& error, - const Glib::RefPtr<Cancellable>& cancellable); -#endif //GLIBMM_EXCEPTIONS_ENABLED -#ifdef GLIBMM_EXCEPTIONS_ENABLED Socket(int fd, const Glib::RefPtr<Cancellable>& cancellable); -#else - Socket(int fd, std::auto_ptr<Glib::Error>& error, - const Glib::RefPtr<Cancellable>& cancellable); -#endif //GLIBMM_EXCEPTIONS_ENABLED public: _WRAP_METHOD_DOCS_ONLY(g_socket_new) /** @throw Glib::Error */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED static Glib::RefPtr<Socket> create(SocketFamily family, SocketType type, SocketProtocol protocol, const Glib::RefPtr<Cancellable>& cancellable = Glib::RefPtr<Cancellable>()); -#else - static Glib::RefPtr<Socket> - create(SocketFamily family, SocketType type, SocketProtocol protocol, - std::auto_ptr<Glib::Error>& error, - const Glib::RefPtr<Cancellable>& cancellable = Glib::RefPtr<Cancellable>()); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD_DOCS_ONLY(g_socket_new_from_fd) /** @throw Glib::Error */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED static Glib::RefPtr<Socket> create_from_fd(int fd, const Glib::RefPtr<Cancellable>& cancellable = Glib::RefPtr<Cancellable>()); -#else - static Glib::RefPtr<Socket> create_from_fd(int fd, std::auto_ptr<Glib::Error>& error, - const Glib::RefPtr<Cancellable>& - cancellable = Glib::RefPtr<Cancellable>()); -#endif //GLIBMM_EXCEPTIONS_ENABLED //TODO: Writecusotm documetation, mentioning, for instance, the exception, instead of a bool return. _WRAP_METHOD(void bind(const Glib::RefPtr<SocketAddress>& address, bool allow_reuse), g_socket_bind, errthrow) _WRAP_METHOD(void listen(), g_socket_listen, errthrow) _WRAP_METHOD(Glib::RefPtr<Socket> accept(const Glib::RefPtr<Cancellable>& cancellable), g_socket_accept, errthrow) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<Socket> accept(); -#else - Glib::RefPtr<Socket> accept(std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED //TODO: Writecusotm documetation, mentioning, for instance, the exception, instead of a bool return. _WRAP_METHOD(void connect(const Glib::RefPtr<SocketAddress>& address, const Glib::RefPtr<Cancellable>& cancellable), g_socket_connect, errthrow) -#ifdef GLIBMM_EXCEPTIONS_ENABLED void connect(const Glib::RefPtr<SocketAddress>& address); -#else - void connect(const Glib::RefPtr<SocketAddress>& address, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED // FIXME: it doesn't really seem like this is a proper use of exceptions... _WRAP_METHOD(void check_connect_result(), g_socket_check_connect_result, errthrow) // TODO: std::string overload? _WRAP_METHOD(gssize receive(char* buffer, gsize size, const Glib::RefPtr<Cancellable>& cancellable), g_socket_receive, errthrow) -#ifdef GLIBMM_EXCEPTIONS_ENABLED gssize receive(char* buffer, gsize size); -#else - gssize receive(char* buffer, gsize size, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_socket_receive_from) -#ifdef GLIBMM_EXCEPTIONS_ENABLED gssize receive_from(Glib::RefPtr<SocketAddress>& address, char* buffer, gsize size, const Glib::RefPtr<Cancellable>& cancellable); -#else - gssize receive_from(Glib::RefPtr<SocketAddress>& address, char* buffer, gsize size, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED -#ifdef GLIBMM_EXCEPTIONS_ENABLED gssize receive_from(Glib::RefPtr<SocketAddress>& address, char* buffer, gsize size); -#else - gssize receive_from(Glib::RefPtr<SocketAddress>& address, char* buffer, gsize size, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED // TODO: wrap g_socket_receive_message -- figure out this GInputVector thing // TODO: std::string overload? _WRAP_METHOD(gssize send(const gchar* buffer, gsize size, const Glib::RefPtr<Cancellable>& cancellable), g_socket_send, errthrow) -#ifdef GLIBMM_EXCEPTIONS_ENABLED gssize send(const gchar* buffer, gsize size); -#else - gssize send(const gchar* buffer, gsize size, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED // TODO: std::string overload? _WRAP_METHOD(gssize send_to(const Glib::RefPtr<SocketAddress>& address, const char* buffer, gsize size, const Glib::RefPtr<Cancellable>& cancellable), g_socket_send_to, errthrow) -#ifdef GLIBMM_EXCEPTIONS_ENABLED gssize send_to(const Glib::RefPtr<SocketAddress>& address, const char* buffer, gsize size); -#else - gssize send_to(const Glib::RefPtr<SocketAddress>& address, const char* buffer, gsize size, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED // TODO: wrap g_socket_send_message -- figure out this GOutputVector thing _WRAP_METHOD(void close(), g_socket_close, errthrow) @@ -205,11 +153,7 @@ public: _WRAP_METHOD(Glib::IOCondition condition_check(Glib::IOCondition condition), g_socket_condition_check) _WRAP_METHOD(void condition_wait(Glib::IOCondition condition, const Glib::RefPtr<Cancellable>& cancellable), g_socket_condition_wait, errthrow) -#ifdef GLIBMM_EXCEPTIONS_ENABLED void condition_wait(Glib::IOCondition condition); -#else - void condition_wait(Glib::IOCondition condition, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(void set_listen_backlog(int backlog), g_socket_set_listen_backlog) _WRAP_METHOD(int get_listen_backlog() const, g_socket_get_listen_backlog) diff --git a/gio/src/socketaddressenumerator.ccg b/gio/src/socketaddressenumerator.ccg index d3ec4a2f..3c6d8591 100644 --- a/gio/src/socketaddressenumerator.ccg +++ b/gio/src/socketaddressenumerator.ccg @@ -38,23 +38,13 @@ namespace Gio { slot_copy); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketAddress> SocketAddressEnumerator::next() -#else - Glib::RefPtr<SocketAddress> - SocketAddressEnumerator::next(std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<SocketAddress> retvalue = Glib::wrap(g_socket_address_enumerator_next(gobj(), 0, &(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; diff --git a/gio/src/socketaddressenumerator.hg b/gio/src/socketaddressenumerator.hg index 2651f898..132e670d 100644 --- a/gio/src/socketaddressenumerator.hg +++ b/gio/src/socketaddressenumerator.hg @@ -40,11 +40,7 @@ class SocketAddressEnumerator : public Glib::Object public: _WRAP_METHOD(Glib::RefPtr<SocketAddress> next(const Glib::RefPtr<Cancellable>& cancellable), g_socket_address_enumerator_next, errthrow) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketAddress> next(); -#else - Glib::RefPtr<SocketAddress> next(std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_socket_address_enumerator_next_async) void next_async(const Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncReady& slot); diff --git a/gio/src/socketclient.ccg b/gio/src/socketclient.ccg index 45da38b3..ff22b62e 100644 --- a/gio/src/socketclient.ccg +++ b/gio/src/socketclient.ccg @@ -131,61 +131,34 @@ SocketClient::connect_to_service_async(const Glib::ustring& domain, slot_copy); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketConnection> SocketClient::connect(const Glib::RefPtr<SocketConnectable>& connectable) -#else -Glib::RefPtr<SocketConnection> SocketClient::connect(const Glib::RefPtr<SocketConnectable>& connectable, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<SocketConnection> retvalue = Glib::wrap(g_socket_client_connect(gobj(), const_cast<GSocketConnectable*>(Glib::unwrap(connectable)), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketConnection> SocketClient::connect_to_host(const Glib::ustring& host_and_port, guint16 default_port) -#else -Glib::RefPtr<SocketConnection> SocketClient::connect_to_host(const Glib::ustring& host_and_port, guint16 default_port, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<SocketConnection> retvalue = Glib::wrap(g_socket_client_connect_to_host(gobj(), host_and_port.c_str(), default_port, 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketConnection> SocketClient::connect_to_service(const Glib::ustring& domain, const Glib::ustring& service) -#else -Glib::RefPtr<SocketConnection> SocketClient::connect_to_service(const Glib::ustring& domain, const Glib::ustring& service, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::RefPtr<SocketConnection> retvalue = Glib::wrap(g_socket_client_connect_to_service(gobj(), domain.c_str(), service.c_str(), 0, &(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; diff --git a/gio/src/socketclient.hg b/gio/src/socketclient.hg index 7021b615..764d42b8 100644 --- a/gio/src/socketclient.hg +++ b/gio/src/socketclient.hg @@ -70,25 +70,13 @@ _WRAP_METHOD(Glib::RefPtr<const SocketAddress> get_local_address() const, g_sock _WRAP_METHOD(void set_local_address(const Glib::RefPtr<SocketAddress>& address), g_socket_client_set_local_address) _WRAP_METHOD(Glib::RefPtr<SocketConnection> connect(const Glib::RefPtr<SocketConnectable>& connectable, const Glib::RefPtr<Cancellable>& cancellable), g_socket_client_connect, errthrow) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketConnection> connect(const Glib::RefPtr<SocketConnectable>& connectable); -#else -Glib::RefPtr<SocketConnection> connect(const Glib::RefPtr<SocketConnectable>& connectable, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(Glib::RefPtr<SocketConnection> connect_to_host(const Glib::ustring& host_and_port, guint16 default_port, const Glib::RefPtr<Cancellable>& cancellable), g_socket_client_connect_to_host, errthrow) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketConnection> connect_to_host(const Glib::ustring& host_and_port, guint16 default_port); -#else -Glib::RefPtr<SocketConnection> connect_to_host(const Glib::ustring& host_and_port, guint16 default_port, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(Glib::RefPtr<SocketConnection> connect_to_service(const Glib::ustring& domain, const Glib::ustring& service, const Glib::RefPtr<Cancellable>& cancellable), g_socket_client_connect_to_service, errthrow) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketConnection> connect_to_service(const Glib::ustring& domain, const Glib::ustring& service); -#else -Glib::RefPtr<SocketConnection> connect_to_service(const Glib::ustring& domain, const Glib::ustring& service, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_socket_client_connect_async) _WRAP_METHOD_DOCS_ONLY(g_socket_client_connect_async) diff --git a/gio/src/socketlistener.ccg b/gio/src/socketlistener.ccg index 580bbc28..134920f8 100644 --- a/gio/src/socketlistener.ccg +++ b/gio/src/socketlistener.ccg @@ -23,11 +23,7 @@ namespace Gio { -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool SocketListener::add_socket(const Glib::RefPtr<Socket>& socket) -#else -bool SocketListener::add_socket(const Glib::RefPtr<Socket>& socket, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retval; @@ -35,22 +31,13 @@ bool SocketListener::add_socket(const Glib::RefPtr<Socket>& socket, std::auto_pt Glib::unwrap(socket), 0, &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 retval; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool SocketListener::add_address(const Glib::RefPtr<SocketAddress>& address, SocketType type, SocketProtocol protocol, const Glib::RefPtr<Glib::Object>& source_object, Glib::RefPtr<SocketAddress>& effective_address) -#else -bool SocketListener::add_address(const Glib::RefPtr<SocketAddress>& address, SocketType type, SocketProtocol protocol, const Glib::RefPtr<Glib::Object>& source_object, Glib::RefPtr<SocketAddress>& effective_address, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retval; @@ -62,23 +49,14 @@ bool SocketListener::add_address(const Glib::RefPtr<SocketAddress>& address, Soc Glib::unwrap(source_object), &retaddr, &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 (retaddr) effective_address = Glib::wrap(retaddr); return retval; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool SocketListener::add_address(const Glib::RefPtr<SocketAddress>& address, SocketType type, SocketProtocol protocol, Glib::RefPtr<SocketAddress>& effective_address) -#else -bool SocketListener::add_address(const Glib::RefPtr<SocketAddress>& address, SocketType type, SocketProtocol protocol, Glib::RefPtr<SocketAddress>& effective_address, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retval; @@ -90,65 +68,38 @@ bool SocketListener::add_address(const Glib::RefPtr<SocketAddress>& address, Soc 0, &retaddr, &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 (retaddr) effective_address = Glib::wrap(retaddr); return retval; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool SocketListener::add_inet_port(guint16 port) -#else -bool SocketListener::add_inet_port(guint16 port, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_socket_listener_add_inet_port(gobj(), port, 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED guint16 SocketListener::add_any_inet_port() -#else -guint16 SocketListener::add_any_inet_port(std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; guint16 retvalue = g_socket_listener_add_any_inet_port(gobj(), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<Socket> SocketListener::accept_socket(Glib::RefPtr<Glib::Object>& source_object, const Glib::RefPtr<Cancellable>& cancellable) -#else -Glib::RefPtr<Socket> SocketListener::accept_socket(Glib::RefPtr<Glib::Object>& source_object, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; GObject *retobj; @@ -156,24 +107,15 @@ Glib::RefPtr<Socket> SocketListener::accept_socket(Glib::RefPtr<Glib::Object>& s &retobj, 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 (retobj) source_object = Glib::wrap(retobj); return Glib::wrap(retvalue); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<Socket> SocketListener::accept_socket(Glib::RefPtr<Glib::Object>& source_object) -#else -Glib::RefPtr<Socket> SocketListener::accept_socket(Glib::RefPtr<Glib::Object>& source_object, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; GObject *retobj; @@ -181,59 +123,36 @@ Glib::RefPtr<Socket> SocketListener::accept_socket(Glib::RefPtr<Glib::Object>& s &retobj, 0, &(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 (retobj) source_object = Glib::wrap(retobj); return Glib::wrap(retvalue); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<Socket> SocketListener::accept_socket(const Glib::RefPtr<Cancellable>& cancellable) -#else -Glib::RefPtr<Socket> SocketListener::accept_socket(const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; GSocket* retvalue = g_socket_listener_accept_socket(gobj(), 0, 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 return Glib::wrap(retvalue); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<Socket> SocketListener::accept_socket() -#else -Glib::RefPtr<Socket> SocketListener::accept_socket(std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; GSocket* retvalue = g_socket_listener_accept_socket(gobj(), 0, 0, &(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 Glib::wrap(retvalue); } @@ -265,11 +184,7 @@ void SocketListener::accept_socket_async(const SlotAsyncReady& slot) slot_copy); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<Socket> SocketListener::accept_socket_finish(const Glib::RefPtr<AsyncResult>& result, Glib::RefPtr<Glib::Object>& source_object) -#else -Glib::RefPtr<Socket> SocketListener::accept_socket_finish(const Glib::RefPtr<AsyncResult>& result, Glib::RefPtr<Glib::Object>& source_object, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; GObject *retobj = 0; @@ -277,47 +192,29 @@ Glib::RefPtr<Socket> SocketListener::accept_socket_finish(const Glib::RefPtr<Asy Glib::unwrap(result), &retobj, &(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 (retobj) source_object = Glib::wrap(retobj); return Glib::wrap(retvalue); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<Socket> SocketListener::accept_socket_finish(const Glib::RefPtr<AsyncResult>& result) -#else -Glib::RefPtr<Socket> SocketListener::accept_socket_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; GSocket* retvalue = g_socket_listener_accept_socket_finish(gobj(), Glib::unwrap(result), 0, &(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 Glib::wrap(retvalue); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketConnection> SocketListener::accept(Glib::RefPtr<Object>& source_object, const Glib::RefPtr<Cancellable>& cancellable) -#else -Glib::RefPtr<SocketConnection> SocketListener::accept(Glib::RefPtr<Object>& source_object, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; GObject *retobj = 0; @@ -325,24 +222,15 @@ Glib::RefPtr<SocketConnection> SocketListener::accept(Glib::RefPtr<Object>& sour &retobj, 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 (retobj) source_object = Glib::wrap(retobj); return Glib::wrap(retvalue); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketConnection> SocketListener::accept(Glib::RefPtr<Object>& source_object) -#else -Glib::RefPtr<SocketConnection> SocketListener::accept(Glib::RefPtr<Object>& source_object, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; GObject *retobj = 0; @@ -350,59 +238,36 @@ Glib::RefPtr<SocketConnection> SocketListener::accept(Glib::RefPtr<Object>& sour &retobj, 0, &(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 (retobj) source_object = Glib::wrap(retobj); return Glib::wrap(retvalue); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketConnection> SocketListener::accept(const Glib::RefPtr<Cancellable>& cancellable) -#else -Glib::RefPtr<SocketConnection> SocketListener::accept(const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; GSocketConnection* retvalue = g_socket_listener_accept(gobj(), 0, 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 return Glib::wrap(retvalue); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketConnection> SocketListener::accept() -#else -Glib::RefPtr<SocketConnection> SocketListener::accept(std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; GSocketConnection* retvalue = g_socket_listener_accept(gobj(), 0, 0, &(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 Glib::wrap(retvalue); } @@ -434,11 +299,7 @@ void SocketListener::accept_async(const Glib::RefPtr<Cancellable>& cancellable, slot_copy); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketConnection> SocketListener::accept_finish(const Glib::RefPtr<AsyncResult>& result, Glib::RefPtr<Glib::Object>& source_object) -#else -Glib::RefPtr<SocketConnection> SocketListener::accept_finish(const Glib::RefPtr<AsyncResult>& result, Glib::RefPtr<Glib::Object>& source_object, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; GObject *retobj = 0; @@ -446,37 +307,23 @@ Glib::RefPtr<SocketConnection> SocketListener::accept_finish(const Glib::RefPtr< Glib::unwrap(result), &retobj, &(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 (retobj) source_object = Glib::wrap(retobj); return Glib::wrap(retvalue); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketConnection> SocketListener::accept_finish(const Glib::RefPtr<AsyncResult>& result) -#else -Glib::RefPtr<SocketConnection> SocketListener::accept_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error) -#endif // GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; GSocketConnection* retvalue = g_socket_listener_accept_finish(gobj(), Glib::unwrap(result), 0, &(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 Glib::wrap(retvalue); } diff --git a/gio/src/socketlistener.hg b/gio/src/socketlistener.hg index bfb55b15..d55605d3 100644 --- a/gio/src/socketlistener.hg +++ b/gio/src/socketlistener.hg @@ -58,67 +58,31 @@ _WRAP_METHOD(void set_backlog(int listen_backlog), g_socket_listener_set_backlog _WRAP_METHOD(bool add_socket(const Glib::RefPtr<Socket>& socket, const Glib::RefPtr<Glib::Object>& source_object), g_socket_listener_add_socket, errthrow) _WRAP_METHOD_DOCS_ONLY(g_socket_listener_add_socket) -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool add_socket(const Glib::RefPtr<Socket>& socket); -#else -bool add_socket(const Glib::RefPtr<Socket>& socket, std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_socket_listener_add_address) _WRAP_METHOD_DOCS_ONLY(g_socket_listener_add_address) -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool add_address(const Glib::RefPtr<SocketAddress>& address, SocketType type, SocketProtocol protocol, const Glib::RefPtr<Glib::Object>& source_object, Glib::RefPtr<SocketAddress>& effective_address); -#else -bool add_address(const Glib::RefPtr<SocketAddress>& address, SocketType type, SocketProtocol protocol, const Glib::RefPtr<Glib::Object>& source_object, Glib::RefPtr<SocketAddress>& effective_address, std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD_DOCS_ONLY(g_socket_listener_add_address) -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool add_address(const Glib::RefPtr<SocketAddress>& address, SocketType type, SocketProtocol protocol, Glib::RefPtr<SocketAddress>& effective_address); -#else -bool add_address(const Glib::RefPtr<SocketAddress>& address, SocketType type, SocketProtocol protocol, Glib::RefPtr<SocketAddress>& effective_address, std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(bool add_inet_port(guint16 port, const Glib::RefPtr<Glib::Object>& source_object), g_socket_listener_add_inet_port, errthrow) _WRAP_METHOD_DOCS_ONLY(g_socket_listener_add_inet_port) -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool add_inet_port(guint16 port); -#else -bool add_inet_port(guint16 port, std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD(guint16 add_any_inet_port(const Glib::RefPtr<Glib::Object>& source_object), g_socket_listener_add_any_inet_port, errthrow) _WRAP_METHOD_DOCS_ONLY(g_socket_listener_add_any_inet_port) -#ifdef GLIBMM_EXCEPTIONS_ENABLED guint16 add_any_inet_port(); -#else -guint16 add_any_inet_port(std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_socket_listener_accept_socket) _WRAP_METHOD_DOCS_ONLY(g_socket_listener_accept_socket) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<Socket> accept_socket(Glib::RefPtr<Glib::Object>& source_object, const Glib::RefPtr<Cancellable>& cancellable); -#else -Glib::RefPtr<Socket> accept_socket(Glib::RefPtr<Glib::Object>& source_object, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD_DOCS_ONLY(g_socket_listener_accept_socket) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<Socket> accept_socket(Glib::RefPtr<Glib::Object>& source_object); -#else -Glib::RefPtr<Socket> accept_socket(Glib::RefPtr<Glib::Object>& source_object, std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD_DOCS_ONLY(g_socket_listener_accept_socket) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<Socket> accept_socket(const Glib::RefPtr<Cancellable>& cancellable); -#else -Glib::RefPtr<Socket> accept_socket(const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD_DOCS_ONLY(g_socket_listener_accept_socket) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<Socket> accept_socket(); -#else -Glib::RefPtr<Socket> accept_socket(std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_socket_listener_accept_socket_async) _WRAP_METHOD_DOCS_ONLY(g_socket_listener_accept_socket_async) @@ -128,43 +92,19 @@ void accept_socket_async(const SlotAsyncReady& slot); _IGNORE(g_socket_listener_accept_socket_finish) _WRAP_METHOD_DOCS_ONLY(g_socket_listener_accept_socket_finish) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<Socket> accept_socket_finish(const Glib::RefPtr<AsyncResult>& result, Glib::RefPtr<Glib::Object>& source_object); -#else -Glib::RefPtr<Socket> accept_socket_finish(const Glib::RefPtr<AsyncResult>& result, Glib::RefPtr<Glib::Object>& source_object, std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD_DOCS_ONLY(g_socket_listener_accept_socket_finish) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<Socket> accept_socket_finish(const Glib::RefPtr<AsyncResult>& result); -#else -Glib::RefPtr<Socket> accept_socket_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_socket_listener_accept) _WRAP_METHOD_DOCS_ONLY(g_socket_listener_accept) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketConnection> accept(Glib::RefPtr<Object>& source_object, const Glib::RefPtr<Cancellable>& cancellable); -#else -Glib::RefPtr<SocketConnection> accept(Glib::RefPtr<Object>& source_object, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD_DOCS_ONLY(g_socket_listener_accept) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketConnection> accept(Glib::RefPtr<Object>& source_object); -#else -Glib::RefPtr<SocketConnection> accept(Glib::RefPtr<Object>& source_object, std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD_DOCS_ONLY(g_socket_listener_accept) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketConnection> accept(const Glib::RefPtr<Cancellable>& cancellable); -#else -Glib::RefPtr<SocketConnection> accept(const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD_DOCS_ONLY(g_socket_listener_accept) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketConnection> accept(); -#else -Glib::RefPtr<SocketConnection> accept(std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD_DOCS_ONLY(g_socket_listener_accept_async) void accept_async(const SlotAsyncReady& slot); @@ -173,17 +113,9 @@ void accept_async(const Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncR _IGNORE(g_socket_listener_accept_async) _WRAP_METHOD_DOCS_ONLY(g_socket_listener_accept_finish) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketConnection> accept_finish(const Glib::RefPtr<AsyncResult>& result, Glib::RefPtr<Glib::Object>& source_object); -#else -Glib::RefPtr<SocketConnection> accept_finish(const Glib::RefPtr<AsyncResult>& result, Glib::RefPtr<Glib::Object>& source_object, std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD_DOCS_ONLY(g_socket_listener_accept_finish) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<SocketConnection> accept_finish(const Glib::RefPtr<AsyncResult>& result); -#else -Glib::RefPtr<SocketConnection> accept_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error); -#endif // GLIBMM_EXCEPTIONS_ENABLED _WRAP_METHOD (void close(), g_socket_listener_close) diff --git a/glib/glibmm/class.cc b/glib/glibmm/class.cc index af285170..4176aa46 100644 --- a/glib/glibmm/class.cc +++ b/glib/glibmm/class.cc @@ -127,11 +127,9 @@ void Class::custom_class_init_function(void* g_class, void* class_data) // the vfunc and default signal handler callbacks. (*self->class_init_func_)(g_class, 0); -#ifdef GLIBMM_PROPERTIES_ENABLED GObjectClass *const gobject_class = static_cast<GObjectClass*>(g_class); gobject_class->get_property = &Glib::custom_get_property_callback; gobject_class->set_property = &Glib::custom_set_property_callback; -#endif //GLIBMM_PROPERTIES_ENABLED } } // namespace Glib diff --git a/glib/glibmm/dispatcher.cc b/glib/glibmm/dispatcher.cc index a4f7fbb2..3a74591a 100644 --- a/glib/glibmm/dispatcher.cc +++ b/glib/glibmm/dispatcher.cc @@ -179,13 +179,7 @@ DispatchNotifier::DispatchNotifier(const Glib::RefPtr<MainContext>& context) { create_pipe(); -#if defined(GLIBMM_EXCEPTIONS_ENABLED) try -#elif defined(G_OS_WIN32) - if(fd_receiver_) -#else - if(fd_receiver_ >= 0) -#endif { #ifdef G_OS_WIN32 const int fd = GPOINTER_TO_INT(fd_receiver_); @@ -195,7 +189,6 @@ DispatchNotifier::DispatchNotifier(const Glib::RefPtr<MainContext>& context) context_->signal_io().connect(sigc::mem_fun(*this, &DispatchNotifier::pipe_io_handler), fd, Glib::IO_IN); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED catch(...) { # ifndef G_OS_WIN32 @@ -205,7 +198,6 @@ DispatchNotifier::DispatchNotifier(const Glib::RefPtr<MainContext>& context) throw; } -#endif /* GLIBMM_EXCEPTIONS_ENABLED */ } DispatchNotifier::~DispatchNotifier() @@ -227,15 +219,10 @@ void DispatchNotifier::create_pipe() if(!event) { -# ifdef GLIBMM_EXCEPTIONS_ENABLED GError* const error = g_error_new(G_FILE_ERROR, G_FILE_ERROR_FAILED, "Failed to create event for inter-thread communication: %s", g_win32_error_message(GetLastError())); throw Glib::FileError(error); -# else - warn_failed_pipe_io("CreateEvent"); // TODO: see below - return; -# endif } fd_receiver_ = event; @@ -246,19 +233,10 @@ void DispatchNotifier::create_pipe() if(pipe(filedes) < 0) { -# ifdef GLIBMM_EXCEPTIONS_ENABLED GError* const error = g_error_new(G_FILE_ERROR, g_file_error_from_errno(errno), "Failed to create pipe for inter-thread communication: %s", g_strerror(errno)); throw Glib::FileError(error); -# else - // TODO: Provide an alternative to the exception. This is not trivial - // from within a constructor, though. One possibility would be to add - // a Glib::Dispatcher::valid() method which returns whether construction - // was successful. - warn_failed_pipe_io("pipe"); - return; -# endif } fd_set_close_on_exec(filedes[0]); @@ -408,21 +386,17 @@ bool DispatchNotifier::pipe_io_handler(Glib::IOCondition) g_return_val_if_fail(data.notifier == this, true); -#ifdef GLIBMM_EXCEPTIONS_ENABLED // Actually, we wouldn't need the try/catch block because the Glib::Source // C callback already does it for us. However, we do it anyway because the // default return value is 'false', which is not what we want. try -#endif { data.dispatcher->signal_(); // emit } -#ifdef GLIBMM_EXCEPTIONS_ENABLED catch(...) { Glib::exception_handlers_invoke(); } -#endif return true; } diff --git a/glib/glibmm/error.cc b/glib/glibmm/error.cc index df5441b4..fe01cc6f 100644 --- a/glib/glibmm/error.cc +++ b/glib/glibmm/error.cc @@ -153,12 +153,8 @@ void Error::register_domain(GQuark domain, Error::ThrowFunc throw_func) (*throw_func_table)[domain] = throw_func; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED // static, noreturn void Error::throw_exception(GError* gobject) -#else -std::auto_ptr<Glib::Error> Error::throw_exception(GError* gobject) -#endif //GLIBMM_EXCEPTIONS_ENABLED { g_assert(gobject != 0); @@ -168,11 +164,7 @@ std::auto_ptr<Glib::Error> Error::throw_exception(GError* gobject) if(const ThrowFunc throw_func = (*throw_func_table)[gobject->domain]) { - #ifdef GLIBMM_EXCEPTIONS_ENABLED (*throw_func)(gobject); - #else - return (*throw_func)(gobject); - #endif //GLIBMM_EXCEPTIONS_ENABLED g_assert_not_reached(); } @@ -180,12 +172,8 @@ std::auto_ptr<Glib::Error> Error::throw_exception(GError* gobject) "unknown error domain '%s': throwing generic Glib::Error exception\n", (gobject->domain) ? g_quark_to_string(gobject->domain) : "(null)"); -#ifdef GLIBMM_EXCEPTIONS_ENABLED // Doesn't copy, because error-returning functions return a newly allocated GError for us. throw Glib::Error(gobject); -#else - return std::auto_ptr<Glib::Error>(new Glib::Error(gobject)); -#endif //GLIBMM_EXCEPTIONS_ENABLED } diff --git a/glib/glibmm/error.h b/glib/glibmm/error.h index fe7780d7..b68df859 100644 --- a/glib/glibmm/error.h +++ b/glib/glibmm/error.h @@ -23,10 +23,6 @@ #include <glibmm/exception.h> #include <glib.h> -#ifndef GLIBMM_EXCEPTIONS_ENABLED -//When not usinge exceptions, we pass auto_ptrs of the exceptions objects around instead. -#include <memory> //For std::auto_ptr -#endif namespace Glib @@ -57,22 +53,13 @@ public: void propagate(GError** dest); -#ifdef GLIBMM_EXCEPTIONS_ENABLED typedef void (* ThrowFunc) (GError*); -#else - //When not using exceptions, we just pass the Exception object around without throwing it: - typedef std::auto_ptr<Glib::Error> (* ThrowFunc) (GError*); -#endif //GLIBMM_EXCEPTIONS_ENABLED static void register_init(); static void register_cleanup(); static void register_domain(GQuark domain, ThrowFunc throw_func); -#ifdef GLIBMM_EXCEPTIONS_ENABLED static void throw_exception(GError* gobject) G_GNUC_NORETURN; -#else - static std::auto_ptr<Glib::Error> throw_exception(GError* gobject); -#endif //GLIBMM_EXCEPTIONS_ENABLED #endif /* DOXYGEN_SHOULD_SKIP_THIS */ diff --git a/glib/glibmm/exceptionhandler.cc b/glib/glibmm/exceptionhandler.cc index 493993d8..e9bec1a4 100644 --- a/glib/glibmm/exceptionhandler.cc +++ b/glib/glibmm/exceptionhandler.cc @@ -27,7 +27,6 @@ #include <exception> #include <list> -#ifdef GLIBMM_EXCEPTIONS_ENABLED namespace { @@ -153,6 +152,5 @@ void exception_handlers_invoke() throw() } // namespace Glib -#endif //GLIBMM_EXCEPTIONS_ENABLED diff --git a/glib/glibmm/exceptionhandler.h b/glib/glibmm/exceptionhandler.h index 9c23dbd8..8a483c86 100644 --- a/glib/glibmm/exceptionhandler.h +++ b/glib/glibmm/exceptionhandler.h @@ -24,7 +24,6 @@ #include <glibmmconfig.h> #include <sigc++/sigc++.h> -#ifdef GLIBMM_EXCEPTIONS_ENABLED namespace Glib { @@ -36,7 +35,6 @@ sigc::connection add_exception_handler(const sigc::slot<void>& slot); #ifndef DOXYGEN_SHOULD_SKIP_THIS // internal void exception_handlers_invoke() throw(); -#endif } // namespace Glib diff --git a/glib/glibmm/main.cc b/glib/glibmm/main.cc index 3e9047be..e1c9a8ab 100644 --- a/glib/glibmm/main.cc +++ b/glib/glibmm/main.cc @@ -184,19 +184,15 @@ static gboolean glibmm_source_callback(void* data) { SourceConnectionNode *const conn_data = static_cast<SourceConnectionNode*>(data); - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED // Recreate the specific slot from the generic slot node. return (*static_cast<sigc::slot<bool>*>(conn_data->get_slot()))(); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED return 0; } @@ -205,20 +201,16 @@ static gboolean glibmm_iosource_callback(GIOChannel*, GIOCondition condition, vo SourceCallbackData *const callback_data = static_cast<SourceCallbackData*>(data); g_return_val_if_fail(callback_data->node != 0, 0); - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED // Recreate the specific slot from the generic slot node. return (*static_cast<sigc::slot<bool, Glib::IOCondition>*>(callback_data->node->get_slot())) ((Glib::IOCondition) condition); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED return 0; } @@ -230,18 +222,14 @@ static gboolean glibmm_child_watch_callback(GPid pid, gint child_status, void* d { SourceConnectionNode *const conn_data = static_cast<SourceConnectionNode*>(data); - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED //Recreate the specific slot from the generic slot node. (*static_cast<sigc::slot<void, GPid, int>*>(conn_data->get_slot()))(pid, child_status); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED return 0; } @@ -853,19 +841,15 @@ Source* Source::get_wrapper(GSource* source) // static gboolean Source::prepare_vfunc(GSource* source, int* timeout) { - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED Source *const self = get_wrapper(source); return self->prepare(*timeout); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED return 0; } @@ -873,19 +857,15 @@ gboolean Source::prepare_vfunc(GSource* source, int* timeout) // static gboolean Source::check_vfunc(GSource* source) { - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED Source *const self = get_wrapper(source); return self->check(); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED return 0; } @@ -898,19 +878,15 @@ gboolean Source::dispatch_vfunc(GSource*, GSourceFunc callback, void* user_data) g_return_val_if_fail(callback == &glibmm_dummy_source_callback, 0); g_return_val_if_fail(callback_data != 0 && callback_data->node != 0, 0); - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED Source *const self = callback_data->wrapper; return self->dispatch(callback_data->node->get_slot()); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED return 0; } diff --git a/glib/glibmm/property.cc b/glib/glibmm/property.cc index 48fdb021..afb92b01 100644 --- a/glib/glibmm/property.cc +++ b/glib/glibmm/property.cc @@ -20,7 +20,6 @@ #include <glibmm/property.h> -#ifdef GLIBMM_PROPERTIES_ENABLED #include <glibmm/object.h> #include <cstddef> @@ -199,5 +198,4 @@ void PropertyBase::notify() } // namespace Glib -#endif //GLIBMM_PROPERTIES_ENABLED diff --git a/glib/glibmm/property.h b/glib/glibmm/property.h index 3252d411..b3220b69 100644 --- a/glib/glibmm/property.h +++ b/glib/glibmm/property.h @@ -22,7 +22,6 @@ #include <glibmmconfig.h> #include <glibmm/propertyproxy.h> -#ifdef GLIBMM_PROPERTIES_ENABLED #include <glibmm/value.h> @@ -168,7 +167,6 @@ Glib::PropertyProxy<T> Property<T>::get_proxy() } // namespace Glib -#endif //GLIBMM_PROPERTIES_ENABLED #endif /* _GLIBMM_PROPERTY_H */ diff --git a/glib/glibmm/propertyproxy.h b/glib/glibmm/propertyproxy.h index c563c1fb..98093bec 100644 --- a/glib/glibmm/propertyproxy.h +++ b/glib/glibmm/propertyproxy.h @@ -24,7 +24,6 @@ #include <glibmmconfig.h> #include <glibmm/propertyproxy_base.h> -#ifdef GLIBMM_PROPERTIES_ENABLED namespace Glib { @@ -180,7 +179,6 @@ T PropertyProxy_ReadOnly<T>::get_value() const } // namespace Glib -#endif //GLIBMM_PROPERTIES_ENABLED #endif /* _GLIBMM_PROPERTYPROXY_H */ diff --git a/glib/glibmm/propertyproxy_base.cc b/glib/glibmm/propertyproxy_base.cc index 46b6f049..0f1fac8e 100644 --- a/glib/glibmm/propertyproxy_base.cc +++ b/glib/glibmm/propertyproxy_base.cc @@ -44,7 +44,6 @@ void PropertyProxyConnectionNode::callback(GObject*, GParamSpec* pspec, gpointer } } -#ifdef GLIBMM_PROPERTIES_ENABLED //SignalProxyProperty implementation: @@ -125,7 +124,6 @@ void PropertyProxy_Base::reset_property_() g_object_set_property(obj_->gobj(), property_name_, value.gobj()); } -#endif //GLIBMM_PROPERTIES_ENABLED } // namespace Glib diff --git a/glib/glibmm/propertyproxy_base.h b/glib/glibmm/propertyproxy_base.h index fcd40778..b9335905 100644 --- a/glib/glibmm/propertyproxy_base.h +++ b/glib/glibmm/propertyproxy_base.h @@ -28,7 +28,6 @@ namespace Glib { -#ifdef GLIBMM_PROPERTIES_ENABLED class ObjectBase; @@ -79,7 +78,6 @@ private: PropertyProxy_Base& operator=(const PropertyProxy_Base&); }; -#endif //GLIBMM_PROPERTIES_ENABLED #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/glib/glibmm/signalproxy.cc b/glib/glibmm/signalproxy.cc index 34be6401..e218ba9a 100644 --- a/glib/glibmm/signalproxy.cc +++ b/glib/glibmm/signalproxy.cc @@ -89,19 +89,15 @@ void SignalProxyNormal::slot0_void_callback(GObject* self, void* data) // Do not try to call a signal on a disassociated wrapper. if(Glib::ObjectBase::_get_current_wrapper(self)) { - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED if(sigc::slot_base *const slot = data_to_slot(data)) (*static_cast<sigc::slot<void>*>(slot))(); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED } } diff --git a/glib/glibmm/streamiochannel.cc b/glib/glibmm/streamiochannel.cc index fce34560..53228b01 100644 --- a/glib/glibmm/streamiochannel.cc +++ b/glib/glibmm/streamiochannel.cc @@ -67,11 +67,7 @@ IOStatus StreamIOChannel::read_vfunc(char* buf, gsize count, gsize& bytes_read) if(stream_in_->fail()) { - #ifdef GLIBMM_EXCEPTIONS_ENABLED throw Glib::Error(G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_FAILED, "Reading from stream failed"); - #else - return IO_STATUS_ERROR; - #endif //GLIBMM_EXCEPTIONS_ENABLED } return IO_STATUS_NORMAL; @@ -88,11 +84,7 @@ IOStatus StreamIOChannel::write_vfunc(const char* buf, gsize count, gsize& bytes if(stream_out_->fail()) { - #ifdef GLIBMM_EXCEPTIONS_ENABLED throw Glib::Error(G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_FAILED, "Writing to stream failed"); - #else - return IO_STATUS_ERROR; - #endif //GLIBMM_EXCEPTIONS_ENABLED } bytes_written = count; // all or nothing ;) @@ -128,11 +120,7 @@ IOStatus StreamIOChannel::seek_vfunc(gint64 offset, SeekType type) if(failed) { - #ifdef GLIBMM_EXCEPTIONS_ENABLED throw Glib::Error(G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_FAILED, "Seeking into stream failed"); - #else - return IO_STATUS_ERROR; - #endif //GLIBMM_EXCEPTIONS_ENABLED } return Glib::IO_STATUS_NORMAL; @@ -162,21 +150,13 @@ IOStatus StreamIOChannel::close_vfunc() } else { - #ifdef GLIBMM_EXCEPTIONS_ENABLED throw Glib::Error(G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_FAILED, "Attempt to close non-file stream"); - #else - return IO_STATUS_ERROR; - #endif //GLIBMM_EXCEPTIONS_ENABLED } if(failed) { - #ifdef GLIBMM_EXCEPTIONS_ENABLED throw Glib::Error(G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_FAILED, "Failed to close stream"); - #else - return IO_STATUS_ERROR; - #endif //GLIBMM_EXCEPTIONS_ENABLED } return IO_STATUS_NORMAL; diff --git a/glib/glibmm/stringutils.cc b/glib/glibmm/stringutils.cc index 6cb781e5..1d786675 100644 --- a/glib/glibmm/stringutils.cc +++ b/glib/glibmm/stringutils.cc @@ -47,11 +47,7 @@ double Glib::Ascii::strtod(const std::string& str, { if(start_index > str.size()) { - #ifdef GLIBMM_EXCEPTIONS_ENABLED throw std::out_of_range("out of range (strtod): start_index > str.size()"); - #else - return 0; - #endif //GLIBMM_EXCEPTIONS_ENABLED } const char *const bufptr = str.c_str(); @@ -64,7 +60,6 @@ double Glib::Ascii::strtod(const std::string& str, { g_return_val_if_fail(err_no == ERANGE, result); - #ifdef GLIBMM_EXCEPTIONS_ENABLED //Interpret the result in the event of an error: if(result > 0.0) throw std::overflow_error("overflow (strtod): positive number too large"); @@ -73,9 +68,6 @@ double Glib::Ascii::strtod(const std::string& str, throw std::overflow_error("overflow (strtod): negative number too large"); throw std::underflow_error("underflow (strtod): number too small"); - #else - return result; - #endif // GLIBMM_EXCEPTIONS_ENABLED } if(endptr) diff --git a/glib/glibmm/threadpool.cc b/glib/glibmm/threadpool.cc index 82ff7750..acab296e 100644 --- a/glib/glibmm/threadpool.cc +++ b/glib/glibmm/threadpool.cc @@ -96,17 +96,14 @@ namespace static void call_thread_entry_slot(void* data, void* user_data) { - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED Glib::ThreadPool::SlotList *const slot_list = static_cast<Glib::ThreadPool::SlotList*>(user_data); sigc::slot<void> slot (slot_list->pop(static_cast<sigc::slot<void>*>(data))); slot(); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(Glib::Thread::Exit&) { @@ -117,7 +114,6 @@ static void call_thread_entry_slot(void* data, void* user_data) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED } } // anonymous namespace diff --git a/glib/glibmm/ustring.cc b/glib/glibmm/ustring.cc index c872439d..eb70b733 100644 --- a/glib/glibmm/ustring.cc +++ b/glib/glibmm/ustring.cc @@ -27,9 +27,7 @@ #include <algorithm> #include <iostream> #include <cstring> -#ifdef GLIBMM_EXCEPTIONS_ENABLED # include <stdexcept> -#endif #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -1284,22 +1282,11 @@ ustring ustring::FormatStream::to_string() const "UTF-8", "WCHAR_T", 0, &n_bytes, &error)); # endif /* !(__STDC_ISO_10646__ || G_OS_WIN32) */ -#else /* !GLIBMM_HAVE_WIDE_STREAM */ - const std::string str = stream_.str(); - - gsize n_bytes = 0; - const ScopedPtr<char> buf (g_locale_to_utf8(str.data(), str.size(), 0, &n_bytes, &error)); -#endif /* !GLIBMM_HAVE_WIDE_STREAM */ +#endif //GLIBMM_EXCEPTIONS_ENABLED if (error) { -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::Error::throw_exception(error); -#else - g_warning("%s: %s", G_STRFUNC, error->message); - g_error_free(error); - return ustring(); -#endif } return ustring(buf.get(), buf.get() + n_bytes); @@ -1318,13 +1305,7 @@ std::istream& operator>>(std::istream& is, Glib::ustring& utf8_string) if (error) { -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::Error::throw_exception(error); -#else - g_warning("%s: %s", G_STRFUNC, error->message); - g_error_free(error); - return is; -#endif } utf8_string.assign(buf.get(), buf.get() + n_bytes); @@ -1339,13 +1320,7 @@ std::ostream& operator<<(std::ostream& os, const Glib::ustring& utf8_string) utf8_string.raw().size(), 0, 0, &error)); if (error) { -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::Error::throw_exception(error); -#else - g_warning("%s: %s", G_STRFUNC, error->message); - g_error_free(error); - return os; -#endif } // This won't work if the string contains NUL characters. Unfortunately, @@ -1379,22 +1354,11 @@ std::wistream& operator>>(std::wistream& is, ustring& utf8_string) glong n_bytes = 0; const ScopedPtr<char> buf (g_utf16_to_utf8(reinterpret_cast<const gunichar2*>(wstr.data()), wstr.size(), 0, &n_bytes, &error)); -#else - gsize n_bytes = 0; - const ScopedPtr<char> buf (g_convert(reinterpret_cast<const char*>(wstr.data()), - wstr.size() * sizeof(std::wstring::value_type), - "UTF-8", "WCHAR_T", 0, &n_bytes, &error)); -#endif /* !(__STDC_ISO_10646__ || G_OS_WIN32) */ +#endif //GLIBMM_EXCEPTIONS_ENABLED if (error) { -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::Error::throw_exception(error); -#else - g_warning("%s: %s", G_STRFUNC, error->message); - g_error_free(error); - return is; -#endif } utf8_string.assign(buf.get(), buf.get() + n_bytes); @@ -1414,23 +1378,11 @@ std::wostream& operator<<(std::wostream& os, const ustring& utf8_string) // Avoid going through iconv if wchar_t always contains UTF-16. const ScopedPtr<gunichar2> buf (g_utf8_to_utf16(utf8_string.raw().data(), utf8_string.raw().size(), 0, 0, &error)); -#else - // TODO: For some reason the conversion from UTF-8 to WCHAR_T doesn't work - // with g_convert(), while iconv on the command line handles it just fine. - // Maybe a bug in GLib? - const ScopedPtr<char> buf (g_convert(utf8_string.raw().data(), utf8_string.raw().size(), - "WCHAR_T", "UTF-8", 0, 0, &error)); -#endif /* !(__STDC_ISO_10646__ || G_OS_WIN32) */ +#endif //GLIBMM_EXCEPTIONS_ENABLED if (error) { -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::Error::throw_exception(error); -#else - g_warning("%s: %s", G_STRFUNC, error->message); - g_error_free(error); - return os; -#endif } // This won't work if the string contains NUL characters. Unfortunately, diff --git a/glib/glibmmconfig.h.in b/glib/glibmmconfig.h.in index 65b34322..c66e12c5 100644 --- a/glib/glibmmconfig.h.in +++ b/glib/glibmmconfig.h.in @@ -38,14 +38,13 @@ /* Defined when the --enable-debug-refcounting configure argument was given */ #undef GLIBMM_DEBUG_REFCOUNTING -/* Defined when the --enable-api-default-signal-handlers configure argument - was given */ +/* This is always set. This is only for backwards compatibility. */ #undef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED /* Define to omit deprecated API from the library. */ #undef GLIBMM_DISABLE_DEPRECATED -/* Defined when the --enable-api-exceptions configure argument was given */ +/* This is always set. This is only for backwards compatibility. */ #undef GLIBMM_EXCEPTIONS_ENABLED /* Defined if a static member variable may be initialized inline to @@ -87,14 +86,12 @@ /* Minor version number of glibmm. */ #undef GLIBMM_MINOR_VERSION -/* Defined when the --enable-api-properties configure argument was given */ +/* This is always set. This is only for backwards compatibility. */ #undef GLIBMM_PROPERTIES_ENABLED /* Define if glibmm is built as a static library */ #undef GLIBMM_STATIC_LIB -/* Defined when the --enable-api-vfuncs configure argument was given */ -#undef GLIBMM_VFUNCS_ENABLED #endif /* GLIBMM_CONFIGURE */ diff --git a/glib/src/convert.ccg b/glib/src/convert.ccg index cc3b76d8..567ded08 100644 --- a/glib/src/convert.ccg +++ b/glib/src/convert.ccg @@ -46,9 +46,7 @@ IConv::IConv(const std::string& to_codeset, const std::string& from_codeset) // If this should ever fail we're fucked. g_assert(gerror != 0); - #ifdef GLIBMM_EXCEPTIONS_ENABLED if(gerror) ::Glib::Error::throw_exception(gerror); - #endif //GLIBMM_EXCEPTIONS_ENABLED } } @@ -80,11 +78,7 @@ void IConv::reset() g_iconv(gobject_, 0, &inbytes_left, &outbuf, &outbytes_left); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED std::string IConv::convert(const std::string& str) -#else -std::string IConv::convert(const std::string& str, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { gsize bytes_written = 0; GError* gerror = 0; @@ -92,11 +86,7 @@ std::string IConv::convert(const std::string& str, std::auto_ptr<Glib::Error>& e char *const buf = g_convert_with_iconv( str.data(), str.size(), gobject_, 0, &bytes_written, &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 std::string(ScopedPtr<char>(buf).get(), bytes_written); } @@ -119,15 +109,9 @@ bool get_charset(std::string& charset) } -#ifdef GLIBMM_EXCEPTIONS_ENABLED std::string convert(const std::string& str, const std::string& to_codeset, const std::string& from_codeset) -#else -std::string convert(const std::string& str, - const std::string& to_codeset, - const std::string& from_codeset, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { gsize bytes_written = 0; GError* gerror = 0; @@ -136,25 +120,15 @@ std::string convert(const std::string& str, str.data(), str.size(), to_codeset.c_str(), from_codeset.c_str(), 0, &bytes_written, &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 std::string(ScopedPtr<char>(buf).get(), bytes_written); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED std::string convert_with_fallback(const std::string& str, const std::string& to_codeset, const std::string& from_codeset) -#else -std::string convert_with_fallback(const std::string& str, - const std::string& to_codeset, - const std::string& from_codeset, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { gsize bytes_written = 0; GError* gerror = 0; @@ -163,27 +137,16 @@ std::string convert_with_fallback(const std::string& str, str.data(), str.size(), to_codeset.c_str(), from_codeset.c_str(), 0, 0, &bytes_written, &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 std::string(ScopedPtr<char>(buf).get(), bytes_written); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED std::string convert_with_fallback(const std::string& str, const std::string& to_codeset, const std::string& from_codeset, const Glib::ustring& fallback) -#else -std::string convert_with_fallback(const std::string& str, - const std::string& to_codeset, - const std::string& from_codeset, - const Glib::ustring& fallback, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { gsize bytes_written = 0; GError* gerror = 0; @@ -192,21 +155,13 @@ std::string convert_with_fallback(const std::string& str, str.data(), str.size(), to_codeset.c_str(), from_codeset.c_str(), const_cast<char*>(fallback.c_str()), 0, &bytes_written, &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 std::string(ScopedPtr<char>(buf).get(), bytes_written); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring locale_to_utf8(const std::string& opsys_string) -#else -Glib::ustring locale_to_utf8(const std::string& opsys_string, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { gsize bytes_written = 0; GError* gerror = 0; @@ -214,22 +169,14 @@ Glib::ustring locale_to_utf8(const std::string& opsys_string, std::auto_ptr<Glib char *const buf = g_locale_to_utf8( opsys_string.data(), opsys_string.size(), 0, &bytes_written, &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 const ScopedPtr<char> scoped_buf (buf); return Glib::ustring(scoped_buf.get(), scoped_buf.get() + bytes_written); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED std::string locale_from_utf8(const Glib::ustring& utf8_string) -#else -std::string locale_from_utf8(const Glib::ustring& utf8_string, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { gsize bytes_written = 0; GError* gerror = 0; @@ -237,21 +184,13 @@ std::string locale_from_utf8(const Glib::ustring& utf8_string, std::auto_ptr<Gli char *const buf = g_locale_from_utf8( utf8_string.data(), utf8_string.bytes(), 0, &bytes_written, &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 std::string(ScopedPtr<char>(buf).get(), bytes_written); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring filename_to_utf8(const std::string& opsys_string) -#else -Glib::ustring filename_to_utf8(const std::string& opsys_string, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { gsize bytes_written = 0; GError* gerror = 0; @@ -259,22 +198,14 @@ Glib::ustring filename_to_utf8(const std::string& opsys_string, std::auto_ptr<Gl char *const buf = g_filename_to_utf8( opsys_string.data(), opsys_string.size(), 0, &bytes_written, &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 const ScopedPtr<char> scoped_buf (buf); return Glib::ustring(scoped_buf.get(), scoped_buf.get() + bytes_written); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED std::string filename_from_utf8(const Glib::ustring& utf8_string) -#else -std::string filename_from_utf8(const Glib::ustring& utf8_string, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { gsize bytes_written = 0; GError* gerror = 0; @@ -282,32 +213,20 @@ std::string filename_from_utf8(const Glib::ustring& utf8_string, std::auto_ptr<G char *const buf = g_filename_from_utf8( utf8_string.data(), utf8_string.bytes(), 0, &bytes_written, &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 std::string(ScopedPtr<char>(buf).get(), bytes_written); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED std::string filename_from_uri(const Glib::ustring& uri, Glib::ustring& hostname) -#else -std::string filename_from_uri(const Glib::ustring& uri, Glib::ustring& hostname, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { char* hostname_buf = 0; GError* gerror = 0; char *const buf = g_filename_from_uri(uri.c_str(), &hostname_buf, &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 // Let's take ownership at this point. const ScopedPtr<char> scoped_buf (buf); @@ -321,58 +240,34 @@ std::string filename_from_uri(const Glib::ustring& uri, Glib::ustring& hostname, } -#ifdef GLIBMM_EXCEPTIONS_ENABLED std::string filename_from_uri(const Glib::ustring& uri) -#else -std::string filename_from_uri(const Glib::ustring& uri, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; char *const buf = g_filename_from_uri(uri.c_str(), 0, &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 std::string(ScopedPtr<char>(buf).get()); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring filename_to_uri(const std::string& filename, const Glib::ustring& hostname) -#else -Glib::ustring filename_to_uri(const std::string& filename, const Glib::ustring& hostname, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; char *const buf = g_filename_to_uri(filename.c_str(), hostname.c_str(), &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 Glib::ustring(ScopedPtr<char>(buf).get()); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring filename_to_uri(const std::string& filename) -#else -Glib::ustring filename_to_uri(const std::string& filename, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; char *const buf = g_filename_to_uri(filename.c_str(), 0, &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 Glib::ustring(ScopedPtr<char>(buf).get()); } diff --git a/glib/src/convert.hg b/glib/src/convert.hg index 0e4333a2..3031604a 100644 --- a/glib/src/convert.hg +++ b/glib/src/convert.hg @@ -93,11 +93,7 @@ public: * @return The converted string. * @throw Glib::ConvertError */ - #ifdef GLIBMM_EXCEPTIONS_ENABLED std::string convert(const std::string& str); - #else - std::string convert(const std::string& str, std::auto_ptr<Glib::Error>& error); - #endif //GLIBMM_EXCEPTIONS_ENABLED GIConv gobj() { return gobject_; } @@ -128,15 +124,9 @@ bool get_charset(std::string& charset); * @return The converted string. * @throw Glib::ConvertError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED std::string convert(const std::string& str, const std::string& to_codeset, const std::string& from_codeset); -#else -std::string convert(const std::string& str, - const std::string& to_codeset, - const std::string& from_codeset, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Converts a string from one character set to another, possibly including * fallback sequences for characters not representable in the output. @@ -148,15 +138,9 @@ std::string convert(const std::string& str, * @return The converted string. * @throw Glib::ConvertError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED std::string convert_with_fallback(const std::string& str, const std::string& to_codeset, const std::string& from_codeset); -#else -std::string convert_with_fallback(const std::string& str, - const std::string& to_codeset, - const std::string& from_codeset, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Converts a string from one character set to another, possibly including * fallback sequences for characters not representable in the output. @@ -174,17 +158,10 @@ std::string convert_with_fallback(const std::string& str, * @return The converted string. * @throw Glib::ConvertError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED std::string convert_with_fallback(const std::string& str, const std::string& to_codeset, const std::string& from_codeset, const Glib::ustring& fallback); -#else -std::string convert_with_fallback(const std::string& str, - const std::string& to_codeset, - const std::string& from_codeset, - const Glib::ustring& fallback, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Convert from the current locale's encoding to UTF-8. * Convenience wrapper around Glib::convert(). @@ -193,11 +170,7 @@ std::string convert_with_fallback(const std::string& str, * @return The input string converted to UTF-8 encoding. * @throw Glib::ConvertError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring locale_to_utf8(const std::string& opsys_string); -#else -Glib::ustring locale_to_utf8(const std::string& opsys_string, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Convert from UTF-8 to the current locale's encoding. * Convenience wrapper around Glib::convert(). @@ -206,11 +179,7 @@ Glib::ustring locale_to_utf8(const std::string& opsys_string, std::auto_ptr<Glib * system's current locale. * @throw Glib::ConvertError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED std::string locale_from_utf8(const Glib::ustring& utf8_string); -#else -std::string locale_from_utf8(const Glib::ustring& utf8_string, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Converts a string which is in the encoding used for filenames into * a UTF-8 string. @@ -218,22 +187,14 @@ std::string locale_from_utf8(const Glib::ustring& utf8_string, std::auto_ptr<Gli * @return The converted string. * @throw Glib::ConvertError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring filename_to_utf8(const std::string& opsys_string); -#else -Glib::ustring filename_to_utf8(const std::string& opsys_string, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Converts a string from UTF-8 to the encoding used for filenames. * @param utf8_string A UTF-8 encoded string. * @return The converted string. * @throw Glib::ConvertError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED std::string filename_from_utf8(const Glib::ustring& utf8_string); -#else -std::string filename_from_utf8(const Glib::ustring& utf8_string, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Converts an escaped UTF-8 encoded URI to a local filename * in the encoding used for filenames. @@ -243,11 +204,7 @@ std::string filename_from_utf8(const Glib::ustring& utf8_string, std::auto_ptr<G * @return The resulting filename. * @throw Glib::ConvertError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED std::string filename_from_uri(const Glib::ustring& uri, Glib::ustring& hostname); -#else -std::string filename_from_uri(const Glib::ustring& uri, Glib::ustring& hostname, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Converts an escaped UTF-8 encoded URI to a local filename in the encoding * used for filenames. @@ -255,11 +212,7 @@ std::string filename_from_uri(const Glib::ustring& uri, Glib::ustring& hostname, * @return The resulting filename. * @throw Glib::ConvertError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED std::string filename_from_uri(const Glib::ustring& uri); -#else -std::string filename_from_uri(const Glib::ustring& uri, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Converts an absolute filename to an escaped UTF-8 encoded URI. * @param filename An absolute filename specified in the encoding used @@ -268,11 +221,7 @@ std::string filename_from_uri(const Glib::ustring& uri, std::auto_ptr<Glib::Erro * @return The resulting URI. * @throw Glib::ConvertError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring filename_to_uri(const std::string& filename, const Glib::ustring& hostname); -#else -Glib::ustring filename_to_uri(const std::string& filename, const Glib::ustring& hostname, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Converts an absolute filename to an escaped UTF-8 encoded URI. * @param filename An absolute filename specified in the encoding used @@ -280,11 +229,7 @@ Glib::ustring filename_to_uri(const std::string& filename, const Glib::ustring& * @return The resulting URI. * @throw Glib::ConvertError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring filename_to_uri(const std::string& filename); -#else -Glib::ustring filename_to_uri(const std::string& filename, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Returns the display basename for the particular filename, guaranteed * to be valid UTF-8. The display name might not be identical to the filename, diff --git a/glib/src/date.ccg b/glib/src/date.ccg index 84e2f9a6..75ff1442 100644 --- a/glib/src/date.ccg +++ b/glib/src/date.ccg @@ -306,12 +306,7 @@ Glib::ustring Date::format_string(const Glib::ustring& format) const struct tm tm_data; g_date_to_struct_tm(&gobject_, &tm_data); - #ifdef GLIBMM_EXCEPTIONS_ENABLED const std::string locale_format = locale_from_utf8(format); - #else - std::auto_ptr<Glib::Error> error; //TODO: Check it? - const std::string locale_format = locale_from_utf8(format, error); - #endif //GLIBMM_EXCEPTIONS_ENABLED gsize bufsize = std::max<gsize>(2 * locale_format.size(), 128); @@ -327,12 +322,7 @@ Glib::ustring Date::format_string(const Glib::ustring& format) const if(len != 0 || buf.get()[0] == '\0') { g_assert(len < bufsize); - #ifdef GLIBMM_EXCEPTIONS_ENABLED return locale_to_utf8(std::string(buf.get(), len)); - #else - std::auto_ptr<Glib::Error> error; //TODO: Check it? - return locale_to_utf8(std::string(buf.get(), len), error); - #endif //GLIBMM_EXCEPTIONS_ENABLED } } while((bufsize *= 2) <= 65536); diff --git a/glib/src/glib_functions.defs b/glib/src/glib_functions.defs index 97678760..8287b31f 100644 --- a/glib/src/glib_functions.defs +++ b/glib/src/glib_functions.defs @@ -9648,7 +9648,7 @@ (return-type "none") (parameters '("const-char*" "testpath") - '("void-(*" "test_func") + '("somefunc" "test_func") ) ) @@ -9658,7 +9658,7 @@ (parameters '("const-char*" "testpath") '("gconstpointer" "test_data") - '("void-(*" "test_func") + '("somefunc" "test_func") ) ) @@ -9773,7 +9773,7 @@ '("const-char*" "test_name") '("gsize" "data_size") '("gconstpointer" "test_data") - '("void-(*" "data_setup") + '("somefunc" "data_setup") ) ) @@ -9906,7 +9906,7 @@ '("const-char*" "testpath") '("gsize" "data_size") '("gconstpointer" "test_data") - '("void-(*" "data_setup") + '("somefunc" "data_setup") ) ) @@ -11303,22 +11303,6 @@ (return-type "gchar**") ) -(define-function g_atexit - (c-name "g_atexit") - (return-type "none") - (parameters - '("GVoidFunc" "func") - ) -) - -(define-function atexit - (c-name "atexit") - (return-type "int") - (parameters - '("void" "(*") - ) -) - (define-function g_find_program_in_path (c-name "g_find_program_in_path") (return-type "gchar*") diff --git a/glib/src/iochannel.ccg b/glib/src/iochannel.ccg index cbeeb354..d8009392 100644 --- a/glib/src/iochannel.ccg +++ b/glib/src/iochannel.ccg @@ -170,22 +170,14 @@ IOChannel::~IOChannel() } } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<IOChannel> IOChannel::create_from_file(const std::string& filename, const std::string& mode) -#else -Glib::RefPtr<IOChannel> IOChannel::create_from_file(const std::string& filename, const std::string& mode, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; GIOChannel *const channel = g_io_channel_new_file(filename.c_str(), mode.c_str(), &gerror); if(gerror) { - #ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::Error::throw_exception(gerror); - #else - error = Glib::Error::throw_exception(gerror); - #endif //GLIBMM_EXCEPTIONS_ENABLED } return Glib::wrap(channel, false); @@ -210,25 +202,13 @@ Glib::RefPtr<IOChannel> IOChannel::create_from_win32_socket(int socket) #endif /* G_OS_WIN32 */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED IOStatus IOChannel::write(const Glib::ustring& str) -#else -IOStatus IOChannel::write(const Glib::ustring& str, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { gsize bytes_written = 0; -#ifdef GLIBMM_EXCEPTIONS_ENABLED return write(str.data(), str.bytes(), bytes_written); -#else - return write(str.data(), str.bytes(), bytes_written, error); -#endif //GLIBMM_EXCEPTIONS_ENABLED } -#ifdef GLIBMM_EXCEPTIONS_ENABLED IOStatus IOChannel::read_line(Glib::ustring& line) -#else -IOStatus IOChannel::read_line(Glib::ustring& line, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { Glib::ScopedPtr<char> buf; GError* gerror = 0; @@ -238,11 +218,7 @@ IOStatus IOChannel::read_line(Glib::ustring& line, std::auto_ptr<Glib::Error>& e if(gerror) { - #ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::Error::throw_exception(gerror); - #else - error = Glib::Error::throw_exception(gerror); - #endif //GLIBMM_EXCEPTIONS_ENABLED } if(buf.get()) @@ -253,11 +229,7 @@ IOStatus IOChannel::read_line(Glib::ustring& line, std::auto_ptr<Glib::Error>& e return (IOStatus) status; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED IOStatus IOChannel::read_to_end(Glib::ustring& str) -#else -IOStatus IOChannel::read_to_end(Glib::ustring& str, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { Glib::ScopedPtr<char> buf; GError* gerror = 0; @@ -267,11 +239,7 @@ IOStatus IOChannel::read_to_end(Glib::ustring& str, std::auto_ptr<Glib::Error>& if(gerror) { - #ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::Error::throw_exception(gerror); - #else - error = Glib::Error::throw_exception(gerror); - #endif //GLIBMM_EXCEPTIONS_ENABLED } if(buf.get()) @@ -282,11 +250,7 @@ IOStatus IOChannel::read_to_end(Glib::ustring& str, std::auto_ptr<Glib::Error>& return (IOStatus) status; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED IOStatus IOChannel::read(Glib::ustring& str, gsize count) -#else -IOStatus IOChannel::read(Glib::ustring& str, gsize count, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { Glib::ScopedPtr<char> buf (g_new(char, count)); GError* gerror = 0; @@ -296,11 +260,7 @@ IOStatus IOChannel::read(Glib::ustring& str, gsize count, std::auto_ptr<Glib::Er if(gerror) { - #ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::Error::throw_exception(gerror); - #else - error = Glib::Error::throw_exception(gerror); - #endif //GLIBMM_EXCEPTIONS_ENABLED } if(buf.get()) @@ -311,11 +271,7 @@ IOStatus IOChannel::read(Glib::ustring& str, gsize count, std::auto_ptr<Glib::Er return (IOStatus) status; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED IOStatus IOChannel::set_encoding(const std::string& encoding) -#else -IOStatus IOChannel::set_encoding(const std::string& encoding, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; @@ -324,11 +280,7 @@ IOStatus IOChannel::set_encoding(const std::string& encoding, std::auto_ptr<Glib if(gerror) { - #ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::Error::throw_exception(gerror); - #else - error = Glib::Error::throw_exception(gerror); - #endif //GLIBMM_EXCEPTIONS_ENABLED } return (IOStatus) status; @@ -442,23 +394,14 @@ Glib::RefPtr<IOChannel> wrap(GIOChannel* gobject, bool take_copy) /**** Glib::GlibmmIOChannel ************************************************/ -#ifdef GLIBMM_EXCEPTIONS_ENABLED GIOStatus GlibmmIOChannel::io_read(GIOChannel* channel, char* buf, gsize count, gsize* bytes_read, GError** err) -#else -//Avoid an unused parameter warning when GLIBMM_EXCEPTIONS_ENABLED is used. -GIOStatus GlibmmIOChannel::io_read(GIOChannel* channel, char* buf, gsize count, - gsize* bytes_read, GError** /* err */) -#endif { IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED return (GIOStatus) wrapper->read_vfunc(buf, count, *bytes_read); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(Glib::Error& error) { @@ -468,28 +411,18 @@ GIOStatus GlibmmIOChannel::io_read(GIOChannel* channel, char* buf, gsize count, { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED return G_IO_STATUS_ERROR; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED GIOStatus GlibmmIOChannel::io_write(GIOChannel* channel, const char* buf, gsize count, gsize* bytes_written, GError** err) -#else -//Avoid an unused parameter warning when GLIBMM_EXCEPTIONS_ENABLED is used. -GIOStatus GlibmmIOChannel::io_write(GIOChannel* channel, const char* buf, gsize count, - gsize* bytes_written, GError** /* err */) -#endif { IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED return (GIOStatus) wrapper->write_vfunc(buf, count, *bytes_written); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(Glib::Error& error) { @@ -499,26 +432,17 @@ GIOStatus GlibmmIOChannel::io_write(GIOChannel* channel, const char* buf, gsize { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED return G_IO_STATUS_ERROR; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED GIOStatus GlibmmIOChannel::io_seek(GIOChannel* channel, gint64 offset, GSeekType type, GError** err) -#else -//Avoid an unused parameter warning when GLIBMM_EXCEPTIONS_ENABLED is used. -GIOStatus GlibmmIOChannel::io_seek(GIOChannel* channel, gint64 offset, GSeekType type, GError** /* err */) -#endif { IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED return (GIOStatus) wrapper->seek_vfunc(offset, (SeekType) type); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(Glib::Error& error) { @@ -528,26 +452,17 @@ GIOStatus GlibmmIOChannel::io_seek(GIOChannel* channel, gint64 offset, GSeekType { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED return G_IO_STATUS_ERROR; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED GIOStatus GlibmmIOChannel::io_close(GIOChannel* channel, GError** err) -#else -//Avoid an unused parameter warning when GLIBMM_EXCEPTIONS_ENABLED is used. -GIOStatus GlibmmIOChannel::io_close(GIOChannel* channel, GError** /* err */) -#endif { IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED return (GIOStatus) wrapper->close_vfunc(); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(Glib::Error& error) { @@ -557,7 +472,6 @@ GIOStatus GlibmmIOChannel::io_close(GIOChannel* channel, GError** /* err */) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED return G_IO_STATUS_ERROR; @@ -568,19 +482,15 @@ GSource* GlibmmIOChannel::io_create_watch(GIOChannel* channel, GIOCondition cond { IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED const Glib::RefPtr<Source> source = wrapper->create_watch_vfunc((IOCondition) condition); return (source) ? source->gobj_copy() : 0; - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED return 0; } @@ -597,21 +507,13 @@ void GlibmmIOChannel::io_free(GIOChannel* channel) g_free(channel); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED GIOStatus GlibmmIOChannel::io_set_flags(GIOChannel* channel, GIOFlags flags, GError** err) -#else -//Avoid an unused parameter warning when GLIBMM_EXCEPTIONS_ENABLED is used. -GIOStatus GlibmmIOChannel::io_set_flags(GIOChannel* channel, GIOFlags flags, GError** /* err */) -#endif { IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED return (GIOStatus) wrapper->set_flags_vfunc((IOFlags) flags); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(Glib::Error& error) { @@ -621,7 +523,6 @@ GIOStatus GlibmmIOChannel::io_set_flags(GIOChannel* channel, GIOFlags flags, GEr { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED return G_IO_STATUS_ERROR; } @@ -631,18 +532,14 @@ GIOFlags GlibmmIOChannel::io_get_flags(GIOChannel* channel) { IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED return (GIOFlags) wrapper->get_flags_vfunc(); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED return GIOFlags(0); } diff --git a/glib/src/iochannel.hg b/glib/src/iochannel.hg index 0c017306..f4853c3c 100644 --- a/glib/src/iochannel.hg +++ b/glib/src/iochannel.hg @@ -105,11 +105,7 @@ public: * @return An IOChannel for the opened file. * @throw Glib::FileError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED static Glib::RefPtr<IOChannel> create_from_file(const std::string& filename, const std::string& mode); -#else - static Glib::RefPtr<IOChannel> create_from_file(const std::string& filename, const std::string& mode, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_io_channel_new_file) /** Creates an I/O channel from a file descriptor. @@ -188,11 +184,7 @@ public: * @throw Glib::IOChannelError * @throw Glib::ConvertError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED IOStatus read(Glib::ustring& str, gsize count); -#else - IOStatus read(Glib::ustring& str, gsize count, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Read a whole line. * Reads until the line separator is found, which is included @@ -202,11 +194,7 @@ public: * @throw Glib::IOChannelError * @throw Glib::ConvertError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED IOStatus read_line(Glib::ustring& line); -#else - IOStatus read_line(Glib::ustring& line, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_io_channel_read_line, g_io_channel_read_line_string) /** Reads all the remaining data from the file. @@ -216,11 +204,7 @@ public: * @throw Glib::IOChannelError * @throw Glib::ConvertError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED IOStatus read_to_end(Glib::ustring& str); -#else - IOStatus read_to_end(Glib::ustring& str, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_io_channel_read_to_end) /** Write a string to the I/O channel. @@ -232,11 +216,7 @@ public: * @throw Glib::IOChannelError * @throw Glib::ConvertError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED IOStatus write(const Glib::ustring& str); -#else - IOStatus write(const Glib::ustring& str, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Write a memory area of @a count bytes to the I/O channel. * @param buf The start of the memory area. @@ -395,11 +375,7 @@ public: * @return Glib::IO_STATUS_NORMAL if the encoding was successfully set. * @throw Glib::IOChannelError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED IOStatus set_encoding(const std::string& encoding = std::string()); -#else - IOStatus set_encoding(const std::string& encoding, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_io_channel_set_encoding) /** Get the encoding of the I/O channel. diff --git a/glib/src/keyfile.ccg b/glib/src/keyfile.ccg index 73f56e5e..4db5390a 100644 --- a/glib/src/keyfile.ccg +++ b/glib/src/keyfile.ccg @@ -38,11 +38,7 @@ KeyFile::~KeyFile() g_key_file_free(gobject_); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool KeyFile::load_from_data(const Glib::ustring& data, KeyFileFlags flags) -#else -bool KeyFile::load_from_data(const Glib::ustring& data, KeyFileFlags flags, std::auto_ptr<Glib::Error>& error) -#endif { GError* gerror = 0; @@ -52,20 +48,12 @@ bool KeyFile::load_from_data(const Glib::ustring& data, KeyFileFlags flags, std: &gerror); if(gerror) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::Error::throw_exception(gerror); -#else - error = Glib::Error::throw_exception(gerror); -#endif return (result != 0); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool KeyFile::load_from_data_dirs(const std::string& file, std::string& full_path, KeyFileFlags flags) -#else -bool KeyFile::load_from_data_dirs(const std::string& file, std::string& full_path, KeyFileFlags flags, std::auto_ptr<Glib::Error>& error) -#endif { GError* gerror = 0; char* full_path_c = 0; @@ -76,11 +64,7 @@ bool KeyFile::load_from_data_dirs(const std::string& file, std::string& full_pat &gerror); if(gerror) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::Error::throw_exception(gerror); -#else - error = Glib::Error::throw_exception(gerror); -#endif if(full_path_c) full_path = Glib::ScopedPtr<char>(full_path_c).get(); @@ -90,21 +74,13 @@ bool KeyFile::load_from_data_dirs(const std::string& file, std::string& full_pat return (result != 0); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring KeyFile::to_data() -#else -Glib::ustring KeyFile::to_data(std::auto_ptr<Glib::Error>& error) -#endif { GError* gerror = 0; char *const str = g_key_file_to_data(gobj(), 0, &gerror); if(gerror) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::Error::throw_exception(gerror); -#else - error = Glib::Error::throw_exception(gerror); -#endif return Glib::convert_return_gchar_ptr_to_ustring(str); } @@ -117,11 +93,7 @@ Glib::ArrayHandle<Glib::ustring> KeyFile::get_groups() const return Glib::ArrayHandle<Glib::ustring>(array, length, Glib::OWNERSHIP_DEEP); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ArrayHandle<Glib::ustring> KeyFile::get_keys(const Glib::ustring& group_name) const -#else -Glib::ArrayHandle<Glib::ustring> KeyFile::get_keys(const Glib::ustring& group_name, std::auto_ptr<Glib::Error>& error) const -#endif { gsize length = 0; GError* gerror = 0; @@ -132,22 +104,13 @@ Glib::ArrayHandle<Glib::ustring> KeyFile::get_keys(const Glib::ustring& group_na &length, &gerror); if(gerror) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::Error::throw_exception(gerror); -#else - error = Glib::Error::throw_exception(gerror); -#endif return Glib::ArrayHandle<Glib::ustring>(array, length, Glib::OWNERSHIP_DEEP); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring KeyFile::get_locale_string(const Glib::ustring& group_name, const Glib::ustring& key) const -#else -Glib::ustring KeyFile::get_locale_string(const Glib::ustring& group_name, - const Glib::ustring& key, std::auto_ptr<Glib::Error>& error) const -#endif { GError* gerror = 0; char *const str = g_key_file_get_locale_string( @@ -156,49 +119,29 @@ Glib::ustring KeyFile::get_locale_string(const Glib::ustring& group_name, key.c_str(), 0, &gerror); if(gerror) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::Error::throw_exception(gerror); -#else - error = Glib::Error::throw_exception(gerror); -#endif return Glib::convert_return_gchar_ptr_to_ustring(str); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED int KeyFile::get_integer(const Glib::ustring& key) const -#else -int KeyFile::get_integer(const Glib::ustring& key, std::auto_ptr<Glib::Error>& error) const -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; const int value = g_key_file_get_integer(const_cast<GKeyFile*>(gobj()), 0, key.c_str(), &gerror); if(gerror) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::Error::throw_exception(gerror); -#else - error = Glib::Error::throw_exception(gerror); -#endif return value; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED double KeyFile::get_double(const Glib::ustring& key) const -#else -double KeyFile::get_double(const Glib::ustring& key, std::auto_ptr<Glib::Error>& error) const -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; double retvalue = g_key_file_get_double(const_cast<GKeyFile*>(gobj()), 0, key.c_str(), &(gerror)); if(gerror) -#ifdef GLIBMM_EXCEPTIONS_ENABLED ::Glib::Error::throw_exception(gerror); -#else - error = ::Glib::Error::throw_exception(gerror); -#endif //GLIBMM_EXCEPTIONS_ENABLED return retvalue; } @@ -208,13 +151,8 @@ void KeyFile::set_double(const Glib::ustring& key, double value) g_key_file_set_double(gobj(), 0, key.c_str(), value); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED # define GLIBMM_ERROR_ARG # define GLIBMM_THROW(err) if (err) Glib::Error::throw_exception(err) -#else -# define GLIBMM_ERROR_ARG , std::auto_ptr<Glib::Error>& error -# define GLIBMM_THROW(err) if (err) error = Glib::Error::throw_exception(err) -#endif Glib::ArrayHandle<Glib::ustring> KeyFile::get_string_list(const Glib::ustring& group_name, const Glib::ustring& key @@ -336,11 +274,7 @@ void KeyFile::set_boolean_list(const Glib::ustring& group_name, const Glib::ustr key.c_str(), const_cast<gboolean*>(list.data()), list.size()); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring KeyFile::get_comment() const -#else -Glib::ustring KeyFile::get_comment(std::auto_ptr<Glib::Error>& error) const -#endif { GError* gerror = 0; char *const str = g_key_file_get_comment(const_cast<GKeyFile*>(gobj()), 0, 0, &gerror); diff --git a/glib/src/keyfile.hg b/glib/src/keyfile.hg index 33c35161..97164fc5 100644 --- a/glib/src/keyfile.hg +++ b/glib/src/keyfile.hg @@ -125,11 +125,7 @@ public: * @return true if the KeyFile was successfully loaded, false otherwise * @throw Glib::KeyFileError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool load_from_data(const Glib::ustring& data, KeyFileFlags flags = Glib::KEY_FILE_NONE); -#else - bool load_from_data(const Glib::ustring& data, KeyFileFlags flags, std::auto_ptr<Glib::Error>& error); -#endif _IGNORE(g_key_file_load_from_data) #m4 _CONVERSION(`const Glib::ArrayHandle<std::string>&', `const gchar**', `const_cast<const gchar**>($3.data())') @@ -147,22 +143,14 @@ public: * @throw Glib::KeyFileError * @throw Glib::FileError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool load_from_data_dirs(const std::string& file, std::string& full_path, KeyFileFlags flags = Glib::KEY_FILE_NONE); -#else - bool load_from_data_dirs(const std::string& file, std::string& full_path, KeyFileFlags flags, std::auto_ptr<Glib::Error>& error); -#endif _IGNORE(g_key_file_load_from_data_dirs) /** Outputs the KeyFile as a string * @return A string object holding the contents of KeyFile * @throw Glib::KeyFileError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring to_data(); -#else - Glib::ustring to_data(std::auto_ptr<Glib::Error>& error); -#endif _IGNORE(g_key_file_to_data) _WRAP_METHOD(Glib::ustring get_start_group() const, g_key_file_get_start_group) @@ -178,11 +166,7 @@ public: * @returns A list containing the names of the keys in @a group_name * @throw Glib::KeyFileError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ArrayHandle<Glib::ustring> get_keys(const Glib::ustring& group_name) const; -#else - Glib::ArrayHandle<Glib::ustring> get_keys(const Glib::ustring& group_name, std::auto_ptr<Glib::Error>& error) const; -#endif _IGNORE(g_key_file_get_keys) _WRAP_METHOD(bool has_group(const Glib::ustring& group_name) const, g_key_file_has_group) @@ -196,11 +180,7 @@ public: * @return the value as a Glib::ustring * @throw Glib::KeyFileError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring get_locale_string(const Glib::ustring& group_name, const Glib::ustring& key) const; -#else - Glib::ustring get_locale_string(const Glib::ustring& group_name, const Glib::ustring& key, std::auto_ptr<Glib::Error>& error) const; -#endif _IGNORE(g_key_file_get_locale_string) _WRAP_METHOD(Glib::ustring get_locale_string(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& locale) const, g_key_file_get_locale_string, errthrow) @@ -212,11 +192,7 @@ public: * @return The value of @a key as an integer * @throw Glib::KeyFileError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED int get_integer(const Glib::ustring& key) const; -#else - int get_integer(const Glib::ustring& key, std::auto_ptr<Glib::Error>& error) const; -#endif _WRAP_METHOD(int get_integer(const Glib::ustring& group_name, const Glib::ustring& key) const, g_key_file_get_integer, errthrow) /** Gets the value in the first group, under @a key, interpreting it as @@ -227,11 +203,7 @@ public: * * @newin{2,14} */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED double get_double(const Glib::ustring& key) const; -#else - double get_double(const Glib::ustring& key, std::auto_ptr<Glib::Error>& error) const; -#endif _WRAP_METHOD(double get_double(const Glib::ustring& group_name, const Glib::ustring& key) const, g_key_file_get_double, errthrow) _WRAP_METHOD(void set_double(const Glib::ustring& group_name, const Glib::ustring& key, double value), g_key_file_set_double) @@ -251,11 +223,7 @@ public: * @return A list containing the values requested * @throw Glib::KeyFileError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ArrayHandle<Glib::ustring> get_string_list(const Glib::ustring& group_name, const Glib::ustring& key) const; -#else - Glib::ArrayHandle<Glib::ustring> get_string_list(const Glib::ustring& group_name, const Glib::ustring& key, std::auto_ptr<Glib::Error>& error) const; -#endif _IGNORE(g_key_file_get_string_list) /** Returns the values associated with @a key under @a group_name @@ -265,11 +233,7 @@ public: * @return A list containing the values requested * @throw Glib::KeyFileError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ArrayHandle<Glib::ustring> get_locale_string_list(const Glib::ustring& group_name, const Glib::ustring& key) const; -#else - Glib::ArrayHandle<Glib::ustring> get_locale_string_list(const Glib::ustring& group_name, const Glib::ustring& key, std::auto_ptr<Glib::Error>& error) const; -#endif /** Returns the values associated with @a key under @a group_name * translated into @a locale, if available. @@ -279,11 +243,7 @@ public: * @return A list containing the values requested * @throw Glib::KeyFileError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ArrayHandle<Glib::ustring> get_locale_string_list(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& locale) const; -#else - Glib::ArrayHandle<Glib::ustring> get_locale_string_list(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& locale, std::auto_ptr<Glib::Error>& error) const; -#endif _IGNORE(g_key_file_get_locale_string_list) /** Returns the values associated with @a key under @a group_name @@ -292,12 +252,7 @@ public: * @return A list of booleans * @throw Glib::KeyFileError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ArrayHandle<bool> get_boolean_list(const Glib::ustring& group_name, const Glib::ustring& key) const; -#else - Glib::ArrayHandle<bool> get_boolean_list(const Glib::ustring& group_name, const Glib::ustring& key, - std::auto_ptr<Glib::Error>& error) const; -#endif _IGNORE(g_key_file_get_boolean_list) /** Returns the values associated with @a key under @a group_name @@ -306,12 +261,7 @@ public: * @return A list of integers * @throw Glib::KeyFileError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ArrayHandle<int> get_integer_list(const Glib::ustring& group_name, const Glib::ustring& key) const; -#else - Glib::ArrayHandle<int> get_integer_list(const Glib::ustring& group_name, const Glib::ustring& key, - std::auto_ptr<Glib::Error>& error) const; -#endif _IGNORE(g_key_file_get_integer_list) /** Returns the values associated with @a key under @a group_name @@ -320,34 +270,21 @@ public: * @return A list of doubles * @throw Glib::KeyFileError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ArrayHandle<double> get_double_list(const Glib::ustring& group_name, const Glib::ustring& key) const; -#else - Glib::ArrayHandle<double> get_double_list(const Glib::ustring& group_name, const Glib::ustring& key, - std::auto_ptr<Glib::Error>& error) const; -#endif _IGNORE(g_key_file_get_double_list) /** Get comment from top of file * @return The comment * @throw Glib::KeyFileError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring get_comment() const; -#else - Glib::ustring get_comment(std::auto_ptr<Glib::Error>& error) const; -#endif /** Get comment from above a group * @param group_name The group * @return The comment * @throw Glib::KeyFileError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring get_comment(const Glib::ustring& group_name) const; -#else - Glib::ustring get_comment(const Glib::ustring& group_name, std::auto_ptr<Glib::Error>& error) const; -#endif _WRAP_METHOD(Glib::ustring get_comment(const Glib::ustring& group_name, const Glib::ustring& key) const, g_key_file_get_comment, errthrow) @@ -413,23 +350,14 @@ public: * @param comment The Comment * @throw Glib::KeyFileError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED void set_comment(const Glib::ustring& comment); -#else - void set_comment(const Glib::ustring& comment, std::auto_ptr<Glib::Error>& error); -#endif /** Places @a comment above @a group_name. * @param group_name The Group the comment should be above * @param comment The comment * @throw Glib::KeyFileError */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED void set_comment(const Glib::ustring& group_name, const Glib::ustring& comment); -#else - void set_comment(const Glib::ustring& group_name, const Glib::ustring& comment, - std::auto_ptr<Glib::Error>& error); -#endif _WRAP_METHOD(void set_comment(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& comment), g_key_file_set_comment, errthrow) diff --git a/glib/src/markup.ccg b/glib/src/markup.ccg index 17bfc380..eb58f67a 100644 --- a/glib/src/markup.ccg +++ b/glib/src/markup.ccg @@ -98,15 +98,11 @@ void ParserCallbacks::start_element(GMarkupParseContext* context, void* user_data, GError** error) { - (void)error; //Avoid an unused parameter warning when GLIBMM_EXCEPTIONS_ENABLED is used. - ParseContext& cpp_context = *static_cast<ParseContext*>(user_data); g_return_if_fail(context == cpp_context.gobj()); - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED Parser::AttributeMap attributes; if(attribute_names && attribute_values) @@ -121,7 +117,6 @@ void ParserCallbacks::start_element(GMarkupParseContext* context, } cpp_context.get_parser()->on_start_element(cpp_context, element_name, attributes); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(MarkupError& err) { @@ -131,7 +126,6 @@ void ParserCallbacks::start_element(GMarkupParseContext* context, { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED } void ParserCallbacks::end_element(GMarkupParseContext* context, @@ -139,17 +133,12 @@ void ParserCallbacks::end_element(GMarkupParseContext* context, void* user_data, GError** error) { - (void)error; //Avoid an unused parameter warning when GLIBMM_EXCEPTIONS_ENABLED is used. - ParseContext& cpp_context = *static_cast<ParseContext*>(user_data); g_return_if_fail(context == cpp_context.gobj()); - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED cpp_context.get_parser()->on_end_element(cpp_context, element_name); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(MarkupError& err) { @@ -159,7 +148,6 @@ void ParserCallbacks::end_element(GMarkupParseContext* context, { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED } void ParserCallbacks::text(GMarkupParseContext* context, @@ -168,17 +156,12 @@ void ParserCallbacks::text(GMarkupParseContext* context, void* user_data, GError** error) { - (void)error; //Avoid an unused parameter warning when GLIBMM_EXCEPTIONS_ENABLED is used. - ParseContext& cpp_context = *static_cast<ParseContext*>(user_data); g_return_if_fail(context == cpp_context.gobj()); - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED cpp_context.get_parser()->on_text(cpp_context, Glib::ustring(text, text + text_len)); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(MarkupError& err) { @@ -188,7 +171,6 @@ void ParserCallbacks::text(GMarkupParseContext* context, { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED } void ParserCallbacks::passthrough(GMarkupParseContext* context, @@ -197,18 +179,13 @@ void ParserCallbacks::passthrough(GMarkupParseContext* context, void* user_data, GError** error) { - (void)error; //Avoid an unused parameter warning when GLIBMM_EXCEPTIONS_ENABLED is used. - ParseContext& cpp_context = *static_cast<ParseContext*>(user_data); g_return_if_fail(context == cpp_context.gobj()); - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED cpp_context.get_parser()->on_passthrough( cpp_context, Glib::ustring(passthrough_text, passthrough_text + text_len)); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(MarkupError& err) { @@ -218,7 +195,6 @@ void ParserCallbacks::passthrough(GMarkupParseContext* context, { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED } void ParserCallbacks::error(GMarkupParseContext* context, @@ -230,18 +206,14 @@ void ParserCallbacks::error(GMarkupParseContext* context, g_return_if_fail(context == cpp_context.gobj()); g_return_if_fail(error->domain == G_MARKUP_ERROR); - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED cpp_context.get_parser()->on_error(cpp_context, MarkupError(g_error_copy(error))); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED } diff --git a/glib/src/optioncontext.ccg b/glib/src/optioncontext.ccg index f6ad3a7e..2e8b4c20 100644 --- a/glib/src/optioncontext.ccg +++ b/glib/src/optioncontext.ccg @@ -33,18 +33,14 @@ namespace Glib Glib::OptionContext::SlotTranslate* the_slot = static_cast<Glib::OptionContext::SlotTranslate*>(data); -#ifdef GLIBMM_EXCEPTIONS_ENABLED try { -#endif //GLIBMM_EXCEPTIONS_ENABLED translated_str = (*the_slot)(str); -#ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } -#endif //GLIBMM_EXCEPTIONS_ENABLED return translated_str.c_str (); } diff --git a/glib/src/optiongroup.ccg b/glib/src/optiongroup.ccg index fe1f53be..04f5aedb 100644 --- a/glib/src/optiongroup.ccg +++ b/glib/src/optiongroup.ccg @@ -76,19 +76,15 @@ const gchar* OptionGroup_Translate_glibmm_callback(const gchar* string, Glib::OptionGroup::SlotTranslate* the_slot = static_cast<Glib::OptionGroup::SlotTranslate*>(data); - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED // The C docs says that the char* belongs to Glib. return g_strdup((*the_slot)(Glib::ustring(string)).c_str()); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED return 0; } diff --git a/glib/src/regex.ccg b/glib/src/regex.ccg index abdf05a9..1d71cd1a 100644 --- a/glib/src/regex.ccg +++ b/glib/src/regex.ccg @@ -20,27 +20,16 @@ namespace Glib { -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<Glib::Regex> Regex::create(const Glib::ustring& pattern, RegexCompileFlags compile_options, RegexMatchFlags match_options) -#else -Glib::RefPtr<Glib::Regex> Regex::create(const Glib::ustring& pattern, - RegexCompileFlags compile_options, - RegexMatchFlags match_options, - std::auto_ptr<Glib::Error>& error) -#endif /* GLIBMM_EXCEPTIONS_ENABLED */ { GError* gerror = 0; GRegex* regex = g_regex_new(pattern.c_str(), (GRegexCompileFlags)compile_options, (GRegexMatchFlags)match_options, &gerror); if(gerror) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::Error::throw_exception(gerror); -#else - error = Glib::Error::throw_exception(gerror); -#endif return Glib::wrap(regex); } @@ -58,40 +47,22 @@ bool Regex::match(const Glib::ustring& string, RegexMatchFlags match_options) } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool Regex::match(const Glib::ustring& string, int start_position, RegexMatchFlags match_options) -#else -bool Regex::match(const Glib::ustring& string, int start_position, RegexMatchFlags match_options, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_regex_match_full(gobj(), string.c_str(), -1, start_position, ((GRegexMatchFlags)(match_options)), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool Regex::match(const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options) -#else -bool Regex::match(const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_regex_match_full(gobj(), string.c_str(), string_len, start_position, ((GRegexMatchFlags)(match_options)), 0, &(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; } @@ -103,100 +74,55 @@ bool Regex::match_all(const Glib::ustring& string, RegexMatchFlags match_options } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool Regex::match_all(const Glib::ustring& string, int start_position, RegexMatchFlags match_options) -#else -bool Regex::match_all(const Glib::ustring& string, int start_position, RegexMatchFlags match_options, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_regex_match_all_full(gobj(), string.c_str(), -1, start_position, ((GRegexMatchFlags)(match_options)), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool Regex::match_all(const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options) -#else -bool Regex::match_all(const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; bool retvalue = g_regex_match_all_full(gobj(), string.c_str(), string_len, start_position, ((GRegexMatchFlags)(match_options)), 0, &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring Regex::replace(const Glib::ustring& string, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options) -#else -Glib::ustring Regex::replace(const Glib::ustring& string, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::ustring retvalue = Glib::convert_return_gchar_ptr_to_ustring(g_regex_replace(gobj(), string.c_str(), -1, start_position, replacement.c_str(), ((GRegexMatchFlags)(match_options)), &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring Regex::replace_literal(const Glib::ustring& string, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options) -#else -Glib::ustring Regex::replace_literal(const Glib::ustring& string, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::ustring retvalue = Glib::convert_return_gchar_ptr_to_ustring(g_regex_replace_literal(gobj(), string.c_str(), -1, start_position, replacement.c_str(), ((GRegexMatchFlags)(match_options)), &(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; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::StringArrayHandle Regex::split(const Glib::ustring& string, int start_position, RegexMatchFlags match_options, int max_tokens) const -#else -Glib::StringArrayHandle Regex::split(const Glib::ustring& string, int start_position, RegexMatchFlags match_options, int max_tokens, std::auto_ptr<Glib::Error>& error) const -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; Glib::StringArrayHandle retvalue = Glib::StringArrayHandle(g_regex_split_full(const_cast<GRegex*>(gobj()), string.c_str(), -1, start_position, ((GRegexMatchFlags)(match_options)), max_tokens, &(gerror)), Glib::OWNERSHIP_DEEP); -#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; } diff --git a/glib/src/regex.hg b/glib/src/regex.hg index 50e90e4a..7d90bac2 100644 --- a/glib/src/regex.hg +++ b/glib/src/regex.hg @@ -97,11 +97,7 @@ class Regex _IGNORE(g_regex_ref, g_regex_unref) public: -#ifdef GLIBMM_EXCEPTIONS_ENABLED static Glib::RefPtr<Glib::Regex> create(const Glib::ustring& pattern, RegexCompileFlags compile_options = static_cast<RegexCompileFlags>(0), RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0)); -#else - static Glib::RefPtr<Glib::Regex> create(const Glib::ustring& pattern, RegexCompileFlags compile_options, RegexMatchFlags match_options, std::auto_ptr<Glib::Error>& error); -#endif /* !GLIBMM_EXCEPTIONS_ENABLED */ _WRAP_METHOD(Glib::ustring get_pattern() const, g_regex_get_pattern) _WRAP_METHOD(int get_max_backref() const, g_regex_get_max_backref) @@ -118,34 +114,18 @@ public: //TODO: Wrap GMatchInfo as an iterator: //_WRAP_METHOD(bool match_full(const gchar* string, gssize string_len, int start_position, RegexMatchFlags match_options = (RegexMatchFlags)0, GMatchInfo** match_info = 0), g_regex_match_full, errthrow) -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool match(const Glib::ustring& string, int start_position, RegexMatchFlags match_options); -#else - bool match(const Glib::ustring& string, int start_position, RegexMatchFlags match_options, std::auto_ptr<Glib::Error>& error); -#endif /* !GLIBMM_EXCEPTIONS_ENABLED */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool match(const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options); -#else - bool match(const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options, std::auto_ptr<Glib::Error>& error); -#endif /* !GLIBMM_EXCEPTIONS_ENABLED */ //TODO: _WRAP_METHOD(bool match_all(const Glib::ustring& string, RegexMatchFlags match_options = (RegexMatchFlags)0, GMatchInfo ** match_info = 0), g_regex_match_all) bool match_all(const Glib::ustring& string, RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0)); //TODO: _WRAP_METHOD(bool match_all_full(const gchar* string, gssize string_len, int start_position, RegexMatchFlags match_options = (RegexMatchFlags)0, GMatchInfo** match_info = 0), g_regex_match_all_full, errthrow) -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool match_all(const Glib::ustring& string, int start_position, RegexMatchFlags match_options); -#else - bool match_all(const Glib::ustring& string, int start_position, RegexMatchFlags match_options, std::auto_ptr<Glib::Error>& error); -#endif /* !GLIBMM_EXCEPTIONS_ENABLED */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED bool match_all(const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options); -#else - bool match_all(const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options, std::auto_ptr<Glib::Error>& error); -#endif /* !GLIBMM_EXCEPTIONS_ENABLED */ #m4 _CONVERSION(`gchar**',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)') @@ -154,25 +134,13 @@ public: _WRAP_METHOD(Glib::StringArrayHandle split(const gchar* string, gssize string_len, int start_position, RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0), int max_tokens = 0) const, g_regex_split_full, errthrow) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::StringArrayHandle split(const Glib::ustring& string, int start_position, RegexMatchFlags match_options, int max_tokens) const; -#else - Glib::StringArrayHandle split(const Glib::ustring& string, int start_position, RegexMatchFlags match_options, int max_tokens, std::auto_ptr<Glib::Error>& error) const; -#endif /* !GLIBMM_EXCEPTIONS_ENABLED */ _WRAP_METHOD(Glib::ustring replace(const gchar* string, gssize string_len, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0)), g_regex_replace, errthrow) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring replace(const Glib::ustring& string, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options); -#else - Glib::ustring replace(const Glib::ustring& string, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options, std::auto_ptr<Glib::Error>& error); -#endif /* !GLIBMM_EXCEPTIONS_ENABLED */ _WRAP_METHOD(Glib::ustring replace_literal(const gchar *string, gssize string_len, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0)), g_regex_replace_literal, errthrow) -#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::ustring replace_literal(const Glib::ustring& string, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options); -#else - Glib::ustring replace_literal(const Glib::ustring& string, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options, std::auto_ptr<Glib::Error>& error); -#endif /* !GLIBMM_EXCEPTIONS_ENABLED */ _WRAP_METHOD(Glib::ustring replace_eval(const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options, GRegexEvalCallback eval, gpointer user_data), g_regex_replace_eval, errthrow) _WRAP_METHOD(static bool check_replacement(const Glib::ustring& replacement, gboolean* has_references), g_regex_check_replacement, errthrow) diff --git a/glib/src/spawn.ccg b/glib/src/spawn.ccg index 10d9d7f4..b526c394 100644 --- a/glib/src/spawn.ccg +++ b/glib/src/spawn.ccg @@ -35,18 +35,14 @@ extern "C" */ static void child_setup_callback(void* user_data) { - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED (*reinterpret_cast<sigc::slot<void>*>(user_data))(); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED } static void copy_output_buf(std::string* dest, const char* buf) @@ -70,7 +66,6 @@ namespace Glib /**** process spawning functions *******************************************/ -#ifdef GLIBMM_EXCEPTIONS_ENABLED void spawn_async_with_pipes(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, const Glib::ArrayHandle<std::string>& envp, @@ -80,17 +75,6 @@ void spawn_async_with_pipes(const std::string& working_directory, int* standard_input, int* standard_output, int* standard_error) -#else -void spawn_async_with_pipes(const std::string& working_directory, - const Glib::ArrayHandle<std::string>& argv, - const Glib::ArrayHandle<std::string>& envp, - SpawnFlags flags, - const sigc::slot<void>& child_setup, - Pid* child_pid, - int* standard_input, - int* standard_output, - int* standard_error, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { const bool setup_slot = !child_setup.empty(); sigc::slot<void> child_setup_ = child_setup; @@ -107,16 +91,10 @@ void spawn_async_with_pipes(const std::string& working_directory, standard_input, standard_output, standard_error, &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 } -#ifdef GLIBMM_EXCEPTIONS_ENABLED void spawn_async_with_pipes(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, SpawnFlags flags, @@ -125,16 +103,6 @@ void spawn_async_with_pipes(const std::string& working_directory, int* standard_input, int* standard_output, int* standard_error) -#else -void spawn_async_with_pipes(const std::string& working_directory, - const Glib::ArrayHandle<std::string>& argv, - SpawnFlags flags, - const sigc::slot<void>& child_setup, - Pid* child_pid, - int* standard_input, - int* standard_output, - int* standard_error, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { const bool setup_slot = !child_setup.empty(); sigc::slot<void> child_setup_ = child_setup; @@ -150,30 +118,16 @@ void spawn_async_with_pipes(const std::string& working_directory, standard_input, standard_output, standard_error, &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 } -#ifdef GLIBMM_EXCEPTIONS_ENABLED void spawn_async(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, const Glib::ArrayHandle<std::string>& envp, SpawnFlags flags, const sigc::slot<void>& child_setup, Pid* child_pid) -#else -void spawn_async(const std::string& working_directory, - const Glib::ArrayHandle<std::string>& argv, - const Glib::ArrayHandle<std::string>& envp, - SpawnFlags flags, - const sigc::slot<void>& child_setup, - Pid* child_pid, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { const bool setup_slot = !child_setup.empty(); sigc::slot<void> child_setup_ = child_setup; @@ -189,28 +143,15 @@ void spawn_async(const std::string& working_directory, child_pid, &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 } -#ifdef GLIBMM_EXCEPTIONS_ENABLED void spawn_async(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, SpawnFlags flags, const sigc::slot<void>& child_setup, Pid* child_pid) -#else -void spawn_async(const std::string& working_directory, - const Glib::ArrayHandle<std::string>& argv, - SpawnFlags flags, - const sigc::slot<void>& child_setup, - Pid* child_pid, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { const bool setup_slot = !child_setup.empty(); sigc::slot<void> child_setup_ = child_setup; @@ -225,16 +166,10 @@ void spawn_async(const std::string& working_directory, child_pid, &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 } -#ifdef GLIBMM_EXCEPTIONS_ENABLED void spawn_sync(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, const Glib::ArrayHandle<std::string>& envp, @@ -243,16 +178,6 @@ void spawn_sync(const std::string& working_directory, std::string* standard_output, std::string* standard_error, int* exit_status) -#else -void spawn_sync(const std::string& working_directory, - const Glib::ArrayHandle<std::string>& argv, - const Glib::ArrayHandle<std::string>& envp, - SpawnFlags flags, - const sigc::slot<void>& child_setup, - std::string* standard_output, - std::string* standard_error, - int* exit_status, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { const bool setup_slot = !child_setup.empty(); sigc::slot<void> child_setup_ = child_setup; @@ -273,19 +198,13 @@ void spawn_sync(const std::string& working_directory, exit_status, &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 copy_output_buf(standard_output, buf_standard_output.get()); copy_output_buf(standard_error, buf_standard_error.get()); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED void spawn_sync(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, SpawnFlags flags, @@ -293,15 +212,6 @@ void spawn_sync(const std::string& working_directory, std::string* standard_output, std::string* standard_error, int* exit_status) -#else -void spawn_sync(const std::string& working_directory, - const Glib::ArrayHandle<std::string>& argv, - SpawnFlags flags, - const sigc::slot<void>& child_setup, - std::string* standard_output, - std::string* standard_error, - int* exit_status, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { const bool setup_slot = !child_setup.empty(); sigc::slot<void> child_setup_ = child_setup; @@ -321,47 +231,26 @@ void spawn_sync(const std::string& working_directory, exit_status, &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 copy_output_buf(standard_output, buf_standard_output.get()); copy_output_buf(standard_error, buf_standard_error.get()); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED void spawn_command_line_async(const std::string& command_line) -#else -void spawn_command_line_async(const std::string& command_line, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { GError* gerror = 0; g_spawn_command_line_async(command_line.c_str(), &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 } -#ifdef GLIBMM_EXCEPTIONS_ENABLED void spawn_command_line_sync(const std::string& command_line, std::string* standard_output, std::string* standard_error, int* exit_status) -#else -void spawn_command_line_sync(const std::string& command_line, - std::string* standard_output, - std::string* standard_error, - int* exit_status, std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED { Glib::ScopedPtr<char> buf_standard_output; Glib::ScopedPtr<char> buf_standard_error; @@ -374,13 +263,8 @@ void spawn_command_line_sync(const std::string& command_line, exit_status, &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 copy_output_buf(standard_output, buf_standard_output.get()); copy_output_buf(standard_error, buf_standard_error.get()); diff --git a/glib/src/spawn.hg b/glib/src/spawn.hg index a0af73c3..4fadb00a 100644 --- a/glib/src/spawn.hg +++ b/glib/src/spawn.hg @@ -189,7 +189,6 @@ _WRAP_GERROR(SpawnError, GSpawnError, G_SPAWN_ERROR, NO_GTYPE, s#^2BIG$#TOOBIG#) * to users. If an error occurs, @a child_pid, @a standard_input, @a standard_output, * and @a standard_error will not be filled with valid values. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED void spawn_async_with_pipes(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, const Glib::ArrayHandle<std::string>& envp, @@ -199,17 +198,6 @@ void spawn_async_with_pipes(const std::string& working_directory, int* standard_input = 0, int* standard_output = 0, int* standard_error = 0); -#else -void spawn_async_with_pipes(const std::string& working_directory, - const Glib::ArrayHandle<std::string>& argv, - const Glib::ArrayHandle<std::string>& envp, - SpawnFlags flags, - const sigc::slot<void>& child_setup, - Pid* child_pid, - int* standard_input, - int* standard_output, - int* standard_error, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Like the main spawn_async_with_pipes() method, but inheriting the parent's environment. * @@ -228,7 +216,6 @@ void spawn_async_with_pipes(const std::string& working_directory, * to users. If an error occurs, @a child_pid, @a standard_input, @a standard_output, * and @a standard_error will not be filled with valid values. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED void spawn_async_with_pipes(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, SpawnFlags flags = SpawnFlags(0), @@ -237,16 +224,6 @@ void spawn_async_with_pipes(const std::string& working_directory, int* standard_input = 0, int* standard_output = 0, int* standard_error = 0); -#else -void spawn_async_with_pipes(const std::string& working_directory, - const Glib::ArrayHandle<std::string>& argv, - SpawnFlags flags, - const sigc::slot<void>& child_setup, - Pid* child_pid, - int* standard_input, - int* standard_output, - int* standard_error, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** See pawn_async_with_pipes() for a full description. This function * simply calls the spawn_async_with_pipes() without any pipes. @@ -269,21 +246,12 @@ void spawn_async_with_pipes(const std::string& working_directory, * the message field of returned errors should be displayed * to users. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED void spawn_async(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, const Glib::ArrayHandle<std::string>& envp, SpawnFlags flags = SpawnFlags(0), const sigc::slot<void>& child_setup = sigc::slot<void>(), Pid* child_pid = 0); -#else -void spawn_async(const std::string& working_directory, - const Glib::ArrayHandle<std::string>& argv, - const Glib::ArrayHandle<std::string>& envp, - SpawnFlags flags, - const sigc::slot<void>& child_setup, - Pid* child_pid, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Like the main spawn_async() method, but inheriting the parent's environment. * @@ -299,19 +267,11 @@ void spawn_async(const std::string& working_directory, * the message field of returned errors should be displayed * to users. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED void spawn_async(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, SpawnFlags flags = SpawnFlags(0), const sigc::slot<void>& child_setup = sigc::slot<void>(), Pid* child_pid = 0); -#else -void spawn_async(const std::string& working_directory, - const Glib::ArrayHandle<std::string>& argv, - SpawnFlags flags, - const sigc::slot<void>& child_setup, - Pid* child_pid, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Executes a child synchronously (waits for the child to exit before returning). * All output from the child is stored in @a standard_output and @a standard_error, @@ -345,7 +305,6 @@ void spawn_async(const std::string& working_directory, * to users. If an error occurs, @a child_pid, @a standard_input, @a standard_output, * and @a standard_error will not be filled with valid values. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED void spawn_sync(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, const Glib::ArrayHandle<std::string>& envp, @@ -354,16 +313,6 @@ void spawn_sync(const std::string& working_directory, std::string* standard_output = 0, std::string* standard_error = 0, int* exit_status = 0); -#else -void spawn_sync(const std::string& working_directory, - const Glib::ArrayHandle<std::string>& argv, - const Glib::ArrayHandle<std::string>& envp, - SpawnFlags flags, - const sigc::slot<void>& child_setup, - std::string* standard_output, - std::string* standard_error, - int* exit_status, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** Like the main spawn_sync() method, but inheriting the parent's environment. * @@ -381,7 +330,6 @@ void spawn_sync(const std::string& working_directory, * to users. If an error occurs, @a child_pid, @a standard_input, @a standard_output, * and @a standard_error will not be filled with valid values. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED void spawn_sync(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, SpawnFlags flags = SpawnFlags(0), @@ -389,15 +337,6 @@ void spawn_sync(const std::string& working_directory, std::string* standard_output = 0, std::string* standard_error = 0, int* exit_status = 0); -#else -void spawn_sync(const std::string& working_directory, - const Glib::ArrayHandle<std::string>& argv, - SpawnFlags flags, - const sigc::slot<void>& child_setup, - std::string* standard_output, - std::string* standard_error , - int* exit_status, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** A simple version of spawn_async() that parses a command line with * shell_parse_argv() and passes it to spawn_async(). It runs a @@ -416,11 +355,7 @@ void spawn_sync(const std::string& working_directory, * to users. * @throws ShellError If the command line could not be parsed. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED void spawn_command_line_async(const std::string& command_line); -#else -void spawn_command_line_async(const std::string& command_line, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** A simple version of spawn_sync() with little-used parameters * removed, taking a command line instead of an argument vector. See @@ -455,17 +390,10 @@ void spawn_command_line_async(const std::string& command_line, std::auto_ptr<Gli * to users. * @throws ShellError If the command line could not be parsed. */ -#ifdef GLIBMM_EXCEPTIONS_ENABLED void spawn_command_line_sync(const std::string& command_line, std::string* standard_output = 0, std::string* standard_error = 0, int* exit_status = 0); -#else -void spawn_command_line_sync(const std::string& command_line, - std::string* standard_output, - std::string* standard_error, - int* exit_status, std::auto_ptr<Glib::Error>& error); -#endif //GLIBMM_EXCEPTIONS_ENABLED /** On some platforms, notably WIN32, the Pid type represents a resource * which must be closed to prevent resource leaking. close_pid() diff --git a/glib/src/thread.ccg b/glib/src/thread.ccg index 4b5bd898..3ece2e4f 100644 --- a/glib/src/thread.ccg +++ b/glib/src/thread.ccg @@ -32,13 +32,10 @@ static void* call_thread_entry_slot(void* data) { sigc::slot_base *const slot = reinterpret_cast<sigc::slot_base*>(data); - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED // Recreate the specific slot, and drop the reference obtained by create(). (*static_cast<sigc::slot<void>*>(slot))(); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(Glib::Thread::Exit&) { @@ -49,7 +46,6 @@ static void* call_thread_entry_slot(void* data) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED delete slot; return 0; diff --git a/glib/src/valuearray.ccg b/glib/src/valuearray.ccg index 7c7fddd4..1f08c7ca 100644 --- a/glib/src/valuearray.ccg +++ b/glib/src/valuearray.ccg @@ -25,19 +25,15 @@ static int ValueArray_Compare_glibmm_callback(gconstpointer a, Glib::ValueArray::SlotCompare* the_slot = static_cast<Glib::ValueArray::SlotCompare*>(user_data); - #ifdef GLIBMM_EXCEPTIONS_ENABLED try { - #endif //GLIBMM_EXCEPTIONS_ENABLED return (*the_slot)(*reinterpret_cast<const Glib::ValueBase*>(a), *reinterpret_cast<const Glib::ValueBase*>(b)); - #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } - #endif //GLIBMM_EXCEPTIONS_ENABLED return 0; } diff --git a/tests/giomm_ioerror/main.cc b/tests/giomm_ioerror/main.cc index d5684ac6..9875783a 100644 --- a/tests/giomm_ioerror/main.cc +++ b/tests/giomm_ioerror/main.cc @@ -19,7 +19,6 @@ int main(int, char**) Glib::init(); Gio::init(); -#ifdef GLIBMM_EXCEPTIONS_ENABLED try { Glib::RefPtr<Gio::File> file = Gio::File::create_for_path("/etc/fstab"); @@ -55,37 +54,6 @@ int main(int, char**) { std::cerr << "Exception caught: " << ex.what() << std::endl; } -#else /* !GLIBMM_EXCEPTIONS_ENABLED */ - Glib::RefPtr<Gio::File> file = Gio::File::create_for_path("/home/murrayc/test.txt"); - if(!file) - std::cerr << "Gio::File::create_for_path() returned an empty RefPtr." << std::endl; - - std::auto_ptr<Glib::Error> error; - - Glib::RefPtr<Gio::FileInputStream> stream = file->read(error); - if(!stream) - std::cerr << "Gio::File::read() returned an empty RefPtr." << std::endl; - if(error.get()) - { - std::cerr << "Exception caught: " << error->what() << std::endl; - return 1; - } - - gchar buffer[1000]; //TODO: This is unpleasant. - memset(buffer, 0, sizeof buffer); - const gsize bytes_read = stream->read(buffer, sizeof buffer - 1, error); - - if(bytes_read) - std::cout << "File contents read: " << buffer << std::endl; - else - std::cerr << "Gio::InputStream::read() read 0 bytes." << std::endl; - - if(error.get()) - { - std::cerr << "Exception caught: " << error->what() << std::endl; - return 1; - } -#endif /* !GLIBMM_EXCEPTIONS_ENABLED */ return 0; } diff --git a/tests/giomm_simple/main.cc b/tests/giomm_simple/main.cc index b7fefbf5..0340eb19 100644 --- a/tests/giomm_simple/main.cc +++ b/tests/giomm_simple/main.cc @@ -7,7 +7,6 @@ int main(int, char**) Glib::init(); Gio::init(); -#ifdef GLIBMM_EXCEPTIONS_ENABLED try { Glib::RefPtr<Gio::File> file = Gio::File::create_for_path("/etc/fstab"); @@ -31,36 +30,6 @@ int main(int, char**) { std::cerr << "Exception caught: " << ex.what() << std::endl; } -#else /* !GLIBMM_EXCEPTIONS_ENABLED */ - Glib::RefPtr<Gio::File> file = Gio::File::create_for_path("/home/murrayc/test.txt"); - if(!file) - std::cerr << "Gio::File::create_for_path() returned an empty RefPtr." << std::endl; - - std::auto_ptr<Glib::Error> error; - - Glib::RefPtr<Gio::FileInputStream> stream = file->read(error); - if(!stream) - std::cerr << "Gio::File::read() returned an empty RefPtr." << std::endl; - if(error.get()) - { - std::cerr << "Exception caught: " << error->what() << std::endl; - return 1; - } - gchar buffer[1000]; //TODO: This is unpleasant. - memset(buffer, 0, sizeof buffer); - const gsize bytes_read = stream->read(buffer, sizeof buffer - 1, error); - - if(bytes_read) - std::cout << "File contents read: " << buffer << std::endl; - else - std::cerr << "Gio::InputStream::read() read 0 bytes." << std::endl; - - if(error.get()) - { - std::cerr << "Exception caught: " << error->what() << std::endl; - return 1; - } -#endif /* !GLIBMM_EXCEPTIONS_ENABLED */ return 0; } diff --git a/tools/m4/class_interface.m4 b/tools/m4/class_interface.m4 index e3738987..c38dd550 100644 --- a/tools/m4/class_interface.m4 +++ b/tools/m4/class_interface.m4 @@ -52,17 +52,13 @@ public: protected: -#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED //Callbacks (default signal handlers): //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. //You could prevent the original default signal handlers being called by overriding the *_impl method. _IMPORT(SECTION_PH_DEFAULT_SIGNAL_HANDLERS) -#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED //Callbacks (virtual functions): -#ifdef GLIBMM_VFUNCS_ENABLED _IMPORT(SECTION_PH_VFUNCS) -#endif //GLIBMM_VFUNCS_ENABLED }; ') @@ -94,22 +90,14 @@ void __CPPNAME__`'_Class::iface_init_function(void* g_iface, void*) //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc g_assert(klass != 0); -#ifdef GLIBMM_VFUNCS_ENABLED _IMPORT(SECTION_PCC_CLASS_INIT_VFUNCS) -#endif //GLIBMM_VFUNCS_ENABLED -#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED _IMPORT(SECTION_PCC_CLASS_INIT_DEFAULT_SIGNAL_HANDLERS) -#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED } -#ifdef GLIBMM_VFUNCS_ENABLED _IMPORT(SECTION_PCC_VFUNCS) -#endif //GLIBMM_VFUNCS_ENABLED -#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED _IMPORT(SECTION_PCC_DEFAULT_SIGNAL_HANDLERS) -#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED ') diff --git a/tools/m4/class_shared.m4 b/tools/m4/class_shared.m4 index 43e24939..c9286da6 100644 --- a/tools/m4/class_shared.m4 +++ b/tools/m4/class_shared.m4 @@ -11,20 +11,14 @@ define(`_H_VFUNCS_AND_SIGNALS',`dnl public: //C++ methods used to invoke GTK+ virtual functions: -#ifdef GLIBMM_VFUNCS_ENABLED _IMPORT(SECTION_H_VFUNCS_CPPWRAPPER) -#endif //GLIBMM_VFUNCS_ENABLED protected: //GTK+ Virtual Functions (override these to change behaviour): -#ifdef GLIBMM_VFUNCS_ENABLED _IMPORT(SECTION_H_VFUNCS) -#endif //GLIBMM_VFUNCS_ENABLED //Default Signal Handlers:: -#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED _IMPORT(SECTION_H_DEFAULT_SIGNAL_HANDLERS) -#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED ') @@ -97,17 +91,13 @@ ifdef(`__BOOL_DO_NOT_DERIVE_GTYPE__',`dnl protected: -#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED //Callbacks (default signal handlers): //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. //You could prevent the original default signal handlers being called by overriding the *_impl method. _IMPORT(SECTION_PH_DEFAULT_SIGNAL_HANDLERS) -#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED //Callbacks (virtual functions): -#ifdef GLIBMM_VFUNCS_ENABLED _IMPORT(SECTION_PH_VFUNCS) -#endif //GLIBMM_VFUNCS_ENABLED }; ') @@ -177,23 +167,15 @@ void __CPPNAME__`'_Class::class_init_function(void* g_class, void* class_data) BaseClassType *const klass = static_cast<BaseClassType*>(g_class); CppClassParent::class_init_function(klass, class_data); -#ifdef GLIBMM_VFUNCS_ENABLED _IMPORT(SECTION_PCC_CLASS_INIT_VFUNCS) -#endif //GLIBMM_VFUNCS_ENABLED -#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED _IMPORT(SECTION_PCC_CLASS_INIT_DEFAULT_SIGNAL_HANDLERS) -#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED } ')dnl -#ifdef GLIBMM_VFUNCS_ENABLED _IMPORT(SECTION_PCC_VFUNCS) -#endif //GLIBMM_VFUNCS_ENABLED -#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED _IMPORT(SECTION_PCC_DEFAULT_SIGNAL_HANDLERS) -#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED ') @@ -231,14 +213,10 @@ _IMPORT(SECTION_CC_SIGNALPROXIES) _IMPORT(SECTION_CC_PROPERTYPROXIES) -#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED _IMPORT(SECTION_CC_DEFAULT_SIGNAL_HANDLERS) -#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED -#ifdef GLIBMM_VFUNCS_ENABLED _IMPORT(SECTION_CC_VFUNCS) _IMPORT(SECTION_CC_VFUNCS_CPPWRAPPER) -#endif //GLIBMM_VFUNCS_ENABLED ') dnl _PARENT_GCLASS_FROM_OBJECT(object_instance_name) diff --git a/tools/m4/gerror.m4 b/tools/m4/gerror.m4 index 9bc27249..630f03bd 100644 --- a/tools/m4/gerror.m4 +++ b/tools/m4/gerror.m4 @@ -28,15 +28,10 @@ $4 #ifndef DOXYGEN_SHOULD_SKIP_THIS private: -#ifdef GLIBMM_EXCEPTIONS_ENABLED static void throw_func(GError* gobject); -#else - //When not using exceptions, we just pass the Exception object around without throwing it: - static std::auto_ptr<Glib::Error> throw_func(GError* gobject); -#endif //GLIBMM_EXCEPTIONS_ENABLED friend void wrap_init(); // uses throw_func() -#endif +#endif //DOXYGEN_SHOULD_SKIP_THIS }; m4_ifelse($5,`NO_GTYPE',,`dnl else @@ -76,18 +71,10 @@ __NAMESPACE__::__CPPNAME__::Code __NAMESPACE__::__CPPNAME__::code() const return static_cast<Code>(Glib::Error::code()); } -#ifdef GLIBMM_EXCEPTIONS_ENABLED void __NAMESPACE__::__CPPNAME__::throw_func(GError* gobject) { throw __NAMESPACE__::__CPPNAME__`'(gobject); } -#else -//When not using exceptions, we just pass the Exception object around without throwing it: -std::auto_ptr<Glib::Error> __NAMESPACE__::__CPPNAME__::throw_func(GError* gobject) -{ - return std::auto_ptr<Glib::Error>(new __NAMESPACE__::__CPPNAME__`'(gobject)); -} -#endif //GLIBMM_EXCEPTIONS_ENABLED m4_ifelse($5,`NO_GTYPE',,`dnl else // static diff --git a/tools/m4/method.m4 b/tools/m4/method.m4 index e5ed7282..20a8f3a3 100644 --- a/tools/m4/method.m4 +++ b/tools/m4/method.m4 @@ -17,13 +17,7 @@ ifelse(`$10',,,`_DEPRECATE_IFDEF_START ')dnl ifelse(`$13',,,`#ifdef $13' )dnl -ifelse(`$9',,,`#ifdef GLIBMM_EXCEPTIONS_ENABLED' -)dnl $3 __CPPNAME__::$1`'($5)ifelse(`$7',1,` const') -ifelse(`$9',,,`#else -$3 __CPPNAME__::$1`'(`'$5`'ifelse(($5),(),`',`, ')std::auto_ptr<Glib::Error>& error)ifelse(`$7',1,` const') -#endif //GLIBMM_EXCEPTIONS_ENABLED -')dnl { ifelse(`$11',,dnl `ifelse(`$8'`$9',,dnl If it is not errthrow or refreturn @@ -34,13 +28,8 @@ ifelse(`$11',,dnl `ifelse(`$9',,,` GError* gerror = 0;') ifelse(`$3',void,,``$3' retvalue = ')_CONVERT($4,$3,`$2`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6)');dnl ifelse(`$9',,,` -#ifdef GLIBMM_EXCEPTIONS_ENABLED if(gerror) ::Glib::Error::throw_exception(gerror); -#else - if(gerror) - error = ::Glib::Error::throw_exception(gerror); -#endif //GLIBMM_EXCEPTIONS_ENABLED ') ifelse(`$8',,,`dnl if(retvalue) @@ -68,13 +57,7 @@ ifelse(`$9',,,`_DEPRECATE_IFDEF_START ')dnl ifelse(`$10',,,`#ifdef $10' )dnl -ifelse(`$8',,,`#ifdef GLIBMM_EXCEPTIONS_ENABLED -')dnl $3 __CPPNAME__::$1($5) -ifelse(`$8',,,`#else -$3 __CPPNAME__::$1(`'$5`'ifelse(($5),(),`',`, ')std::auto_ptr<Glib::Error>& error) -#endif //GLIBMM_EXCEPTIONS_ENABLED -')dnl { ifelse(`$7'`$8',,dnl `ifelse(`$3',void,,` return ')_CONVERT($4,$3,`$2`'($6)'); @@ -82,13 +65,8 @@ ifelse(`$7'`$8',,dnl `ifelse(`$8',,,` GError* gerror = 0;') ifelse(`$3',void,,``$3' retvalue = ')_CONVERT($4,$3,`$2`'($6)'); ifelse(`$8',,,` -#ifdef GLIBMM_EXCEPTIONS_ENABLED if(gerror) ::Glib::Error::throw_exception(gerror); -#else - if(gerror) - error = ::Glib::Error::throw_exception(gerror); -#endif //GLIBMM_EXCEPTIONS_ENABLED ') ifelse(`$7',,,`dnl if(retvalue) diff --git a/tools/pm/Output.pm b/tools/pm/Output.pm index ea59ef59..511ea410 100644 --- a/tools/pm/Output.pm +++ b/tools/pm/Output.pm @@ -119,11 +119,9 @@ sub output_wrap_vfunc_h($$$$$$) $cppVfuncDecl .= " const"; } - $self->append("#ifdef GLIBMM_VFUNCS_ENABLED\n"); $self->ifdef($ifdef); $self->append(" $cppVfuncDecl;\n"); $self->endif($ifdef); - $self->append("#endif //GLIBMM_VFUNCS_ENABLED\n"); #The default callback, which will call *_vfunc, which will then call the base default callback. #Declares the callback in the private *Class class and sets it in the class_init function. @@ -291,46 +289,9 @@ sub output_wrap_meth($$$$$$$) # Doxygen documentation before the method declaration: $self->output_wrap_meth_docs_only($filename, $line_num, $documentation); - $self->ifdef($ifdef); - - if($$objCDefsFunc{throw_any_errors}) - { - $self->append("#ifdef GLIBMM_EXCEPTIONS_ENABLED\n"); - } + $self->ifdef($ifdef); $self->append(" ${cppMethodDecl};"); - - if($$objCDefsFunc{throw_any_errors}) - { - $self->append("\n#else\n"); - - # #Add an error argument, by searching for ) at the end and replacing it: - # my $declWithErrorArg = ${cppMethodDecl}; - # $declWithErrorArg =~ s/\)$/, std::auto_ptr<Glib::Error>& error\)/g; - - #Recreate the declaration, to remove the default values, which we can't have as well as an error parameter at the end: - my $declWithErrorArg = $$objCppfunc{rettype} . " " . $$objCppfunc{name} . "(" . $objCppfunc->args_types_and_names() . ", std::auto_ptr<Glib::Error>& error)"; - - if($$objCppfunc{static}) - { - $declWithErrorArg = "static " . $declWithErrorArg; - } - - if($objCppfunc->get_is_const() eq 1) - { - if($$objCppfunc{static} ne 1) #It can't be const and static at the same time. - { - $declWithErrorArg = $declWithErrorArg . " const"; - } - } - - #remove any superfluous ,: - $declWithErrorArg =~ s/\(, /\(/g; - - $self->append(" ${declWithErrorArg};"); - - $self->append("\n#endif //GLIBMM_EXCEPTIONS_ENABLED\n"); - } $self->endif($ifdef); |