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 /glib | |
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.
Diffstat (limited to 'glib')
35 files changed, 10 insertions, 977 deletions
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; } |