summaryrefslogtreecommitdiff
path: root/glib
diff options
context:
space:
mode:
Diffstat (limited to 'glib')
-rw-r--r--glib/glibmm/class.cc2
-rw-r--r--glib/glibmm/class.h1
-rw-r--r--glib/glibmm/dispatcher.cc21
-rw-r--r--glib/glibmm/dispatcher.h1
-rw-r--r--glib/glibmm/error.cc15
-rw-r--r--glib/glibmm/error.h15
-rw-r--r--glib/glibmm/exceptionhandler.cc4
-rw-r--r--glib/glibmm/exceptionhandler.h3
-rw-r--r--glib/glibmm/main.cc27
-rw-r--r--glib/glibmm/objectbase.h2
-rw-r--r--glib/glibmm/property.cc5
-rw-r--r--glib/glibmm/property.h5
-rw-r--r--glib/glibmm/propertyproxy.h2
-rw-r--r--glib/glibmm/propertyproxy_base.cc4
-rw-r--r--glib/glibmm/propertyproxy_base.h7
-rw-r--r--glib/glibmm/signalproxy.cc4
-rw-r--r--glib/glibmm/streamiochannel.cc28
-rw-r--r--glib/glibmm/stringutils.cc11
-rw-r--r--glib/glibmm/threadpool.cc4
-rw-r--r--glib/glibmm/ustring.cc12
-rw-r--r--glib/glibmm/value.cc8
-rw-r--r--glib/glibmm/value.h12
-rw-r--r--glib/glibmmconfig.h.in9
-rw-r--r--glib/src/convert.ccg210
-rw-r--r--glib/src/convert.hg55
-rw-r--r--glib/src/date.ccg11
-rw-r--r--glib/src/iochannel.ccg127
-rw-r--r--glib/src/iochannel.hg24
-rw-r--r--glib/src/markup.ccg20
-rw-r--r--glib/src/spawn.ccg4
-rw-r--r--glib/src/thread.ccg4
31 files changed, 556 insertions, 101 deletions
diff --git a/glib/glibmm/class.cc b/glib/glibmm/class.cc
index ff4a671d..596057a5 100644
--- a/glib/glibmm/class.cc
+++ b/glib/glibmm/class.cc
@@ -108,8 +108,10 @@ void Class::custom_class_init_function(void* g_class, void* class_data)
GObjectClass *const gobject_class = static_cast<GObjectClass*>(g_class);
+#ifdef GLIBMM_PROPERTIES_ENABLED
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/class.h b/glib/glibmm/class.h
index c7b5a96f..2610d758 100644
--- a/glib/glibmm/class.h
+++ b/glib/glibmm/class.h
@@ -23,6 +23,7 @@
*/
#include <glib-object.h>
+#include <glibmmconfig.h> //Include this here so that the /private/*.h classes have access to GLIBMM_VFUNCS_ENABLED
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/glib/glibmm/dispatcher.cc b/glib/glibmm/dispatcher.cc
index 3bda9fb1..28609129 100644
--- a/glib/glibmm/dispatcher.cc
+++ b/glib/glibmm/dispatcher.cc
@@ -188,8 +188,10 @@ DispatchNotifier::DispatchNotifier(const Glib::RefPtr<MainContext>& context)
{
create_pipe();
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
#ifdef G_OS_WIN32
conn_io_handler_ = context_->signal_io().connect(
sigc::mem_fun(*this, &DispatchNotifier::pipe_io_handler),
@@ -199,6 +201,7 @@ DispatchNotifier::DispatchNotifier(const Glib::RefPtr<MainContext>& context)
sigc::mem_fun(*this, &DispatchNotifier::pipe_io_handler),
fd_receiver_, Glib::IO_IN);
#endif /* !G_OS_WIN32 */
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
@@ -209,6 +212,7 @@ DispatchNotifier::DispatchNotifier(const Glib::RefPtr<MainContext>& context)
throw;
}
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
}
DispatchNotifier::~DispatchNotifier()
@@ -231,20 +235,29 @@ void DispatchNotifier::create_pipe()
if(!fd_receiver_)
{
+#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
+ return; //TODO: Provide an alternative to the exception.
+#endif //GLIBMM_EXCEPTIONS_ENABLED
}
+
#else /* !G_OS_WIN32 */
int filedes[2] = { -1, -1 };
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
+ return; //TODO: Provide an alternative to the exception.
+#endif //GLIBMM_EXCEPTIONS_ENABLED
}
fd_set_close_on_exec(filedes[0]);
@@ -353,14 +366,18 @@ bool DispatchNotifier::pipe_io_handler(Glib::IOCondition)
// 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.
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
data.dispatcher->signal_();
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
}
#else /* !G_OS_WIN32 */
DispatchNotifyData data;
@@ -390,14 +407,18 @@ bool DispatchNotifier::pipe_io_handler(Glib::IOCondition)
// 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.
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
data.dispatcher->signal_(); // emit
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
#endif /* !G_OS_WIN32 */
return true;
diff --git a/glib/glibmm/dispatcher.h b/glib/glibmm/dispatcher.h
index cecf606e..3cfa754d 100644
--- a/glib/glibmm/dispatcher.h
+++ b/glib/glibmm/dispatcher.h
@@ -67,6 +67,7 @@ public:
* @throw Glib::FileError
*/
Dispatcher();
+
/** Create new Dispatcher instance using an arbitrary main context.
* @throw Glib::FileError
*/
diff --git a/glib/glibmm/error.cc b/glib/glibmm/error.cc
index 2e8f0723..fea6d660 100644
--- a/glib/glibmm/error.cc
+++ b/glib/glibmm/error.cc
@@ -30,7 +30,6 @@
GLIBMM_USING_STD(map)
-
namespace
{
@@ -131,7 +130,6 @@ void Error::propagate(GError** dest)
gobject_ = 0;
}
-
// static
void Error::register_init()
{
@@ -160,8 +158,12 @@ 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);
@@ -171,7 +173,11 @@ void 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();
}
@@ -179,9 +185,14 @@ void 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
}
+
} // namespace Glib
diff --git a/glib/glibmm/error.h b/glib/glibmm/error.h
index d4c39e6d..835b026b 100644
--- a/glib/glibmm/error.h
+++ b/glib/glibmm/error.h
@@ -26,6 +26,12 @@ extern "C" { typedef struct _GError GError; }
#include <glib/gquark.h>
#include <glibmm/exception.h>
+#include <glibmmconfig.h> //For GLIBMM_EXCEPTIONS_ENABLED
+
+#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
@@ -56,13 +62,22 @@ 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) G_GNUC_NORETURN;
+#endif //GLIBMM_EXCEPTIONS_ENABLED
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
diff --git a/glib/glibmm/exceptionhandler.cc b/glib/glibmm/exceptionhandler.cc
index cfe68924..c879972a 100644
--- a/glib/glibmm/exceptionhandler.cc
+++ b/glib/glibmm/exceptionhandler.cc
@@ -32,6 +32,7 @@
GLIBMM_USING_STD(exception)
GLIBMM_USING_STD(list)
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
namespace
{
@@ -157,3 +158,6 @@ void exception_handlers_invoke() throw()
} // namespace Glib
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+
diff --git a/glib/glibmm/exceptionhandler.h b/glib/glibmm/exceptionhandler.h
index de1d68f4..03079399 100644
--- a/glib/glibmm/exceptionhandler.h
+++ b/glib/glibmm/exceptionhandler.h
@@ -24,7 +24,9 @@
*/
#include <sigc++/sigc++.h>
+#include <glibmmconfig.h>
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
namespace Glib
{
@@ -40,6 +42,7 @@ void exception_handlers_invoke() throw();
} // namespace Glib
+#endif //GLIBMM_EXCEPTIONS_ENABLED
#endif /* _GLIBMM_EXCEPTIONHANDLER_H */
diff --git a/glib/glibmm/main.cc b/glib/glibmm/main.cc
index f040f053..cada0401 100644
--- a/glib/glibmm/main.cc
+++ b/glib/glibmm/main.cc
@@ -189,15 +189,19 @@ 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;
}
@@ -206,16 +210,20 @@ 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;
}
@@ -227,15 +235,18 @@ 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;
}
@@ -806,30 +817,40 @@ 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;
}
// 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;
}
@@ -841,15 +862,19 @@ 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/objectbase.h b/glib/glibmm/objectbase.h
index 2b152fbb..75c2788b 100644
--- a/glib/glibmm/objectbase.h
+++ b/glib/glibmm/objectbase.h
@@ -23,6 +23,8 @@
#include <glibmm/signalproxy.h>
#include <glibmm/propertyproxy.h>
+#include <glibmm/ustring.h>
+#include <glibmm/value.h>
#include <sigc++/trackable.h>
#include <typeinfo>
#include <glibmmconfig.h>
diff --git a/glib/glibmm/property.cc b/glib/glibmm/property.cc
index 73d22ffd..f8f52b2f 100644
--- a/glib/glibmm/property.cc
+++ b/glib/glibmm/property.cc
@@ -19,6 +19,9 @@
*/
#include <glibmm/property.h>
+
+#ifdef GLIBMM_PROPERTIES_ENABLED
+
#include <glibmm/object.h>
#include <cstddef>
@@ -196,3 +199,5 @@ void PropertyBase::notify()
} // namespace Glib
+#endif //GLIBMM_PROPERTIES_ENABLED
+
diff --git a/glib/glibmm/property.h b/glib/glibmm/property.h
index f25ef84d..2b524f9b 100644
--- a/glib/glibmm/property.h
+++ b/glib/glibmm/property.h
@@ -21,8 +21,10 @@
*/
#include <glibmm/propertyproxy.h>
-#include <glibmm/value.h>
+#ifdef GLIBMM_PROPERTIES_ENABLED
+
+#include <glibmm/value.h>
namespace Glib
{
@@ -166,6 +168,7 @@ 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 e21c4b25..392f5c24 100644
--- a/glib/glibmm/propertyproxy.h
+++ b/glib/glibmm/propertyproxy.h
@@ -24,6 +24,7 @@
#include <glibmm/propertyproxy_base.h>
+#ifdef GLIBMM_PROPERTIES_ENABLED
namespace Glib
{
@@ -174,6 +175,7 @@ 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 d10c8cd3..d542c193 100644
--- a/glib/glibmm/propertyproxy_base.cc
+++ b/glib/glibmm/propertyproxy_base.cc
@@ -21,6 +21,9 @@
*/
#include <glibmm/propertyproxy_base.h>
+
+#ifdef GLIBMM_PROPERTIES_ENABLED
+
#include <glibmm/signalproxy_connectionnode.h>
#include <glibmm/object.h>
#include <glibmm/private/object_p.h>
@@ -149,3 +152,4 @@ void PropertyProxy_Base::reset_property_()
} // namespace Glib
+#endif //GLIBMM_PROPERTIES_ENABLED
diff --git a/glib/glibmm/propertyproxy_base.h b/glib/glibmm/propertyproxy_base.h
index 036291df..5f7f8743 100644
--- a/glib/glibmm/propertyproxy_base.h
+++ b/glib/glibmm/propertyproxy_base.h
@@ -22,10 +22,13 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmmconfig.h>
+
+#ifdef GLIBMM_PROPERTIES_ENABLED
+
#include <glibmm/value.h>
#include <glibmm/signalproxy.h>
-
namespace Glib
{
@@ -80,5 +83,7 @@ private:
} // namespace Glib
+#endif //GLIBMM_PROPERTIES_ENABLED
+
#endif /* _GLIBMM_PROPERTYPROXY_BASE_H */
diff --git a/glib/glibmm/signalproxy.cc b/glib/glibmm/signalproxy.cc
index 67f7a929..6b6ed645 100644
--- a/glib/glibmm/signalproxy.cc
+++ b/glib/glibmm/signalproxy.cc
@@ -89,15 +89,19 @@ 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 985931de..e535cecd 100644
--- a/glib/glibmm/streamiochannel.cc
+++ b/glib/glibmm/streamiochannel.cc
@@ -69,7 +69,13 @@ IOStatus StreamIOChannel::read_vfunc(char* buf, gsize count, gsize& bytes_read)
return IO_STATUS_EOF;
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;
}
@@ -84,7 +90,13 @@ IOStatus StreamIOChannel::write_vfunc(const char* buf, gsize count, gsize& bytes
stream_out_->write(buf, count);
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 ;)
@@ -118,7 +130,13 @@ 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;
}
@@ -147,12 +165,22 @@ 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 7113c014..7a464138 100644
--- a/glib/glibmm/stringutils.cc
+++ b/glib/glibmm/stringutils.cc
@@ -51,7 +51,13 @@ double Glib::Ascii::strtod(const std::string& str,
std::string::size_type start_index)
{
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();
char* endptr = 0;
@@ -63,6 +69,8 @@ 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");
@@ -70,6 +78,9 @@ 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 db9b089c..556eeb72 100644
--- a/glib/glibmm/threadpool.cc
+++ b/glib/glibmm/threadpool.cc
@@ -100,14 +100,17 @@ 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&)
{
@@ -118,6 +121,7 @@ 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 788658ae..36d709da 100644
--- a/glib/glibmm/ustring.cc
+++ b/glib/glibmm/ustring.cc
@@ -1193,13 +1193,25 @@ std::istream& operator>>(std::istream& is, Glib::ustring& utf8_string)
{
std::string locale_string;
is >> locale_string;
+
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
utf8_string = Glib::locale_to_utf8(locale_string);
+ #else
+ std::auto_ptr<Glib::Error> error; //TODO: Check this?
+ utf8_string = Glib::locale_to_utf8(locale_string, error);
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
return is;
}
std::ostream& operator<<(std::ostream& os, const Glib::ustring& utf8_string)
{
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
os << Glib::locale_from_utf8(utf8_string);
+ #else
+ std::auto_ptr<Glib::Error> error; //TODO: Check this?
+ os << Glib::locale_from_utf8(utf8_string, error);
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+
return os;
}
diff --git a/glib/glibmm/value.cc b/glib/glibmm/value.cc
index 12ba6fc9..adb3e902 100644
--- a/glib/glibmm/value.cc
+++ b/glib/glibmm/value.cc
@@ -39,14 +39,6 @@ void ValueBase::init(GType type)
g_value_init(&gobject_, type);
}
-void ValueBase::init(const GValue* value)
-{
- g_value_init(&gobject_, G_VALUE_TYPE(value));
-
- if(value)
- g_value_copy(value, &gobject_);
-}
-
ValueBase::ValueBase(const ValueBase& other)
{
GLIBMM_INITIALIZE_STRUCT(gobject_, GValue);
diff --git a/glib/glibmm/value.h b/glib/glibmm/value.h
index a891418c..94203a32 100644
--- a/glib/glibmm/value.h
+++ b/glib/glibmm/value.h
@@ -69,21 +69,9 @@ public:
*
* init() is not implemented as constructor, to avoid the necessity
* to implement a forward constructor in each derived class.
- *
- * @param type The type that the Value should hold.
*/
void init(GType type);
- /** Setup the GValue storing the type and value of the specified @a value.
- * Note that init() should never be called twice.
- *
- * init() is not implemented as constructor, to avoid the necessity
- * to implement a forward constructor in each derived class.
- *
- * @param value The existing GValue.
- */
- void init(const GValue* value);
-
/** Reset contents to the default value of its type.
*/
void reset();
diff --git a/glib/glibmmconfig.h.in b/glib/glibmmconfig.h.in
index d3081cae..292b0f23 100644
--- a/glib/glibmmconfig.h.in
+++ b/glib/glibmmconfig.h.in
@@ -28,9 +28,6 @@
#endif /* _WIN32 */
#ifdef GLIBMM_CONFIGURE
-/* compiler feature tests that are used during compile time and run-time
- by gtk-- only. tests used by gdk-- and gtk-- should go into
- gdk--config.h.in */
#undef GLIBMM_CXX_HAVE_MUTABLE
#undef GLIBMM_CXX_HAVE_NAMESPACES
//#undef GLIBMM_CXX_GAUB
@@ -46,6 +43,9 @@
#undef GLIBMM_CAN_ASSIGN_NON_EXTERN_C_FUNCTIONS_TO_EXTERN_C_CALLBACKS
#undef GLIBMM_CAN_USE_NAMESPACES_INSIDE_EXTERNC
#undef GLIBMM_HAVE_ALLOWS_STATIC_INLINE_NPOS
+#undef GLIBMM_PROPERTIES_ENABLED
+#undef GLIBMM_VFUNCS_ENABLED
+#undef GLIBMM_EXCEPTIONS_ENABLED
#endif
#ifdef GLIBMM_MSC
@@ -58,6 +58,9 @@
#define GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION 1
#define GLIBMM_CAN_ASSIGN_NON_EXTERN_C_FUNCTIONS_TO_EXTERN_C_CALLBACKS 1
#define GLIBMM_CAN_USE_NAMESPACES_INSIDE_EXTERNC 1
+ #define GLIBMM_PROPERTIES_ENABLED 1
+ #define GLIBMM_VFUNCS_ENABLED 1
+ #define GLIBMM_EXCEPTIONS_ENABLED 1
#pragma warning (disable: 4786 4355 4800 4181)
#endif
diff --git a/glib/src/convert.ccg b/glib/src/convert.ccg
index b888e8d5..9a4dae14 100644
--- a/glib/src/convert.ccg
+++ b/glib/src/convert.ccg
@@ -35,17 +35,19 @@ IConv::IConv(const std::string& to_codeset, const std::string& from_codeset)
{
if(gobject_ == reinterpret_cast<GIConv>(-1))
{
- GError* error = 0;
+ GError* gerror = 0;
// Abuse g_convert() to create a GError object. This may seem a weird
// thing to do, but it gives us consistently translated error messages
// at no further cost.
- g_convert("", 0, to_codeset.c_str(), from_codeset.c_str(), 0, 0, &error);
+ g_convert("", 0, to_codeset.c_str(), from_codeset.c_str(), 0, 0, &gerror);
// If this should ever fail we're fucked.
- g_assert(error != 0);
+ g_assert(gerror != 0);
- Error::throw_exception(error);
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror) ::Glib::Error::throw_exception(gerror);
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
}
}
@@ -77,16 +79,23 @@ 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* error = 0;
+ GError* gerror = 0;
char *const buf = g_convert_with_iconv(
- str.data(), str.size(), gobject_, 0, &bytes_written, &error);
+ str.data(), str.size(), gobject_, 0, &bytes_written, &gerror);
- if(error)
- Error::throw_exception(error);
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror) ::Glib::Error::throw_exception(gerror);
+ #else
+ error = ::Glib::Error::throw_exception(gerror);
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
return std::string(ScopedPtr<char>(buf).get(), bytes_written);
}
@@ -108,125 +117,196 @@ bool get_charset(std::string& charset)
return is_utf8;
}
+
+#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* error = 0;
+ GError* gerror = 0;
char *const buf = g_convert(
str.data(), str.size(), to_codeset.c_str(), from_codeset.c_str(),
- 0, &bytes_written, &error);
+ 0, &bytes_written, &gerror);
- if(error)
- Error::throw_exception(error);
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror) ::Glib::Error::throw_exception(gerror);
+ #else
+ 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* error = 0;
+ GError* gerror = 0;
char *const buf = g_convert_with_fallback(
str.data(), str.size(), to_codeset.c_str(), from_codeset.c_str(), 0,
- 0, &bytes_written, &error);
+ 0, &bytes_written, &gerror);
- if(error)
- Error::throw_exception(error);
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror) ::Glib::Error::throw_exception(gerror);
+ #else
+ 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* error = 0;
+ GError* gerror = 0;
char *const buf = g_convert_with_fallback(
str.data(), str.size(), to_codeset.c_str(), from_codeset.c_str(),
- const_cast<char*>(fallback.c_str()), 0, &bytes_written, &error);
+ const_cast<char*>(fallback.c_str()), 0, &bytes_written, &gerror);
- if(error)
- Error::throw_exception(error);
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror) ::Glib::Error::throw_exception(gerror);
+ #else
+ 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* error = 0;
+ GError* gerror = 0;
char *const buf = g_locale_to_utf8(
- opsys_string.data(), opsys_string.size(), 0, &bytes_written, &error);
+ opsys_string.data(), opsys_string.size(), 0, &bytes_written, &gerror);
- if(error)
- Error::throw_exception(error);
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror) ::Glib::Error::throw_exception(gerror);
+ #else
+ 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* error = 0;
+ GError* gerror = 0;
char *const buf = g_locale_from_utf8(
- utf8_string.data(), utf8_string.bytes(), 0, &bytes_written, &error);
+ utf8_string.data(), utf8_string.bytes(), 0, &bytes_written, &gerror);
- if(error)
- Error::throw_exception(error);
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror) ::Glib::Error::throw_exception(gerror);
+ #else
+ 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* error = 0;
+ GError* gerror = 0;
char *const buf = g_filename_to_utf8(
- opsys_string.data(), opsys_string.size(), 0, &bytes_written, &error);
+ opsys_string.data(), opsys_string.size(), 0, &bytes_written, &gerror);
- if(error)
- Error::throw_exception(error);
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror) ::Glib::Error::throw_exception(gerror);
+ #else
+ 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* error = 0;
+ GError* gerror = 0;
char *const buf = g_filename_from_utf8(
- utf8_string.data(), utf8_string.bytes(), 0, &bytes_written, &error);
+ utf8_string.data(), utf8_string.bytes(), 0, &bytes_written, &gerror);
- if(error)
- Error::throw_exception(error);
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror) ::Glib::Error::throw_exception(gerror);
+ #else
+ 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* error = 0;
+ GError* gerror = 0;
- char *const buf = g_filename_from_uri(uri.c_str(), &hostname_buf, &error);
+ char *const buf = g_filename_from_uri(uri.c_str(), &hostname_buf, &gerror);
- if(error)
- Error::throw_exception(error);
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror) ::Glib::Error::throw_exception(gerror);
+ #else
+ error = ::Glib::Error::throw_exception(gerror);
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
// Let's take ownership at this point.
const ScopedPtr<char> scoped_buf (buf);
@@ -239,35 +319,59 @@ std::string filename_from_uri(const Glib::ustring& uri, Glib::ustring& hostname)
return std::string(scoped_buf.get());
}
+
+#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* error = 0;
- char *const buf = g_filename_from_uri(uri.c_str(), 0, &error);
+ GError* gerror = 0;
+ char *const buf = g_filename_from_uri(uri.c_str(), 0, &gerror);
- if(error)
- Error::throw_exception(error);
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror) ::Glib::Error::throw_exception(gerror);
+ #else
+ 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* error = 0;
- char *const buf = g_filename_to_uri(filename.c_str(), hostname.c_str(), &error);
+ GError* gerror = 0;
+ char *const buf = g_filename_to_uri(filename.c_str(), hostname.c_str(), &gerror);
- if(error)
- Error::throw_exception(error);
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror) ::Glib::Error::throw_exception(gerror);
+ #else
+ 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* error = 0;
- char *const buf = g_filename_to_uri(filename.c_str(), 0, &error);
-
- if(error)
- Error::throw_exception(error);
+ 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
+ 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 8c206d26..cfa326bf 100644
--- a/glib/src/convert.hg
+++ b/glib/src/convert.hg
@@ -92,7 +92,11 @@ 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_; }
@@ -123,9 +127,15 @@ 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.
@@ -137,9 +147,15 @@ 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.
@@ -157,10 +173,17 @@ 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().
@@ -169,7 +192,11 @@ 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().
@@ -178,7 +205,11 @@ Glib::ustring locale_to_utf8(const std::string& opsys_string);
* 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.
@@ -186,14 +217,22 @@ std::string locale_from_utf8(const Glib::ustring& utf8_string);
* @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.
@@ -203,7 +242,11 @@ std::string filename_from_utf8(const Glib::ustring& utf8_string);
* @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.
@@ -211,7 +254,11 @@ 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
@@ -220,7 +267,11 @@ std::string filename_from_uri(const Glib::ustring& uri);
* @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
@@ -228,7 +279,11 @@ 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 e70a0e26..b59810ab 100644
--- a/glib/src/date.ccg
+++ b/glib/src/date.ccg
@@ -280,7 +280,13 @@ 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);
do
@@ -295,7 +301,12 @@ 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/iochannel.ccg b/glib/src/iochannel.ccg
index 6e637079..03783a4a 100644
--- a/glib/src/iochannel.ccg
+++ b/glib/src/iochannel.ccg
@@ -171,13 +171,23 @@ 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* error = 0;
- GIOChannel *const channel = g_io_channel_new_file(filename.c_str(), mode.c_str(), &error);
+ GError* gerror = 0;
+ GIOChannel *const channel = g_io_channel_new_file(filename.c_str(), mode.c_str(), &gerror);
- if(error)
- Glib::Error::throw_exception(error);
+ 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);
}
@@ -201,22 +211,40 @@ 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* error = 0;
+ GError* gerror = 0;
gsize bytes = 0;
- const GIOStatus status = g_io_channel_read_line(gobj(), buf.addr(), &bytes, 0, &error);
+ const GIOStatus status = g_io_channel_read_line(gobj(), buf.addr(), &bytes, 0, &gerror);
- if(error)
- Glib::Error::throw_exception(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())
line.assign(buf.get(), buf.get() + bytes);
@@ -226,16 +254,26 @@ IOStatus IOChannel::read_line(Glib::ustring& line)
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* error = 0;
+ GError* gerror = 0;
gsize bytes = 0;
- const GIOStatus status = g_io_channel_read_to_end(gobj(), buf.addr(), &bytes, &error);
+ const GIOStatus status = g_io_channel_read_to_end(gobj(), buf.addr(), &bytes, &gerror);
- if(error)
- Glib::Error::throw_exception(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())
str.assign(buf.get(), buf.get() + bytes);
@@ -245,16 +283,26 @@ IOStatus IOChannel::read_to_end(Glib::ustring& str)
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* error = 0;
+ GError* gerror = 0;
gsize bytes = 0;
- const GIOStatus status = g_io_channel_read_chars(gobj(), buf.get(), count, &bytes, &error);
+ const GIOStatus status = g_io_channel_read_chars(gobj(), buf.get(), count, &bytes, &gerror);
- if(error)
- Glib::Error::throw_exception(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())
str.assign(buf.get(), buf.get() + bytes);
@@ -264,15 +312,25 @@ IOStatus IOChannel::read(Glib::ustring& str, gsize count)
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* error = 0;
+ GError* gerror = 0;
const GIOStatus status = g_io_channel_set_encoding(
- gobj(), (encoding.empty()) ? 0 : encoding.c_str(), &error);
+ gobj(), (encoding.empty()) ? 0 : encoding.c_str(), &gerror);
- if(error)
- Glib::Error::throw_exception(error);
+ 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;
}
@@ -391,9 +449,12 @@ GIOStatus GlibmmIOChannel::io_read(GIOChannel* channel, char* buf, gsize count,
{
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)
{
@@ -403,6 +464,7 @@ GIOStatus GlibmmIOChannel::io_read(GIOChannel* channel, char* buf, gsize count,
{
Glib::exception_handlers_invoke();
}
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
return G_IO_STATUS_ERROR;
}
@@ -413,9 +475,12 @@ GIOStatus GlibmmIOChannel::io_write(GIOChannel* channel, const char* buf, gsize
{
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)
{
@@ -425,6 +490,7 @@ GIOStatus GlibmmIOChannel::io_write(GIOChannel* channel, const char* buf, gsize
{
Glib::exception_handlers_invoke();
}
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
return G_IO_STATUS_ERROR;
}
@@ -434,9 +500,12 @@ GIOStatus GlibmmIOChannel::io_seek(GIOChannel* channel, gint64 offset, GSeekType
{
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)
{
@@ -446,6 +515,7 @@ GIOStatus GlibmmIOChannel::io_seek(GIOChannel* channel, gint64 offset, GSeekType
{
Glib::exception_handlers_invoke();
}
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
return G_IO_STATUS_ERROR;
}
@@ -455,9 +525,12 @@ GIOStatus GlibmmIOChannel::io_close(GIOChannel* channel, GError** err)
{
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)
{
@@ -467,6 +540,8 @@ GIOStatus GlibmmIOChannel::io_close(GIOChannel* channel, GError** err)
{
Glib::exception_handlers_invoke();
}
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+
return G_IO_STATUS_ERROR;
}
@@ -476,15 +551,19 @@ 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;
}
@@ -506,9 +585,12 @@ GIOStatus GlibmmIOChannel::io_set_flags(GIOChannel* channel, GIOFlags flags, GEr
{
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)
{
@@ -518,6 +600,7 @@ GIOStatus GlibmmIOChannel::io_set_flags(GIOChannel* channel, GIOFlags flags, GEr
{
Glib::exception_handlers_invoke();
}
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
return G_IO_STATUS_ERROR;
}
@@ -527,14 +610,18 @@ 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 f109235d..7edd0cab 100644
--- a/glib/src/iochannel.hg
+++ b/glib/src/iochannel.hg
@@ -109,7 +109,11 @@ 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,7 +192,11 @@ 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
@@ -198,7 +206,11 @@ 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.
@@ -208,7 +220,11 @@ 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.
@@ -220,7 +236,11 @@ 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.
@@ -379,7 +399,11 @@ 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/markup.ccg b/glib/src/markup.ccg
index 2b61a358..16dfcf3f 100644
--- a/glib/src/markup.ccg
+++ b/glib/src/markup.ccg
@@ -101,8 +101,10 @@ void ParserCallbacks::start_element(GMarkupParseContext* context,
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)
@@ -117,6 +119,7 @@ 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)
{
@@ -126,6 +129,7 @@ void ParserCallbacks::start_element(GMarkupParseContext* context,
{
Glib::exception_handlers_invoke();
}
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
}
void ParserCallbacks::end_element(GMarkupParseContext* context,
@@ -136,9 +140,12 @@ void ParserCallbacks::end_element(GMarkupParseContext* context,
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)
{
@@ -148,6 +155,7 @@ void ParserCallbacks::end_element(GMarkupParseContext* context,
{
Glib::exception_handlers_invoke();
}
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
}
void ParserCallbacks::text(GMarkupParseContext* context,
@@ -159,9 +167,12 @@ void ParserCallbacks::text(GMarkupParseContext* context,
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)
{
@@ -171,6 +182,7 @@ void ParserCallbacks::text(GMarkupParseContext* context,
{
Glib::exception_handlers_invoke();
}
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
}
void ParserCallbacks::passthrough(GMarkupParseContext* context,
@@ -182,10 +194,13 @@ void ParserCallbacks::passthrough(GMarkupParseContext* context,
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)
{
@@ -195,6 +210,7 @@ void ParserCallbacks::passthrough(GMarkupParseContext* context,
{
Glib::exception_handlers_invoke();
}
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
}
void ParserCallbacks::error(GMarkupParseContext* context,
@@ -206,14 +222,18 @@ 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/spawn.ccg b/glib/src/spawn.ccg
index 5007ad9c..c45c48e6 100644
--- a/glib/src/spawn.ccg
+++ b/glib/src/spawn.ccg
@@ -35,14 +35,18 @@ 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)
diff --git a/glib/src/thread.ccg b/glib/src/thread.ccg
index a041e35e..962311fb 100644
--- a/glib/src/thread.ccg
+++ b/glib/src/thread.ccg
@@ -32,10 +32,13 @@ 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&)
{
@@ -46,6 +49,7 @@ static void* call_thread_entry_slot(void* data)
{
Glib::exception_handlers_invoke();
}
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
delete slot;
return 0;