13
0

Updated libglibmm2 to glibmm-2.12.5

git-svn-id: svn://localhost/ardour2/branches/2.1-staging@1415 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Taybin Rutkin 2007-02-03 03:07:25 +00:00
parent f76fc34c29
commit 71d30c7f2d
86 changed files with 2429 additions and 402 deletions

View File

@ -1,13 +0,0 @@
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.log
config.status
configure
glibmm-2.4.pc
glibmmconfig.h
libtool
stamp-h1
*.os
*.dylib

View File

@ -1,3 +1,624 @@
2.12.5:
Thu, 25 Jan 2007 23:13:05 +0100 Dodji Seketeli
* tools/m4/base.m4:
prefix the builting mkstemp with 'm4' because otherwise,
m4 1.4.8 recognizes it as a builtin macro and expands it, leading
to compilation errors on some distros.
This should fix #397167. Thanks to Daniel Elstner for spotting this.
2.12.4:
2006-11-28 Daniel Elstner <danielk@openismus.com>
* tools/pm/GtkDefs.pm (read_defs): Allow an empty pair of
parentheses in the innermost match. This fixes the problem of
gmmproc choking on "()" in the documentation strings. This would
still break on unmatched parentheses, though. Of course the
parser should just skip over quoted strings, but I wasn't able
to get that to work.
* glib/src/glib_enums.defs (GNormalizeMode): Manually fix the
improperly parsed value of G_NORMALIZE_NFD. Fortunately this
doesn't change anything since the "#error" token was interpreted
as zero, which happens to be the right value.
* glib/src/glib_functions.defs (g_iconv): Manually convert to
a function definition, as it was improperly parsed as a method
with a zero-length name (!) of object GIConv. This fixes the
annoying gmmproc warning about an allegedly unwrapped method.
2006-11-27 Daniel Elstner <danielk@openismus.com>
* tools/enum.pl (parse): Ignore whitespace in front of an enum
typedef. This fixes parsing of HildonTelephoneEditorFormat in
hildon-libs.
* tools/pm/Enum.pm (parse_values): Check whether the enumeration
constants actually have a common module prefix before attempting
to remove it. This fixes the incorrect parsing of inconsistently
named enums in hildon-libs.
2006-11-27 Daniel Elstner <danielk@openismus.com>
* tools/enum.pl (form_names): Break the loop if the length of the
common prefix reaches zero. This fixes the infinite loop when
processing the inconsistently named enumeration constants of the
Hildon libraries.
2006-11-22 Oliver Nittka <oly@nittka.com>
* glib/src/value_basictypes.cc.m4: When registering float parameters,
use -G_MAXFLOAT instead of G_MINFLOAT. Since we first implemented this,
the glib documentation has been updated to make it clearer that this is
the real minimum and G_MINFLOAT is the minimum positive value.
Do the same for doubles too.
2.12.3:
2006-11-10 Murray Cumming <murrayc@murrayc.com>
* tools/Makefile.am: Add enum.pl to the dist, so that it is in
tarballs. Someone saw it mentioned in the appendix, but could not
find it in the tarball.
2006-11-10 Murray Cumming <murrayc@murrayc.com>
* docs/reference/Doxyfile.in: Add PREDEFINES for the optional API,
so that the documentation shows the regular API.
2006-11-10 Murray Cumming <murrayc@murrayc.com>
* glib/glibmm/objectbase.cc:
* glib/glibmm/objectbase.h: Added connect_property_changed(),
as an alternative to use when the property proxies are not
available because GLIBMM_PROPERTIES_ENABLED is not defined.
SignalProxyProperty::connect(): Use notify::propertyname instead of
just notify, so do not have to check the property name later. This
should be more efficient (when this is used, rarely).
* glib/glibmm/propertyproxy_base.cc:
* glib/glibmm/propertyproxy_base.h: Move PropertyProxyConnectionNode
into the header, so we can reuse it for connect_property_changed().
2006-10-01 Murray Cumming <murrayc@murrayc.com>
* Makefile.am:
* docs/Makefile.am:
* docs/Makefile_web.am_fragment:
* docs/images/Makefile.am:
* docs/reference/Makefile.am:
* docs/reference/README:
* examples/Makefile.am: Upload to the new hoster instead of to sourceforge.
Abstracted the host and path names into docs/Makefile_web.am_fragment to
avoid duplication.
2006-10-04 Murray Cumming <murrayc@murrayc.com>
* glib/glibmm/class.cc:
* glib/src/iochannel.ccg:
* glib/src/markup.ccg: Add a silly line to avoid unused parameters
when GLIBMM_EXCEPTION_ENABLED is not set.
* glib/glibmm/error.h: Do not use G_GNU_NO_RETURN on the version
of throw_exception() that returns, to avoid a warning.
2006-09-19 Ralf Stephan <ralf@ark.in-berlin.de>
* glib/glibmm/ustring.h:
ustring(const ustring& src, size_type i, size_type n=npos)
and
ustring(const char* src, size_type n) constructors:
In the reference documentation, mention explicitly that
n is the number of _UTF-8_ characters, rather than
ASCII characters (bytes).
2.12.2:
2006-09-28 Cedric Gustin <cedric.gustin@gmail.com>
* MSVC_Net2003/glibmm/glibmm.vcproj: Remove sarray from list of
source and header files.
2006-09-26 Murray Cumming <murrayc@murrayc.com>
* glib/glibmmconfig.h.in: For win32, define
GLIBMM_ARG_ENABLE_API_DEFAULT_SIGNAL_HANDLERS to 1,
instead of just defining it to nothing.
* scripts/reduced.m4: In the AC_ARG_ENABLE() to
define (or not) GLIBMM_ARG_ENABLE_API_DEFAULT_SIGNAL_HANDLERS,
use api-default-signal-handlers as the first parameter
instead of api-exceptions (a copy/paste error), though it does
not seem to make any difference.
Bug #357830.
2.12.1:
2006-09-14 Johannes Schmid <jhs@gnome.org>
* tools/m4/class_shared.m4: Change _IMPLEMENTS_INTERFACE to
_IMPLEMENTS_INTERFACE_CC so we can have more control over it,
by generating the _IMPLEMENTS_INTERFACE_CC from the WrapParser.pm.
* tools/m4/method.m4:
* tools/m4/signal.m4:
* tools/m4/vfunc.m4: Added optional parameters that result in
#ifdefs around methods, signals, vfuncs, etc.
* tools/pm/Output.pm: Addef ifdef() and endif().
output_wrap_vfunc_h(), output_wrap_vfunc_cc(),
output_wrap_default_signal_handler_h(),
output_wrap_default_signal_handler_cc(),
output_wrap_meth(),
output_wrap_create(),
output_wrap_sig_decl(): Support optional ifdefs around
declarations and implementations, by calling ifdef() and endif(),
or by passing the extra argument to the m4 macros.
* tools/pm/WrapParser.pm: parse_and_build_output():
Parse _IMPLEMENTS_INTERFACE, and call the new on_implements_interface()
method, which uses the new output_implements_interface() method,
so it can have an optional ifdef parameter.
on_wrap_method(), on_wrap_create(), on_wrap_vfunc(), output_wrap_signal(),
output_wrap_vfunc(): Handle the optional ifdef (with a parameter) option
for the _WRAP*() macros.
This adds support for disabling certain features by using the new
"ifdef" argument for methods, vfuncs, signals and interfaces.
2006-08-18 Cedric Gustin <cedric.gustin@gmail.com>
* MSVC_Net2003/*.vcproj: Updated for glibmm-2.12.
2.12.0:
2.11.3:
2006-04-25 Murray Cumming <murrayc@murrayc.com>
* configure.in:
* glib/glibmmconfig.h.in:
* scripts/reduced.m4: Added a --enable-api-default-signal-handlers option. This defines
GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED, which is used to #ifdef default signal handlers.
This saves on library code size (less code and API symbols) and application code size and
loading time (less virtual methods, which must be imported and resolved at load time) and
per-object memory size (smaller object sizes because of less virtual methods.)
* tools/m4/class_interface.m4:
* tools/m4/class_shared.m4: Put default signal handler code in #ifdefs.
2.11.2:
2006-07-17 Murray Cumming <murrayc@murrayc.com>
* configure.in: Reverted the previous patch slightly to unbreak glibmmconfig.h.
2.11.1:
2006-07-16 Murray Cumming <murrayc@murrayc.com>
* configure.in: Quote GLIBMM_*_VERSION to avoid m4 warnings. Patch from
Bug #347076 from Kevin McBride.
* scripts/sun.m4: Quote GLIBMM_PROG_CXX_SUN to avoid an m4 warning.
Patch from Bug #347077 from Kevin McBride.
2006-07-16 Jonathon Jongsma <jonathon.jongsma@gmail.com>
* glib/src/date.ccg: fix implementation of Glib::Date::set_time_current() so
that it doesn't set the date to Dec 31, 1969.
2006-06-19 Murray Cumming <murrayc@murrayc.com>
* glib/glibmm/object.h: Check whether DestroyNotify is defined, so we can warn about
including X11/Xlib.h before this header, which will break things.
Bug #316726 from Mert Tugcu and Javeed Shaikh.
2006-06-09 Cedric Gustin <cedric.gustin@gmail.com>
* glib/glibmm/objectbase.h : Inline the set_property and
get_property methods. This is required by mingw32-gcc as
ObjectBase is explicitly dllexported.
2006-06-05 Murray Cumming <murrayc@murrayc.com>
* glib/src/convert.ccg: When using --enable-api-exception=no, only try to get the Glib::Error
when the GError is not null.
2006-05-18 Murray Cumming <murrayc@murrayc.com>
* tools/m4/method.m4: _METHOD(): When using errthrow, actually print the function call even if
the return type is 0.
2006-05-16 Murray Cumming <murrayc@murrayc.com>
* tools/m4/method.m4: _METHOD(), _STATIC_METHOD(): Remove spaces before dnl statements,
to avoid unwanted indentation in .cc files.
2006-05-16 Murray Cumming <murrayc@murrayc.com>
* tools/m4/convert_base.m4: _CONVERT(): If the return type is void, use the unconverted
statement, not no statement. This prevents some void methods from being totally empty.
This was a (very bad) regression introduced by the optional API changed.
Bug #341895 from Philip Langdale.
* tools/m4/method.m4: _METHOD(), _STATIC_METHOD(): Attempt to remove unnecessary newlines,
though some indenting spaces slipped in instead. Must fix that.
2006-05-14 Murray Cumming <murrayc@murrayc.com>
* glib/glibmm/value.cc:
* glib/glibmm/value.h: Restored the init(GValue*) method that was lost when
merging changes from the glibmm-2-10 branch.
2006-05-09 Murray Cumming <murrayc@murrayc.com>
* glib/glibmm/ustring.cc:
* glib/src/date.ccg:
* glib/src/convert.ccg:
* glib/src/convert.hg: Added #ifdefed versions for the case that
exceptions are disabled.
2006-05-10 Murray Cumming <murrayc@murrayc.com>
* configure.in:
* scripts/reduced.m4: Moved --enable-deprecated-api macro into scripts/reduced.m4.
Added the --enable-api-exceptions macro that was missing from my last commit.
2006-04-05 Murray Cumming <murrayc@murrayc.com>
* configure.in:
* scripts/reduced.m4: Added --enable-api-exceptions option. When this
is used, methods that would normally throw an exception will now take
an extra std::auto_ptr<Glib::Error> argument that should be checked with
auto_ptr::get().
* glib/glibmmconfig.h.in: Undef the GLIBMM_EXCEPTIONS_ENABLED,
so it will be defined.
* tools/m4/gerror.m4: throw_func() returns an auto_ptr of a
Glib::Error when exceptions are disabled.
* tools/m4/method.m4:
* tools/pm/Output.pm: on_wrap_method(): Added alternative API with
#ifdefs
* tools/m4/signal.m4:
* tools/m4/signalproxy_custom.m4:
* tools/m4/vfunc.m4: Put #ifdefs around the exception re-throwing
try/catch blocks.
* glib/glibmm/dispatcher.cc:
* glib/glibmm/dispatcher.h:
* glib/glibmm/error.cc:
* glib/glibmm/error.h:
* glib/glibmm/exceptionhandler.cc:
* glib/glibmm/exceptionhandler.h:
* glib/glibmm/main.cc:
* glib/glibmm/signalproxy.cc:
* glib/glibmm/streamiochannel.cc:
* glib/glibmm/stringutils.cc:
* glib/glibmm/threadpool.cc:
* glib/src/iochannel.ccg:
* glib/src/iochannel.hg:
* glib/src/markup.ccg:
* glib/src/spawn.ccg:
* glib/src/thread.ccg: Put #ifdefs around try/catch blocks, and
use alternative API when appropriate.
* examples/iochannel_stream/fdstream.cc:
* examples/markup/parser.cc:
* examples/options/main.cc: Adapted examples to
the alternative API, with #ifdefs
* tools/m4/convert_base.m4: Avoid any conversion if the result is
void, to allow _WRAP_METHOD() to ignore bool results, so we can
generate some methods that are currently hand-coded.
2006-05-09 Murray Cumming <murrayc@murrayc.com>
* glib/glibmm/value.cc:
* glib/glibmm/value.h: Added init(const GValue*), so that we can copy GValue instances
of any type at runtime. Needed by libgdamm, which returns const GValue* instances.
This is the HEAD branch, for API additions. See also the glibmm-2-10 branch.
2.10.1:
2006-04-12 Murray Cumming <murrayc@murrayc.com>
* tools/m4/signalproxy_custom.m4: Remove this file because it is not installed and
does not seem to be used.
2006-04-12 Murray Cumming <murrayc@murrayc.com>
* tools/m4/signal.m4: Mark the (private) signal info callback functions as
static, to save on code size.
2006-04-12 Murray Cumming <murrayc@murrayc.com>
* tools/pm/WrapParser.pm: Parse a new optional constversion parameter for
_WRAP_METHOD(), to save on code size by just calling the non-const overload
instead of generating almost identical code.
* tools/m4/method.m4: _METHOD(): Take extra parameters for use when constversion is used.
* tools/pm/Output.pm: Send the extra parameters to _METHOD().
* docs/internal/using_gmmproc.txt: Documented the new constversion option.
2006-04-12 Murray Cumming <murrayc@murrayc.com>
* glib/glibmm/main.cc:
* glib/glibmm/objectbase.cc:
* glib/glibmm/property.cc:
* glib/glibmm/ustring.cc:
* glib/glibmm/value_custom.cc:
* glib/src/spawn.ccg: Mark private functions as
static, to stop them being exported in the API, to reduce the
library code size slightly.
* tools/m4/signal.m4: Make generated callback functions static, for
the same reasons.
2006-04-07 Cedric Gustin <cedric.gustin@gmail.com>
* README.win32: Updated for Mingw-4.1.
2006-04-06 Cedric Gustin <cedric.gustin@gmail.com>
* MSVC_Net2003/*.vcproj: Embed the manifest file into executables
in the case of the Debug target.
* README.win32: Fixed a few typos.
* build_shared/Makefile_build.am_fragment: Add -DGLIBMM_BUILD to
the extra_defines compiler flags (switch between
dllexport/dllimport on win32).
* glib/glibmmconfig.h.in: Define GLIBMM_DLL when building with
mingw32/cygwin. This makes the GLIBMM_API tag (and GTKMM_API for
gtkmm) active with these two platforms, as required by bug
#309030.
* glib/glibmm/object.h, glib/glibmm/objectbase.h : Tag the Object
and ObjectBase classes with GLIBMM_API to make Visual Studio happy.
2.10.0:
2006-02-25 Murray Cumming <murrayc@murrayc.com>
* tools/pm/DocsParser.pm: looklookup_documentation(): Put the
@deprecated text immediately after the main description, before
the parameters, so that Doxygen actually uses it.
2006-02-25 Murray Cumming <murrayc@murrayc.com>
* tools/pm/DocsParser.pm: looklookup_documentation(): Accept an
extra deprecated_documentation parameter, to be appended to the
Doxygen documentation.
* tools/pm/Output.pm: output_wrap_meth(): Put the documentation
inside the deprecation #ifdef, for neatness.
* tools/pm/WrapParser.pm: on_wrap_method(): Read an optional string
after the optional deprecated parameter, used to say why the
method is deprecated, in case it was not deprecated by the C API,
in which case it would already have documentation for this.
2006-02-27 Cedric Gustin <cedric.gustin@gmail.com>
* README.win32: Updated for glibmm-2.8 (MS Visual Studio 2005).
* glib/glibmm/ustring.h: Tag npos with GLIBMM_API, in order to
dllexport it on win32. Bug #332438.
* MSVC_Net2003/*.vcproj: Updated for Visual Studio 2005. Added the
/vd2 compiler flag (Bug #158040).
* MSVC_Net2003/glibmm.sln: Updated for Visual Studio 2005.
* MSVC_Net2003/gendef/gendef.cc: Redirect output of dumpbin to a
file.
* glib/glibmmconfig.h.in: Undefined
GLIBMM_HAVE_ALLOWS_STATIC_INLINE_NPOS for MSVC.
2006-02-03 Murray Cumming <murrayc@murrayc.com>
* docs/internal/using_gmmproc.txt: Section about regenerating .defs:
Repeat the hint about extra_defs_gen here.
2006-02-27 Cedric Gustin <cedric.gustin@gmail.com>
* glib/glibmm/ustring.h: Tag npos with GLIBMM_API, in order to
dllexport it on win32. Bug #332438.
2006-02-07 Rob Page <page.rob@gmail.com>
* glib/glibmm/ustring.h: fix a typo in the documentation for uppercase()
2.9.1:
2006-01-28 Murray Cumming <murrayc@murrayc.com>
* glib/src/optiongroup.ccg: add_entry_with_wrapper(): Copy the
CppOptionEntry into the map _after_ setting entry_ so that we
really delete it in release_c_arg(), to avoid a memory leak.
2006-01-28 Rob Page <rob@gmail.com>
* docs/reference/glibmm_header.html_fragment: Fix the link
to the Main page. Bug #328299.
2006-01-27 Murray Cumming <murrayc@murrayc.com>
* glib/src/optionentry.ccg: Constructor: Avoid memory
leak caused by double instantiation of gobject_.
2005-12-16 Murray Cumming <murrayc@murrayc.com>
* glib/glibmm/object.h:
* glib/glibmm/objectbase.h: Hide some internal stuff
from Doxygen. Add/Improve the Doxygen documentation.
* glib/src/convert.hg: Correct the declaration of
filename_display_name() to match the implementation.
Previously this would have been unusable due to a linker
error.
2005-11-30 Murray Cumming <murrayc@murrayc.com>
* docs/reference/Doxyfile.in: Define the @newin aliases,
as in gtkmm.
* tools/pm/DocsParser.pm: Convert Since: in gtk-doc
text to @newin for our doxygen docs.
2005-11-29 Murray Cumming <murrayc.com>
* build_shared/Makefile_build.am_fragment:
* configure.in: Added --enable-use-deprecations,
defaulting to no (do not check for them), so that
the tarball will still build when newer versions
of glib deprecate some API.
* examples/Makefile.am_fragment: Use the
deprecation, if wanted.
2005-11-29 Murray Cumming <murrayc@murrayc.com>
* build_shared/Makefile_build.am_fragment:
* configure.in: Added --enable-deprecated-api
option. When set to disabled, it does not build
deprecated API. This reduces the size of the library,
and might be useful for embedded devices.
* glib/src/date.ccg:
* glib/src/date.hg: Use _DEPRECATE_IFDEF_START/END
around the deprecated set_time() method.
2005-11-29 Murray Cumming <murrayc@murrayc.com>
* tools/m4/base.m4: Add
_DEPRECATE_IFDEF_START and _DEPRECATE_IFDEF_END
macros, to #ifdef-out generated methods.
Added _DEPRECATE_IFDEF_CLASS_START and
_DEPRECATE_IFDEF_CLASS_END for whole classes.
Put _DEPRECATE_IFDEF_CLASS* around all generated
code. It does nothing if the class is not deprecated.
* tools/m4/class_gtkobject.m4: Add _DEPRECATED macro,
used to mark a class as deprecated.
* tools/m4/method.m4: Take an extra parameter, to
optionally mark the method as deprecated, to add
#ifdefs around the code, with
_DEPRECATE_IFDEF_START/END
* tools/pm/Output.pm: _DEPRECATE_IFDEF_START/END
around the declarations of deprecated methods.
* tools/pm/WrapParser.pm: Check for an optional
deprecated parameter to _WRAP_METHOD().
* tools/m4/member.m4: Allow optional deprecated
method for _MEMBER_GET/SET*() to ifdef the code
out.
* tools/generate_wrap_init.pl.in: Put an #ifdef
around use of deprecated classes.
2005-11-23 Murray Cumming <murrayc@murrayc.com>
* configure.in: Depend on glib 2.9, which
has new API.
* glib/src/date.ccg:
* glib/src/date.hg: Wrap glib_date_set_time_t()
and glib_date_set_time_val(). Deprecate
set_time(GTime) in favour of the new method
overloads. Added set_time_current(), wrapping the
case that the time_t is 0.
This is the HEAD branch, for new API, targetting glib 2.9. See also the
glibmm-2-8 branch.
2.8.2:
2005-11-23 Murray Cumming <murrayc@murrayc.com>
* glib/glibmm/containers.h: Do not use g_assert() in
a header, because g++ sometimes warns that it has
no effect.
2005-10-29 Murray Cumming <murrayc@murrayc.com>
* scripts/macros.m4: AL_PROG_GNU_MAKE():
Use $MAKE-make instead of $ac_make, which
apparently fixes a build problem on some
Solaris systems. Thanks to Mark Rouchal in
bug #307480.
2.8.1:
2005-10-19 Murray Cumming <murrayc@murrayc.com>
* configure.in: Check for glib 2.8. Bug #317913.
2.8.0:
Updated NEWS and increased version to 2.8.0.
2.7.3:
2005-08-17 Murray Cumming <murrayc@murrayc.com>
* glib/src/glib_docs.xml: Regenerated with docextract_to_xml.py
* glib/src/glib_enums.defs: Regenerated with enums.pl
* glib/src/glib_functions.defs: Regenerated with h2defs.py
2.7.2:
2005-07-16 Murray Cumming <murrayc@murrayc.com
* glib/glibmm/miscutils.cc: Reimplemented build_filename() and
build_path() with the new non-vararg functions in glib 2.7,
instead of implementing them in gtkmm.
* glib/src/glib_enums.defs: Regenerated with enums.pl
* glib/src/optionentry.hg: Added FLAG_NO_ARG, FLAG_FILENAME,
FLAG_OPTIONAL_ARG, and FLAG_NOALIAS enum values.
2.7.1:
2005-06-08 Murray Cumming <murrayc@murrayc.com
* glib/glibmm/propertyproxy.h:
PropertyProxy_ReadOnly<>::get_value(),
PropertyProxy_WriteOnly<>::set_value(): Add implementations
instead of casting to unrelated PropertyProxy() and calling it
there. The AIX compiler did not like this hack. Bug #301610
2005-06-07 Cedric Gustin <cedric.gustin@swing.be>
* glib/glibmm/miscutils.cc: In get_home_dir, return an empty
string when HOME is not defined (Win9x). Bug #306310 from Michael
Hofmann.
* glib/glibmm/miscutils.h: Updated docstring for the get_home_dir
method.
2005-04-27 Murray Cumming <murrayc@murrayc.com>
* examples/child_watch/main.cc:
* examples/thread/dispatcher.cc:
* examples/thread/thread.cc:
* glib/glibmm/dispatcher.cc: Inherit signal handler objects from
sigc::trackable. This is necessary with some libsigc++ patches,
though not currently necessary with regular libsigc++.
2005-04-22 Murray Cumming <murrayc@murrayc.com>
* glib/src/gmodule_enums.defs: Regenerate with enums.pl
* glib/src/gmodule_functions.defs: Regenerate with h2defs.py
This adds the BIND_LOCAL enum value. Bug #172748 from
Phillip Neiswanger.
2005-04-05 Murray Cumming <murrayc@murrayc.com>
* tool/pm/Output.pm: output_wrap_property(): Do not add the
const read-only method override if the property can not be read. Be
careful because this removes a little API from generated code. You
should hand-code the wrongly-generated methods and mark them as
deprecated.
* glib/glibmm/refptr.h: Added cast_const<>, like the existing
cast_dynamic<> and cast_static.
2005-03-31 Murray Cumming <murrayc@murrayc.com>
* glib/src/glib_functions.defs: Updated with
h2defs.py.
2005-03-13 Yair Hershkovitz <yairhr@gmail.com>
* glib/glibmm/main.h,
glib/glibmm/main.cc: Added MainContext::signal_child_watch()
* examples/: Added child_watch/ example
2005-03-11 Yair Hershkovitz <yairhr@gmail.com>
* glib/glibmm/main.h, glib/glibmm/main.cc:
Add Glib::SignalChildWatch class, Glib::signal_child_watch()
This is the HEAD branch, for new API. Bug fixes that do not change or add
API should also be applied to the glibmm-2-6 branch.
2005-03-09 Cedric Gustin <cedric.gustin@swing.be>
* MSVC_Net2003/Makefile.am: Add blank.cpp to EXTRA_DIST.
* MSVC_Net2003/glibmm/glibmm.vcproj: Remove sarray.cc from the
list of source files.
* MSVC_Net2003/examples/*/*.vcproj,
MSVC_Net2003/tests/glibmm_value/glibmmvalue.vcproj: Change name of
PDB file to $(OutDir)/$(TargetName).pdb.
2.6.1:
2005-03-07 Murray Cumming <murrayc@murrayc.com>

View File

@ -1,7 +1,7 @@
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 Free
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
@ -102,16 +102,16 @@ for another architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PREFIX'.
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PREFIX', the package will
use PREFIX as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
@ -159,7 +159,7 @@ where SYSTEM can have one of these forms:
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the `--target=TYPE' option to select the type of system they will
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
@ -189,8 +189,13 @@ them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
will cause the specified gcc to be used as the C compiler (unless it is
overridden in the site shell script).
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script). Here is a another example:
/bin/bash ./configure CONFIG_SHELL=/bin/bash
Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
configuration-related scripts to be executed by `/bin/bash'.
`configure' Invocation
======================

View File

@ -1,15 +1,8 @@
ACLOCAL_AMFLAGS = -I scripts
SUBDIRS = glibmm
SUBDIRS = glibmm
DIST_SUBDIRS = $(SUBDIRS)
EXTRA_DIST = build_shared/Makefile_build.am_fragment \
build_shared/Makefile_build_gensrc.am_fragment \
build_shared/Makefile_gensrc.am_fragment \
build_shared/Makefile_gensrc_platform.am_fragment \
build_shared/Makefile_build_extra.am_fragment \
CHANGES glibmmconfig.h.in glibmm-2.4.pc.in
glibmm_includedir = $(includedir)/glibmm-2.4
glibmm_include_HEADERS = glibmm.h
@ -21,3 +14,16 @@ pkgconfig_DATA = glibmm-2.4.pc
all-local:
@echo "*** Everything completed ***"
dist-hook:
@echo; echo; \
echo "**********************************************************"; \
echo "* IMPORTANT NOTICE: *"; \
echo "* *"; \
echo "* Be sure you have done a complete build before running *"; \
echo "* 'make dist' or 'make distcheck', because otherwise *"; \
echo "* the tarball will _not_ contain the dependency rules *"; \
echo "* generated by the compiler. *"; \
echo "**********************************************************"; \
echo; echo

View File

@ -1,3 +1,163 @@
2.12.5:
* Fix code generation when using the latest m4, and functions named
mkstemp, as experienced on Ubuntu Feisty.
Bug #397167 (Dodji Seketeli, Daniel Elstner)
2.12.4:
* gmmproc improvements:
- gmmproc: Allow () in property and signal documentation.
- gmmproc: Do not try to remove a common prefix from the
C enam values, if there is no common prefix.
- enum.pl: Allow whitespace in front of an enum typedef.
(Daniel Elstner)
- enum.pl: Fix an infinite loop.
* Glib::Value: When registering float parameters, use
G_MAXFLOAT as the minimum, instead of G_MINFLOAT.
Likewise for doubles.
(Oliver Nittka)
2.12.3:
* ObjectBase: Added connect_property_changed(),
as an alternative to use when the property proxies are not
available because GLIBMM_PROPERTIES_ENABLED is not defined.
(Murray Cumming)
* Documentation:
- Small ustring reference documentation improvement.
(Ralf Stephan)
2.12.2
*Build:
- Fix for api-default-signal-handlers option.
Bug #357830 (Matt Hoosier)
- win32: Remove unused source file from Visual Studio project.
(Cedric Gustin)
2.12.1:
* Support optional ifdef parameters in the .hg macros,
to allow, for instance the --enable-atk=no option,
to disable the build and use of the atkmm API,
for use in embedded environments.
(Johannes Schimd, Murray Cuming, Openismus)
2.12.0:
Changes sinze 2.10:
* Added the --enable-api-default-signal-handlers option, for use in
embedded environments that have reduced resources. See configure --help
for the other subsets.
* Value: Added init(const GValue*), so we can copy GValue instances
of any type at runtime. Needed by the new branch of libgdamm.
2.11.3:
* Build: Added the --enable-api-default-signal-handlers option, for use in
embedded environments that have reduced resources. See configure --help
for the other subsets.
2.11.2:
* Date: Fix implementation of Glib::Date::set_time_current() so
that it doesn't set the date to Dec 31, 1969.
(Jonathon Jongsma)
* Value: Added init(const GValue*), so we can copy GValue instances
of any type at runtime. Needed by the new branch of libgdamm.
(Murray Cumming)
* Added a #warning to warn about including X11/Xlib.h before a glibmm header,
which would break things. Bug #316726 from Mert Tugcu and Javeed Shaikh.
(Murray Cumming)
* Build:
- Quote some m4 macros to avoid warnings. Bugs (with patches) #347076
and #347077
(Kevin McBride).
- Fix exporting of get/set_property() on mingw32-gcc.
(Cedric Gustin)
2.10.1
* Windows Build:
- Define GLIBMM_DLL when building with mingw32 or cygwin,
because it is needed by gtkmm. Bug #309030
(Cedric Gustin)
* OptionGroup: Allow default values, by not initializing them all.
(Armin Burgmeier)
* Slight code size reduction by marking private functions as static.
(Murray Cumming)
2.10.0:
* Windows Build:
- ustring.h: Tag npos with GLIBMM_API, in order to
dllexport it on win32. Bug #332438.
- Updated MSVC++ build files and README, for MS Visual Studio 2005.
(Cedric Gustin)
* gmmproc code generator:
- WRAP_METHOD() Take an extra optional argument: deprecated deprecationtext -
so that we can insert the appropriate doxygen tag in the documentation, where
the C documentation does not do it for us.
2.9.1:
* Date:
- Added set_time(time_t), set_time(GTimeVal), and deprecated
set_time(GTime)
- Added set_time_current().
(Murray Cumming)
* Build: Added --enable-deprecated-api option. When set to disabled,
it does not build deprecated API. This reduces the size of the
library, and might be useful for embedded devices.
(Murray Cumming)
2.8.2:
* Solaris build fix: Correct the detection
of make. (Mark Rouchal)
2.8.1:
* Build: Check for glib 2.8.
2.8.0:
API additions since glibmm 2.6:
* GModule: Add BIND_LOCAL enum value.
(Bug #172748 from Phillip Neiswanger).
* MainContext Added signal_child_watch()
and examples/child_watch.
(Yair Hershkovitz)
* OptionEntry: Added FLAG_NO_ARG, FLAG_FILENAME,
FLAG_OPTIONAL_ARG, and FLAG_NOALIAS enum values.
(Murray Cumming)
2.7.3:
* Updated reference documentation from glib documentation.
2.7.2:
* OptionEntry: Added FLAG_NO_ARG, FLAG_FILENAME,
FLAG_OPTIONAL_ARG, and FLAG_NOALIAS enum values.
* build_filename() and build_path(): Now use the implementation
from glib.
2.7.1:
* GModule: Add BIND_LOCAL enum value.
(Bug #172748 from Phillip Neiswanger).
* MainContext Added signal_child_watch()
and examples/child_watch.
(Yair Hershkovitz)
* Fixes from 2.6.2.
2.6.1:
* Interface::add_interface(): Disabled the check for a second call,

View File

@ -1,31 +1,4 @@
This is the unstable version of gtkmm, aimed at Gtk+ 2.0.x.
See CHANGES for a comparison with gtkmm 1.2.
Contents:
* Your unstable development environment
* Required libraries:
Your unstable development environment
-------------------------------------
Until the GTK+ 2.0 / GNOME 2.0 platform is stable, you should try to separate these unstable libraries from your stable GTK+ 1.2 / GNOME 1.2/1.4 libraries. You can do this by installing the unstable libraries into a different prefix.
e.g. ./configure --prefix=/usr/devgnome2
When using the development libraries, you will need to modify some environment variables. This will be easier if you create a file (e.g. devgnome2) in your home directory that contains these commands:
export PATH="/usr/devgnome2/bin:$PATH"; export LD_LIBRARY_PATH="/usr/devgnome2/lib" ; export PKG_CONFIG_PATH="/usr/devgnome2/lib/pkgconfig:$PKG_CONFIG_PATH" ;
You can then type
# source devgnome2
to prepare your environment before building or working with the development libraries.
You may also need to edit /etc/ld.so.conf to add /usr/devgnome2/lib, and then type /sbin/ldconfig to re-process the ld.so.conf.
This is glibmm, a C++ API for parts of glib that are useful for C++.
See http://www.gtkmm.org
The vicious-build-scripts module in cvs.gnome.org might help you with this, if you can get it to work.
Required Libraries
------------------
* Of course, you will need gtk+ 2 and its dependencies.
* libsigc++ 1.2 (A release, or libsigc++-1.2 from cvs)

View File

@ -13,7 +13,7 @@ glibmm2 = env.Copy()
glibmm2.Merge([libraries['sigc2'], libraries['glib2']])
glibmm2.Append(CXXFLAGS='-DHAVE_CONFIG_H')
#glibmm2.Append(CXXFLAGS='-DG_DISABLE_DEPRECATED')
glibmm2.Append(CXXFLAGS='-DG_DISABLE_DEPRECATED')
glibmm2.Append(CXXFLAGS='-DG_LOG_DOMAIN=\\\"glibmm\\\"')
libglibmm2 = glibmm2.SharedLibrary('glibmm2', glibmm2_files)

View File

@ -18,13 +18,13 @@ AC_PREREQ(2.50)
# Version and initialization
#########################################################################
GLIBMM_MAJOR_VERSION=2
GLIBMM_MINOR_VERSION=6
GLIBMM_MICRO_VERSION=1
GLIBMM_MINOR_VERSION=12
GLIBMM_MICRO_VERSION=5
GLIBMM_VERSION=$GLIBMM_MAJOR_VERSION.$GLIBMM_MINOR_VERSION.$GLIBMM_MICRO_VERSION
GLIBMM_RELEASE=$GLIBMM_MAJOR_VERSION.$GLIBMM_MINOR_VERSION
AC_DEFINE_UNQUOTED(GLIBMM_MAJOR_VERSION, $GLIBMM_MAJOR_VERSION)
AC_DEFINE_UNQUOTED(GLIBMM_MINOR_VERSION, $GLIBMM_MINOR_VERSION)
AC_DEFINE_UNQUOTED(GLIBMM_MICRO_VERSION, $GLIBMM_MICRO_VERSION)
AC_DEFINE_UNQUOTED([GLIBMM_MAJOR_VERSION], $GLIBMM_MAJOR_VERSION, [Major Version])
AC_DEFINE_UNQUOTED([GLIBMM_MINOR_VERSION], $GLIBMM_MINOR_VERSION, [Minor Version])
AC_DEFINE_UNQUOTED([GLIBMM_MICRO_VERSION], $GLIBMM_MICRO_VERSION, [Micro Version])
AC_SUBST(GLIBMM_MAJOR_VERSION)
AC_SUBST(GLIBMM_MINOR_VERSION)
AC_SUBST(GLIBMM_MICRO_VERSION)
@ -38,7 +38,7 @@ AC_SUBST(GLIBMM_RELEASE)
# ? :+1 : ? == just some internal changes, nothing breaks but might work
# better
# CURRENT : REVISION : AGE
LIBGLIBMM_SO_VERSION=1:13:0
LIBGLIBMM_SO_VERSION=1:24:0
AC_SUBST(LIBGLIBMM_SO_VERSION)
AC_CONFIG_AUX_DIR(scripts)
@ -69,7 +69,34 @@ AC_PROG_MAKE_SET
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
dnl Used for enabling the "-no-undefined" flag while generating DLLs
dnl Copied from the official gtk+-2 configure.in
AC_MSG_CHECKING([for some Win32 platform])
case "$host" in
*-*-mingw*|*-*-cygwin*)
platform_win32=yes
;;
*)
platform_win32=no
;;
esac
AC_MSG_RESULT([$platform_win32])
AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
AC_MSG_CHECKING([for native Win32])
case "$host" in
*-*-mingw*)
os_win32=yes
;;
*)
os_win32=no
;;
esac
AC_MSG_RESULT([$os_win32])
AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
AC_DISABLE_STATIC
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AL_PROG_GNU_M4(AC_MSG_ERROR([dnl
@ -80,26 +107,49 @@ AL_PROG_GNU_MAKE(AC_MSG_ERROR([dnl
SUN make does not work for building gtkmm.
Please install GNU make.]))
#########################################################################
# Dependancy checks
#########################################################################
gtkmm_min_glib_version=2.6.0
PKG_CHECK_MODULES(GLIBMM, glib-2.0 >= ${gtkmm_min_glib_version} gobject-2.0 >= ${gtkmm_min_glib_version} gmodule-2.0 >= ${gtkmm_min_glib_version})
AC_SUBST(GLIBMM_CFLAGS)
AC_SUBST(GLIBMM_LIBS)
# gthread isn't a requirement, but we should use its CFLAGS if available.
PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= ${gtkmm_min_glib_version},[],[GTHREAD_CFLAGS=''; GTHREAD_LIBS=''])
AC_SUBST(GTHREAD_CFLAGS)
AC_SUBST(GTHREAD_LIBS)
#########################################################################
# C++ checks
#########################################################################
AC_PROG_CXX
# Check for the SUN Forte compiler, and define GLIBMM_COMPILER_SUN_FORTE in the header.
GLIBMM_PROG_CXX_SUN
# Ensure MSVC-compatible struct packing convention is used when
# compiling for Win32 with gcc.
# What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
# gcc2 uses "-fnative-struct".
if test x"$os_win32" = xyes; then
if test x"$GCC" = xyes -a x"$GXX" = xyes; then
msnative_struct=''
AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
if test -z "$ac_cv_prog_CC"; then
our_gcc="$CC"
else
our_gcc="$ac_cv_prog_CC"
fi
case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
2.)
if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
msnative_struct='-fnative-struct'
fi
;;
*)
if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
msnative_struct='-mms-bitfields'
fi
;;
esac
if test x"$msnative_struct" = x ; then
AC_MSG_RESULT([no way])
AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code])
else
CXXFLAGS="$CXXFLAGS $msnative_struct"
AC_MSG_RESULT([${msnative_struct}])
fi
fi
fi
AC_LANG_CPLUSPLUS
AC_CXX_BOOL(,config_error=yes)
@ -124,12 +174,35 @@ GLIBMM_CXX_CAN_ASSIGN_NON_EXTERN_C_FUNCTIONS_TO_EXTERN_C_CALLBACKS()
GLIBMM_CXX_CAN_USE_NAMESPACES_INSIDE_EXTERNC()
GLIBMM_CXX_ALLOWS_STATIC_INLINE_NPOS()
# Check whether --enable-debug-refcounting was given.
GLIBMM_ARG_ENABLE_DEBUG_REFCOUNTING()
# Evaluate the --enable-warnings=level option.
GTKMM_ARG_ENABLE_WARNINGS()
# Add an --enable-use-deprecations configure option:
AC_ARG_ENABLE(deprecations,
[AC_HELP_STRING([--enable-use-deprecations],
[warn about deprecated usages [default=no]])],,
[enable_deprecations=no])
if test "x$enable_use_deprecations" = "xyes"; then
DISABLE_DEPRECATED_CFLAGS="-DG_DISABLE_DEPRECATED"
AC_SUBST(DISABLE_DEPRECATED_CFLAGS)
fi
#Offer the ability to omit some API from the library,
#to reduce the code size:
GLIBMM_ARG_ENABLE_API_DEPRECATED()
GLIBMM_ARG_ENABLE_API_EXCEPTIONS()
GLIBMM_ARG_ENABLE_API_PROPERTIES()
GLIBMM_ARG_ENABLE_API_VFUNCS()
# Offer the ability to omit some API from the library,
# to reduce the code size:
GLIBMM_ARG_ENABLE_API_DEFAULT_SIGNAL_HANDLERS()
# Dummy conditional just to make automake-1.4 happy.
# We need an always-false condition in docs/Makefile.am.
AM_CONDITIONAL(GTKMM_FALSE,[false])
@ -138,6 +211,7 @@ AM_CONDITIONAL(GTKMM_FALSE,[false])
# maintainer-mode rules. That would fail since we aren't using autoheader.
AUTOHEADER=':'
AC_CONFIG_FILES([
Makefile

View File

@ -1,3 +0,0 @@
Makefile
Makefile.in
*.os

View File

@ -1,7 +1,7 @@
## Copyright (c) 2001
## The gtkmm development team.
SUBDIRS =
SUBDIRS = private
sublib_name = glibmm
sublib_libname = glibmm-2.4
@ -9,8 +9,9 @@ sublib_namespace = Glib
sublib_cflags = $(GLIBMM_CFLAGS)
sublib_files_extra_posix_cc =
sublib_files_extra_win32_cc =
sublib_files_general_cc = \
sublib_files_extra_general_cc = \
class.cc \
containers.cc \
debug.cc \
@ -43,9 +44,10 @@ sublib_files_general_cc = \
value_custom.cc \
wrap.cc
sublib_files_posix_h =
sublib_files_extra_posix_h =
sublib_files_extra_win32_h =
sublib_files_general_h = \
sublib_files_extra_general_h = \
arrayhandle.h \
class.h \
containerhandle_shared.h \
@ -86,11 +88,15 @@ sublib_files_general_h = \
value_custom.h \
wrap.h
files_built_general_cc = value_basictypes.cc
files_built_general_h = signalproxy.h value_basictypes.h
files_built_general_cc += value_basictypes.cc
files_built_general_h += signalproxy.h value_basictypes.h
lib_LTLIBRARIES = libglibmm-2.4.la
if OS_WIN32
libglibmm_2_4_la_SOURCES = $(files_all_general_cc) $(files_all_win32_cc)
else
libglibmm_2_4_la_SOURCES = $(files_all_general_cc) $(files_all_posix_cc)
endif
libglibmm_2_4_la_LDFLAGS = $(common_ldflags)
libglibmm_2_4_la_LIBADD = $(GLIBMM_LIBS)

View File

@ -106,10 +106,11 @@ 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

View File

@ -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

View File

@ -178,7 +178,7 @@ public:
reference operator*() const
{
g_assert(node_);
//g++ complains that this statement has no effect: g_assert(node_);
return reinterpret_cast<T&>( node_ ? node_->data : glibmm_null_pointer );
}

View File

@ -1,5 +1,6 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#include <glibmm/convert.h>
#include <glibmm/private/convert_p.h>
@ -40,17 +41,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
}
}
@ -82,16 +85,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
if(gerror) error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return std::string(ScopedPtr<char>(buf).get(), bytes_written);
}
@ -113,125 +123,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
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* 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
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* 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
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* 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
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* 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
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* 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
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* 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
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* 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
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);
@ -244,35 +325,59 @@ std::string filename_from_uri(const Glib::ustring& uri, Glib::ustring& hostname)
return std::string(scoped_buf.get());
}
std::string filename_from_uri(const Glib::ustring& uri)
{
GError* error = 0;
char *const buf = g_filename_from_uri(uri.c_str(), 0, &error);
if(error)
Error::throw_exception(error);
#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());
}
Glib::ustring filename_to_uri(const std::string& filename, const Glib::ustring& hostname)
{
GError* error = 0;
char *const buf = g_filename_to_uri(filename.c_str(), hostname.c_str(), &error);
if(error)
Error::throw_exception(error);
#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());
}
Glib::ustring filename_to_uri(const std::string& filename)
{
GError* error = 0;
char *const buf = g_filename_to_uri(filename.c_str(), 0, &error);
if(error)
Error::throw_exception(error);
#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());
}
@ -315,9 +420,17 @@ Glib::ConvertError::Code Glib::ConvertError::code() const
return static_cast<Code>(Glib::Error::code());
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void Glib::ConvertError::throw_func(GError* gobject)
{
throw Glib::ConvertError(gobject);
}
#else
//When not using exceptions, we just pass the Exception object around without throwing it:
std::auto_ptr<Glib::Error> Glib::ConvertError::throw_func(GError* gobject)
{
return std::auto_ptr<Glib::Error>(new Glib::ConvertError(gobject));
}
#endif //GLIBMM_EXCEPTIONS_ENABLED

View File

@ -67,7 +67,14 @@ public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
#ifdef GLIBMM_EXCEPTIONS_ENABLED
static void throw_func(GError* gobject);
#else
//When not using exceptions, we just pass the Exception object around without throwing it:
static std::auto_ptr<Glib::Error> throw_func(GError* gobject);
#endif //GLIBMM_EXCEPTIONS_ENABLED
friend void wrap_init(); // uses throw_func()
#endif
};
@ -119,7 +126,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_; }
@ -150,9 +161,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.
@ -164,9 +181,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.
@ -184,10 +207,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().
@ -196,7 +226,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().
@ -205,7 +239,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.
@ -213,14 +251,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.
@ -230,7 +276,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.
@ -238,7 +288,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
@ -247,7 +301,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
@ -255,7 +313,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,
@ -288,7 +350,7 @@ Glib::ustring filename_display_basename(const std::string& filename);
* @param filename: a pathname hopefully in the GLib file name encoding
* @result A string containing a rendition of the filename in valid UTF-8.
*/
Glib::ustring filename_display_name(const Glib::ustring& filename);
Glib::ustring filename_display_name(const std::string& filename);
/** @} group CharsetConv */

View File

@ -1,5 +1,6 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#include <glibmm/date.h>
#include <glibmm/private/date_p.h>
@ -28,13 +29,13 @@
#include <ctime>
#include <algorithm>
#include <glibmm/convert.h>
#include <glibmm/utility.h>
#include <glibmmconfig.h>
GLIBMM_USING_STD(max)
namespace Glib
{
@ -70,10 +71,31 @@ void Date::set_parse(const Glib::ustring& str)
g_date_set_parse(&gobject_, str.c_str());
}
#ifndef GLIBMM_DISABLE_DEPRECATED
void Date::set_time(GTime time)
{
//This method, and the C function that it wraps, are deprecated.
g_date_set_time(&gobject_, time);
}
#endif // GLIBMM_DISABLE_DEPRECATED
void Date::set_time(time_t timet)
{
g_date_set_time_t(&gobject_, timet);
}
void Date::set_time_current()
{
//As suggested in the C documentation:
g_date_set_time_t(&gobject_, time(NULL));
}
void Date::set_time(const GTimeVal& timeval)
{
g_date_set_time_val(&gobject_, const_cast<GTimeVal*>(&timeval));
}
void Date::set_month(Date::Month month)
{
@ -266,7 +288,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
@ -281,7 +309,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);

View File

@ -24,6 +24,8 @@
*/
#undef G_DISABLE_DEPRECATED //So we can use deprecated functions in our deprecated methods.
#include <glibmm/ustring.h>
#include <glib/gdate.h>
@ -33,7 +35,6 @@
extern "C" { struct tm; }
#endif
namespace Glib
{
@ -118,15 +119,41 @@ enum DMY
*/
void set_parse (const Glib::ustring& str);
//TODO: Add set_time_current() - see the docs comment below.?
#ifndef GLIBMM_DISABLE_DEPRECATED
/** Sets the value of a date from a GTime (time_t) value.
* To set the value of a date to the current day, you could write:
*
*set_time(time(NULL));
*
* @param time GTime value to set.
*
* @deprecated Please use set_time(time_t) or set_time(const GTimeVal&).
*/
void set_time(GTime time);
#endif // GLIBMM_DISABLE_DEPRECATED
/** Sets the value of a date from a <type>time_t</type> value.
*
* @param timet time_t value to set
*
* @see set_time_current()
*
* Since: 2.10
*/
void set_time(time_t timet);
/** Sets the value of a date from a GTimeVal value. Note that the
* tv_usec member is ignored, because Glib::Date can't make use of the
* additional precision.
*
* @see set_time_current()
*
* @param timeval GTimeVal value to set
*
* Since: 2.10
*/
void set_time(const GTimeVal& timeval);
void set_time_current();
/** Sets the month of the year. If the resulting day-month-year triplet is invalid, the date will be invalid.
* @param month Month to set.

View File

@ -129,7 +129,7 @@ static void fd_close_and_invalidate(int& fd)
namespace Glib
{
class DispatchNotifier
class DispatchNotifier : public sigc::trackable
{
public:
~DispatchNotifier();
@ -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;

View File

@ -67,6 +67,7 @@ public:
* @throw Glib::FileError
*/
Dispatcher();
/** Create new Dispatcher instance using an arbitrary main context.
* @throw Glib::FileError
*/

View File

@ -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

View File

@ -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);
#endif //GLIBMM_EXCEPTIONS_ENABLED
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

View File

@ -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

View File

@ -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 */

View File

@ -1,5 +1,6 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#include <glibmm/fileutils.h>
#include <glibmm/private/fileutils_p.h>
@ -209,9 +210,17 @@ Glib::FileError::Code Glib::FileError::code() const
return static_cast<Code>(Glib::Error::code());
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void Glib::FileError::throw_func(GError* gobject)
{
throw Glib::FileError(gobject);
}
#else
//When not using exceptions, we just pass the Exception object around without throwing it:
std::auto_ptr<Glib::Error> Glib::FileError::throw_func(GError* gobject)
{
return std::auto_ptr<Glib::Error>(new Glib::FileError(gobject));
}
#endif //GLIBMM_EXCEPTIONS_ENABLED

View File

@ -137,7 +137,14 @@ public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
#ifdef GLIBMM_EXCEPTIONS_ENABLED
static void throw_func(GError* gobject);
#else
//When not using exceptions, we just pass the Exception object around without throwing it:
static std::auto_ptr<Glib::Error> throw_func(GError* gobject);
#endif //GLIBMM_EXCEPTIONS_ENABLED
friend void wrap_init(); // uses throw_func()
#endif
};

View File

@ -1,5 +1,6 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#include <glibmm/iochannel.h>
#include <glibmm/private/iochannel_p.h>
@ -176,13 +177,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);
}
@ -206,22 +217,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);
@ -231,16 +260,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);
@ -250,16 +289,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);
@ -269,15 +318,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;
}
@ -394,11 +453,16 @@ Glib::RefPtr<IOChannel> wrap(GIOChannel* gobject, bool take_copy)
GIOStatus GlibmmIOChannel::io_read(GIOChannel* channel, char* buf, gsize count,
gsize* bytes_read, GError** err)
{
if(!&err) err = err; //Avoid an unused parameter warning when GLIBMM_EXCEPTIONS_ENABLED is used.
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)
{
@ -408,6 +472,7 @@ GIOStatus GlibmmIOChannel::io_read(GIOChannel* channel, char* buf, gsize count,
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
return G_IO_STATUS_ERROR;
}
@ -416,11 +481,16 @@ GIOStatus GlibmmIOChannel::io_read(GIOChannel* channel, char* buf, gsize count,
GIOStatus GlibmmIOChannel::io_write(GIOChannel* channel, const char* buf, gsize count,
gsize* bytes_written, GError** err)
{
if(!&err) err = err; //Avoid an unused parameter warning when GLIBMM_EXCEPTIONS_ENABLED is used.
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)
{
@ -430,6 +500,7 @@ GIOStatus GlibmmIOChannel::io_write(GIOChannel* channel, const char* buf, gsize
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
return G_IO_STATUS_ERROR;
}
@ -437,11 +508,16 @@ GIOStatus GlibmmIOChannel::io_write(GIOChannel* channel, const char* buf, gsize
// static
GIOStatus GlibmmIOChannel::io_seek(GIOChannel* channel, gint64 offset, GSeekType type, GError** err)
{
if(!&err) err = err; //Avoid an unused parameter warning when GLIBMM_EXCEPTIONS_ENABLED is used.
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)
{
@ -451,6 +527,7 @@ GIOStatus GlibmmIOChannel::io_seek(GIOChannel* channel, gint64 offset, GSeekType
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
return G_IO_STATUS_ERROR;
}
@ -458,11 +535,16 @@ GIOStatus GlibmmIOChannel::io_seek(GIOChannel* channel, gint64 offset, GSeekType
// static
GIOStatus GlibmmIOChannel::io_close(GIOChannel* channel, GError** err)
{
if(!&err) err = err; //Avoid an unused parameter warning when GLIBMM_EXCEPTIONS_ENABLED is used.
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)
{
@ -472,6 +554,8 @@ GIOStatus GlibmmIOChannel::io_close(GIOChannel* channel, GError** err)
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
return G_IO_STATUS_ERROR;
}
@ -481,15 +565,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;
}
@ -509,11 +597,16 @@ void GlibmmIOChannel::io_free(GIOChannel* channel)
// static
GIOStatus GlibmmIOChannel::io_set_flags(GIOChannel* channel, GIOFlags flags, GError** err)
{
if(!&err) err = err; //Avoid an unused parameter warning when GLIBMM_EXCEPTIONS_ENABLED is used.
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)
{
@ -523,6 +616,7 @@ GIOStatus GlibmmIOChannel::io_set_flags(GIOChannel* channel, GIOFlags flags, GEr
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
return G_IO_STATUS_ERROR;
}
@ -532,14 +626,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);
}
@ -567,70 +665,162 @@ Glib::IOChannelError::Code Glib::IOChannelError::code() const
return static_cast<Code>(Glib::Error::code());
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void Glib::IOChannelError::throw_func(GError* gobject)
{
throw Glib::IOChannelError(gobject);
}
#else
//When not using exceptions, we just pass the Exception object around without throwing it:
std::auto_ptr<Glib::Error> Glib::IOChannelError::throw_func(GError* gobject)
{
return std::auto_ptr<Glib::Error>(new Glib::IOChannelError(gobject));
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
namespace Glib
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
IOStatus IOChannel::read(gunichar& unichar)
#else
IOStatus IOChannel::read(gunichar& unichar, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError *error = 0;
IOStatus retvalue = ((IOStatus)(g_io_channel_read_unichar(gobj(), &(unichar), &(error))));
if(error) ::Glib::Error::throw_exception(error);
GError* gerror = 0;
IOStatus retvalue = ((IOStatus)(g_io_channel_read_unichar(gobj(), &(unichar), &(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
IOStatus IOChannel::read(char* buf, gsize count, gsize& bytes_read)
#else
IOStatus IOChannel::read(char* buf, gsize count, gsize& bytes_read, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError *error = 0;
IOStatus retvalue = ((IOStatus)(g_io_channel_read_chars(gobj(), buf, count, &(bytes_read), &(error))));
if(error) ::Glib::Error::throw_exception(error);
GError* gerror = 0;
IOStatus retvalue = ((IOStatus)(g_io_channel_read_chars(gobj(), buf, count, &(bytes_read), &(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
IOStatus IOChannel::write(const char* buf, gssize count, gsize& bytes_written)
#else
IOStatus IOChannel::write(const char* buf, gssize count, gsize& bytes_written, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError *error = 0;
IOStatus retvalue = ((IOStatus)(g_io_channel_write_chars(gobj(), buf, count, &(bytes_written), &(error))));
if(error) ::Glib::Error::throw_exception(error);
GError* gerror = 0;
IOStatus retvalue = ((IOStatus)(g_io_channel_write_chars(gobj(), buf, count, &(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 retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
IOStatus IOChannel::write(gunichar unichar)
#else
IOStatus IOChannel::write(gunichar unichar, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError *error = 0;
IOStatus retvalue = ((IOStatus)(g_io_channel_write_unichar(gobj(), unichar, &(error))));
if(error) ::Glib::Error::throw_exception(error);
GError* gerror = 0;
IOStatus retvalue = ((IOStatus)(g_io_channel_write_unichar(gobj(), unichar, &(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
IOStatus IOChannel::seek(gint64 offset, SeekType type)
#else
IOStatus IOChannel::seek(gint64 offset, SeekType type, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError *error = 0;
IOStatus retvalue = ((IOStatus)(g_io_channel_seek_position(gobj(), offset, ((GSeekType)(type)), &(error))));
if(error) ::Glib::Error::throw_exception(error);
GError* gerror = 0;
IOStatus retvalue = ((IOStatus)(g_io_channel_seek_position(gobj(), offset, ((GSeekType)(type)), &(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
IOStatus IOChannel::flush()
#else
IOStatus IOChannel::flush(std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError *error = 0;
IOStatus retvalue = ((IOStatus)(g_io_channel_flush(gobj(), &(error))));
if(error) ::Glib::Error::throw_exception(error);
GError* gerror = 0;
IOStatus retvalue = ((IOStatus)(g_io_channel_flush(gobj(), &(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
IOStatus IOChannel::close(bool flush)
#else
IOStatus IOChannel::close(bool flush, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError *error = 0;
IOStatus retvalue = ((IOStatus)(g_io_channel_shutdown(gobj(), static_cast<int>(flush), &(error))));
if(error) ::Glib::Error::throw_exception(error);
GError* gerror = 0;
IOStatus retvalue = ((IOStatus)(g_io_channel_shutdown(gobj(), static_cast<int>(flush), &(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;
}
gsize IOChannel::get_buffer_size() const
@ -640,7 +830,7 @@ gsize IOChannel::get_buffer_size() const
void IOChannel::set_buffer_size(gsize size)
{
g_io_channel_set_buffer_size(gobj(), size);
g_io_channel_set_buffer_size(gobj(), size);
}
IOFlags IOChannel::get_flags() const
@ -648,17 +838,29 @@ IOFlags IOChannel::get_flags() const
return ((IOFlags)(g_io_channel_get_flags(const_cast<GIOChannel*>(gobj()))));
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
IOStatus IOChannel::set_flags(IOFlags flags)
#else
IOStatus IOChannel::set_flags(IOFlags flags, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError *error = 0;
IOStatus retvalue = ((IOStatus)(g_io_channel_set_flags(gobj(), ((GIOFlags)(flags)), &(error))));
if(error) ::Glib::Error::throw_exception(error);
GError* gerror = 0;
IOStatus retvalue = ((IOStatus)(g_io_channel_set_flags(gobj(), ((GIOFlags)(flags)), &(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;
}
void IOChannel::set_buffered(bool buffered)
{
g_io_channel_set_buffered(gobj(), static_cast<int>(buffered));
g_io_channel_set_buffered(gobj(), static_cast<int>(buffered));
}
bool IOChannel::get_buffered() const
@ -678,7 +880,7 @@ bool IOChannel::get_close_on_unref() const
void IOChannel::set_close_on_unref(bool do_close)
{
g_io_channel_set_close_on_unref(gobj(), static_cast<int>(do_close));
g_io_channel_set_close_on_unref(gobj(), static_cast<int>(do_close));
}

View File

@ -147,7 +147,14 @@ public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
#ifdef GLIBMM_EXCEPTIONS_ENABLED
static void throw_func(GError* gobject);
#else
//When not using exceptions, we just pass the Exception object around without throwing it:
static std::auto_ptr<Glib::Error> throw_func(GError* gobject);
#endif //GLIBMM_EXCEPTIONS_ENABLED
friend void wrap_init(); // uses throw_func()
#endif
};
@ -202,7 +209,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
/** Creates an I/O channel from a file descriptor.
@ -264,7 +275,12 @@ public:
* or G::IOChannelError.
* @return A G::IOStatus.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
IOStatus read(gunichar& unichar);
#else
IOStatus read(gunichar& unichar, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Read a character sequence into memory.
* @param buf A buffer to read data into.
@ -293,7 +309,12 @@ public:
* or G::IOChannelError.
* @return The status of the operation.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
IOStatus read(char* buf, gsize count, gsize& bytes_read);
#else
IOStatus read(char* buf, gsize count, gsize& bytes_read, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Read a maximum of @a count bytes into @a str.
* @param count The maximum number of bytes to read.
@ -302,7 +323,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
@ -312,7 +337,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
/** Reads all the remaining data from the file.
@ -322,7 +351,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
/** Write a string to the I/O channel.
@ -334,7 +367,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.
@ -363,7 +400,12 @@ public:
* or G::IOChannelError.
* @return The status of the operation.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
IOStatus write(const char* buf, gssize count, gsize& bytes_written);
#else
IOStatus write(const char* buf, gssize count, gsize& bytes_written, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Write a single UCS-4 character to the I/O channel.
* @param unichar The character to write.
@ -378,7 +420,12 @@ public:
* or G::IOChannelError.
* @return A G::IOStatus.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
IOStatus write(gunichar unichar);
#else
IOStatus write(gunichar unichar, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Seek the I/O channel to a specific position.
* @param offset The offset in bytes from the position specified by @a type.
@ -399,7 +446,12 @@ public:
* @param error A location to return an error of type G::IOChannelError.
* @return The status of the operation.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
IOStatus seek(gint64 offset, SeekType type = SEEK_TYPE_SET);
#else
IOStatus seek(gint64 offset, SeekType type, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Flush the buffers of the I/O channel.
* @return The status of the operation.
@ -413,7 +465,12 @@ public:
* G::IO_CHANNEL_NORMAL, G::IO_CHANNEL_AGAIN, or
* G::IO_CHANNEL_ERROR.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
IOStatus flush();
#else
IOStatus flush(std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Close the I/O channel.
* Any pending data to be written will be flushed if @a flush is <tt>true</tt>.
@ -431,7 +488,12 @@ public:
* @param err Location to store a G::IOChannelError.
* @return The status of the operation.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
IOStatus close(bool flush = true);
#else
IOStatus close(bool flush, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Get the IOChannel internal buffer size.
* @return The buffer size.
@ -487,7 +549,12 @@ public:
* @param error A location to return an error of type G::IOChannelError.
* @return The status of the operation.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
IOStatus set_flags(IOFlags flags);
#else
IOStatus set_flags(IOFlags flags, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Set the buffering status of the I/O channel.
* The buffering state can only be set if the channel's encoding is
@ -617,7 +684,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
/** Get the encoding of the I/O channel.

View File

@ -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,43 @@ 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()))
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;
}
/* Only used by SignalChildWatch::connect().
* These don't use Glib::Source, to avoid the unnecessary overhead
* of a completely unused wrapper object.
*/
static gboolean glibmm_child_watch_callback(GPid pid, gint child_status, 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.
(*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;
}
@ -364,6 +395,40 @@ SignalIO signal_io()
return SignalIO(0); // 0 means default context
}
/**** Glib::SignalChildWatch **************************************************/
inline
SignalChildWatch::SignalChildWatch(GMainContext* context)
:
context_ (context)
{}
sigc::connection SignalChildWatch::connect(const sigc::slot<void, GPid, int>& slot,
GPid pid, int priority)
{
SourceConnectionNode *const conn_node = new SourceConnectionNode(slot);
const sigc::connection connection(*conn_node->get_slot());
GSource *const source = g_child_watch_source_new(pid);
if(priority != G_PRIORITY_DEFAULT)
g_source_set_priority(source, priority);
g_source_set_callback(
source, (GSourceFunc)&glibmm_child_watch_callback, conn_node,
&SourceConnectionNode::destroy_notify_callback);
g_source_attach(source, context_);
g_source_unref(source); // GMainContext holds a reference
conn_node->install(source);
return connection;
}
SignalChildWatch signal_child_watch()
{
return SignalChildWatch(0); // 0 means default context
}
/**** Glib::MainContext ****************************************************/
@ -485,6 +550,11 @@ SignalIO MainContext::signal_io()
return SignalIO(gobj());
}
SignalChildWatch MainContext::signal_child_watch()
{
return SignalChildWatch(gobj());
}
void MainContext::reference() const
{
g_main_context_ref(reinterpret_cast<GMainContext*>(const_cast<MainContext*>(this)));
@ -747,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;
}
@ -782,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;
}

View File

@ -277,6 +277,29 @@ private:
SignalIO& operator=(const SignalIO&);
};
class SignalChildWatch
{
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
explicit inline SignalChildWatch(GMainContext* context);
#endif
/** Connects a child watch handler.
* @code
* Glib::signal_child_watch().connect(sigc::ptr_fun(&child_watch_handler), pid);
* @endcode
* @param slot A slot to call when child @a pid exited.
* @param pid The child to watch for.
* @param priority The priority of the new event source.
* @return A connection handle, which can be used to disconnect the handler.
*/
sigc::connection connect(const sigc::slot<void,GPid, int>& slot, GPid pid,
int priority = PRIORITY_DEFAULT);
private:
GMainContext* context_;
// no copy assignment
SignalChildWatch& operator=(const SignalChildWatch&);
};
/** Convenience timeout signal.
* @return A signal proxy; you want to use SignalTimeout::connect().
@ -293,6 +316,11 @@ SignalIdle signal_idle();
*/
SignalIO signal_io();
/** Convenience child watch signal.
* @return A signal proxy; you want to use SignalChildWatch::connect().
*/
SignalChildWatch signal_child_watch();
/** Main context.
*/
@ -313,7 +341,10 @@ public:
static Glib::RefPtr<MainContext> get_default();
/** Runs a single iteration for the given main loop.
* This involves checking to see if any event sources are ready to be processed, then if no events sources are ready and may_block is true, waiting for a source to become ready, then dispatching the highest priority events sources that are ready. Note that even when may_block is true, it is still possible for iteration() to return FALSE, since the the wait may be interrupted for other reasons than an event source becoming ready.
* This involves checking to see if any event sources are ready to be processed, then if no events sources are
* ready and may_block is true, waiting for a source to become ready, then dispatching the highest priority events
* sources that are ready. Note that even when may_block is true, it is still possible for iteration() to return
* false, since the the wait may be interrupted for other reasons than an event source becoming ready.
* @param may_block Whether the call may block.
* @return true if events were dispatched.
*/
@ -329,21 +360,26 @@ public:
void wakeup();
/** Tries to become the owner of the specified context.
* If some other context is the owner of the context, returns FALSE immediately. Ownership is properly recursive: the owner can require ownership again and will release ownership when release() is called as many times as acquire().
* If some other context is the owner of the context, returns FALSE immediately. Ownership is properly recursive:
* the owner can require ownership again and will release ownership when release() is called as many times as
* acquire().
* You must be the owner of a context before you can call prepare(), query(), check(), dispatch().
* @return true if the operation succeeded, and this thread is now the owner of context.
*/
bool acquire();
/** Tries to become the owner of the specified context, as with acquire(). But if another thread is the owner, atomically drop mutex and wait on cond until that owner releases ownership or until cond is signaled, then try again (once) to become the owner.
/** Tries to become the owner of the specified context, as with acquire(). But if another thread is the owner,
* atomically drop mutex and wait on cond until that owner releases ownership or until cond is signaled, then try
* again (once) to become the owner.
* @param cond A condition variable.
* @param mutex A mutex, currently held.
* @return true if the operation succeeded, and this thread is now the owner of context.
*/
bool wait(Glib::Cond& cond, Glib::Mutex& mutex);
/** Releases ownership of a context previously acquired by this thread with acquire(). If the context was acquired multiple times, the only release ownership when release() is called as many times as it was acquired.
/** Releases ownership of a context previously acquired by this thread with acquire(). If the context was acquired
* multiple times, the only release ownership when release() is called as many times as it was acquired.
*/
void release();
@ -416,6 +452,11 @@ public:
*/
SignalIO signal_io();
/** child watch signal, attached to this MainContext.
* @return A signal proxy; you want to use SignalChildWatch::connect().
*/
SignalChildWatch signal_child_watch();
void reference() const;
void unreference() const;

View File

@ -1,5 +1,6 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#include <glibmm/markup.h>
#include <glibmm/private/markup_p.h>
@ -103,11 +104,15 @@ void ParserCallbacks::start_element(GMarkupParseContext* context,
void* user_data,
GError** error)
{
if(!&error) error = 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)
@ -122,6 +127,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)
{
@ -131,6 +137,7 @@ void ParserCallbacks::start_element(GMarkupParseContext* context,
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
void ParserCallbacks::end_element(GMarkupParseContext* context,
@ -138,12 +145,17 @@ void ParserCallbacks::end_element(GMarkupParseContext* context,
void* user_data,
GError** error)
{
if(!&error) error = 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)
{
@ -153,6 +165,7 @@ void ParserCallbacks::end_element(GMarkupParseContext* context,
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
void ParserCallbacks::text(GMarkupParseContext* context,
@ -161,12 +174,17 @@ void ParserCallbacks::text(GMarkupParseContext* context,
void* user_data,
GError** error)
{
if(!&error) error = 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)
{
@ -176,6 +194,7 @@ void ParserCallbacks::text(GMarkupParseContext* context,
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
void ParserCallbacks::passthrough(GMarkupParseContext* context,
@ -184,13 +203,18 @@ void ParserCallbacks::passthrough(GMarkupParseContext* context,
void* user_data,
GError** error)
{
if(!&error) error = 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)
{
@ -200,6 +224,7 @@ void ParserCallbacks::passthrough(GMarkupParseContext* context,
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
void ParserCallbacks::error(GMarkupParseContext* context,
@ -211,14 +236,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
}
@ -342,9 +371,17 @@ Glib::MarkupError::Code Glib::MarkupError::code() const
return static_cast<Code>(Glib::Error::code());
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void Glib::MarkupError::throw_func(GError* gobject)
{
throw Glib::MarkupError(gobject);
}
#else
//When not using exceptions, we just pass the Exception object around without throwing it:
std::auto_ptr<Glib::Error> Glib::MarkupError::throw_func(GError* gobject)
{
return std::auto_ptr<Glib::Error>(new Glib::MarkupError(gobject));
}
#endif //GLIBMM_EXCEPTIONS_ENABLED

View File

@ -95,7 +95,14 @@ public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
#ifdef GLIBMM_EXCEPTIONS_ENABLED
static void throw_func(GError* gobject);
#else
//When not using exceptions, we just pass the Exception object around without throwing it:
static std::auto_ptr<Glib::Error> throw_func(GError* gobject);
#endif //GLIBMM_EXCEPTIONS_ENABLED
friend void wrap_init(); // uses throw_func()
#endif
};

View File

@ -100,7 +100,8 @@ std::string get_real_name()
std::string get_home_dir()
{
return std::string(g_get_home_dir());
const char *const value = g_get_home_dir();
return (value) ? std::string(value) : std::string();
}
std::string get_tmp_dir()
@ -144,21 +145,25 @@ std::string path_get_dirname(const std::string& filename)
std::string build_filename(const Glib::ArrayHandle<std::string>& elements)
{
return build_path(G_DIR_SEPARATOR_S, elements);
return Glib::convert_return_gchar_ptr_to_stdstring( g_build_filenamev(const_cast<char**>(elements.data())) );
}
std::string build_filename(const std::string& elem1, const std::string& elem2)
{
const char *const elements[] = { elem1.c_str(), elem2.c_str(), 0 };
return build_path(G_DIR_SEPARATOR_S, elements);
return build_filename(elements);
}
std::string build_path(const std::string& separator, const Glib::ArrayHandle<std::string>& elements)
{
return Glib::convert_return_gchar_ptr_to_stdstring( g_build_pathv(separator.c_str(), const_cast<char**>(elements.data())) );
/* Yes, this reimplements the functionality of g_build_path() -- because
* it takes a varargs list, and calling it several times would result
* in different behaviour.
*/
std::string build_path(const std::string& separator, const Glib::ArrayHandle<std::string>& elements)
{
/*
std::string result;
result.reserve(256); //TODO: Explain why this magic number is useful. murrayc
@ -229,6 +234,7 @@ std::string build_path(const std::string& separator, const Glib::ArrayHandle<std
result += last_trailing;
return result;
*/
}
std::string find_program_in_path(const std::string& program)

View File

@ -137,7 +137,7 @@ std::string get_user_name();
std::string get_real_name();
/** Gets the current user's home directory.
* @return The current user's home directory.
* @return The current user's home directory or an empty string if not defined.
*/
std::string get_home_dir();

View File

@ -1,5 +1,6 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#include <glibmm/module.h>
#include <glibmm/private/module_p.h>
@ -62,9 +63,10 @@ bool Module::get_supported()
return g_module_supported();
}
void Module::make_resident()
{
g_module_make_resident(gobj());
g_module_make_resident(gobj());
}
std::string Module::get_last_error()
@ -72,6 +74,7 @@ std::string Module::get_last_error()
return Glib::convert_const_gchar_ptr_to_stdstring(g_module_error());
}
bool Module::get_symbol(const std::string& symbol_name, void*& symbol) const
{
return g_module_symbol(const_cast<GModule*>(gobj()), symbol_name.c_str(), &(symbol));

View File

@ -53,7 +53,8 @@ namespace Glib
enum ModuleFlags
{
MODULE_BIND_LAZY = 1 << 0,
MODULE_BIND_MASK = 0x01
MODULE_BIND_LOCAL = 1 << 1,
MODULE_BIND_MASK = 0x03
};
/** @ingroup glibmmEnums */

View File

@ -20,6 +20,12 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
//X11 defines DestroyNotify and some other non-prefixed stuff, and it's too late to change that now,
//so let's give people a clue about the compilation errors that they will see:
#ifdef DestroyNotify
#error "X11/Xlib.h seems to have been included before this header. Due to some commonly-named macros in X11/Xlib.h, it may only be included after any glibmm, gdkmm, or gtkmm headers."
#endif //DestroyNotify
#include <glibmm/objectbase.h>
#include <glibmm/wrap.h>
#include <glibmm/quark.h>
@ -28,6 +34,8 @@
#include <glibmm/containerhandle_shared.h> //Because its specializations may be here.
#include <glibmm/value.h>
#include <glibmmconfig.h>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
extern "C"
{
@ -84,7 +92,7 @@ private:
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
class Object : virtual public ObjectBase
class GLIBMM_API Object : virtual public ObjectBase
{
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@ -188,7 +196,7 @@ struct TypeTraits< Glib::RefPtr<T> >
}
};
//This confuse the SUN Forte compiler, so we ifdef it out:
//This confuses the SUN Forte compiler, so we ifdef it out:
#ifdef GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS
/** Partial specialization for pointers to const GObject instances.

View File

@ -22,6 +22,7 @@
#include <glibmm/quark.h>
#include <glibmm/objectbase.h>
#include <glibmm/propertyproxy_base.h> //For PropertyProxyConnectionNode
namespace
@ -31,7 +32,7 @@ namespace
// char array rather than a string literal allows for fast pointer comparison,
// which is otherwise not guaranteed to work.
const char anonymous_custom_type_name[] = "gtkmm__anonymous_custom_type";
static const char anonymous_custom_type_name[] = "gtkmm__anonymous_custom_type";
} // anonymous namespace
@ -255,6 +256,23 @@ void ObjectBase::get_property_value(const Glib::ustring& property_name, Glib::Va
g_object_get_property(const_cast<GObject*>(gobj()), property_name.c_str(), value.gobj());
}
void ObjectBase::connect_property_changed(const Glib::ustring& property_name, const sigc::slot<void>& slot)
{
// Create a proxy to hold our connection info
// This will be deleted by destroy_notify_handler.
PropertyProxyConnectionNode* pConnectionNode = new PropertyProxyConnectionNode(slot, gobj());
// connect it to gtk+
// pConnectionNode will be passed as the data argument to the callback.
// The callback will then call the virtual Object::property_change_notify() method,
// which will contain a switch/case statement which will examine the property name.
const Glib::ustring notify_signal_name = "notify::" + property_name;
pConnectionNode->connection_id_ = g_signal_connect_data(gobj(),
notify_signal_name.c_str(), (GCallback)(&PropertyProxyConnectionNode::callback), pConnectionNode,
&PropertyProxyConnectionNode::destroy_notify_handler,
G_CONNECT_AFTER);
}
bool _gobject_cppinstance_already_deleted(GObject* gobject)
{

View File

@ -23,11 +23,15 @@
#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>
#include <glibmm/debug.h>
#include <glibmmconfig.h>
GLIBMM_USING_STD(type_info)
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@ -44,35 +48,44 @@ class GSigConnectionNode;
//This inherits virtually from sigc::trackable so that people can multiply inherit glibmm classes from other sigc::trackable-derived classes.
//See bugzilla.gnome.org bug # 116280
class ObjectBase : virtual public sigc::trackable
/** Glib::ObjectBase is a common base class for Objects and Interfaces.
*
* This is used as virtual base class. This means the ObjectBase
* constructor runs before all others, either implicitly or explicitly. Each of
* the available constructors initializes custom_type_name_ in a different way.
*/
class GLIBMM_API ObjectBase : virtual public sigc::trackable
{
protected:
// Glib::ObjectBase is used as virtual base class. This means the ObjectBase
// ctor runs before all others -- either implicitly or explicitly. Each of
// the available ctors initializes custom_type_name_ in a different way:
//
// 1) default: custom_type_name_ = "gtkmm__anonymous_custom_type"
// 2) const char*: custom_type_name_ = custom_type_name
// 3) type_info: custom_type_name_ = custom_type_info.name()
//
// All classes generated by gtkmmproc use ctor 2) with custom_type_name = 0,
// which essentially means it's not a custom type. This is used to optimize
// vfunc and signal handler callbacks -- since the C++ virtual methods are
// not overridden, invocation can be skipped.
//
// The default ctor 1) is called implicitly from the ctor of user-derived
// classes -- yes, even if e.g. Gtk::Button calls ctor 2), a derived ctor
// always overrides this choice. The language itself ensures that the ctor
// is only invoked once.
//
// Ctor 3) is a special feature to allow creation of derived types on the
// fly, without having to use g_object_new() manually. This feature is
// sometimes necessary, e.g. to implement a custom Gtk::CellRenderer. The
// neat trick with the virtual base class ctor makes it possible to reuse
// the same direct base class' ctor as with non-custom types.
/** This default constructor is called implicitly from the constructor of user-derived
* classes, even if, for instance, Gtk::Button calls a different ObjectBase constructor.
* This is normal behaviour for C++ virtual inheritance.
*
* The GType name will be gtkmm__anonymous_custom_type.
*/
ObjectBase();
/** A derived constructor always overrides this choice.
* The C++ language itself ensures that the constructor
* is only invoked once.
*
* All classes generated by gtkmmproc use this constructor, with custom_type_name = 0,
* which essentially means it's not a custom type. This is used to optimize
* vfunc and signal handler callbacks -- since the C++ virtual methods are
* not overridden, invocation can be skipped.
*
* The GType name will be @a custom_type_name.
*/
explicit ObjectBase(const char* custom_type_name);
/** This constructor is a special feature to allow creation of derived types on the
* fly, without having to use g_object_new() manually. This feature is
* sometimes necessary, e.g. to implement a custom Gtk::CellRenderer. The
* neat trick with the virtual base class ctor makes it possible to reuse
* the same direct base class' constructor as with non-custom types.
*
* The GType name will be @a custom_type_info.name().
*/
explicit ObjectBase(const std::type_info& custom_type_info);
virtual ~ObjectBase() = 0;
@ -96,22 +109,38 @@ public:
template <class PropertyType>
void get_property(const Glib::ustring& property_name, PropertyType& value) const;
virtual void reference() const;
/** You can use the signal_changed() signal of the property proxy instead,
* but this is necessary when using the reduced API.
*/
void connect_property_changed(const Glib::ustring& property_name, const sigc::slot<void>& slot);
/** Increment the reference count for this object.
* You should never need to do this manually - use the object via a RefPtr instead.
*/
virtual void reference() const;
/** Decrement the reference count for this object.
* You should never need to do this manually - use the object via a RefPtr instead.
*/
virtual void unreference() const;
///Provides access to the underlying C GtkObject.
inline GObject* gobj() { return gobject_; }
///Provides access to the underlying C GtkObject.
inline const GObject* gobj() const { return gobject_; }
// Give a ref-ed copy to someone. Use for direct struct access.
/// Give a ref-ed copy to someone. Use for direct struct access.
GObject* gobj_copy() const;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
static ObjectBase* _get_current_wrapper(GObject* object);
bool _cpp_destruction_is_in_progress() const;
#endif
#endif //DOXYGEN_SHOULD_SKIP_THIS
protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
GObject* gobject_; // the GLib/GDK/GTK+ object instance
const char* custom_type_name_;
bool cpp_destruction_in_progress_;
@ -123,13 +152,16 @@ protected:
virtual void destroy_notify_();
void _set_current_wrapper(GObject* object);
#endif //DOXYGEN_SHOULD_SKIP_THIS
private:
// noncopyable
ObjectBase(const ObjectBase&);
ObjectBase& operator=(const ObjectBase&);
#ifndef DOXYGEN_SHOULD_SKIP_THIS
virtual void set_manage(); // calls g_error()
#endif //DOXYGEN_SHOULD_SKIP_THIS
#ifndef DOXYGEN_SHOULD_SKIP_THIS
friend class Glib::GSigConnectionNode; // for GSigConnectionNode::notify()
@ -138,7 +170,7 @@ private:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
template <class PropertyType>
template <class PropertyType> inline
void ObjectBase::set_property(const Glib::ustring& property_name, const PropertyType& value)
{
Glib::Value<PropertyType> property_value;
@ -148,7 +180,7 @@ void ObjectBase::set_property(const Glib::ustring& property_name, const Property
this->set_property_value(property_name, property_value);
}
template <class PropertyType>
template <class PropertyType> inline
void ObjectBase::get_property(const Glib::ustring& property_name, PropertyType& value) const
{
Glib::Value<PropertyType> property_value;

View File

@ -1,5 +1,6 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#include <glibmm/optioncontext.h>
#include <glibmm/private/optioncontext_p.h>
@ -97,10 +98,18 @@ Glib::OptionError::Code Glib::OptionError::code() const
return static_cast<Code>(Glib::Error::code());
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void Glib::OptionError::throw_func(GError* gobject)
{
throw Glib::OptionError(gobject);
}
#else
//When not using exceptions, we just pass the Exception object around without throwing it:
std::auto_ptr<Glib::Error> Glib::OptionError::throw_func(GError* gobject)
{
return std::auto_ptr<Glib::Error>(new Glib::OptionError(gobject));
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
namespace Glib
@ -109,7 +118,7 @@ namespace Glib
void OptionContext::set_help_enabled(bool help_enabled)
{
g_option_context_set_help_enabled(gobj(), static_cast<int>(help_enabled));
g_option_context_set_help_enabled(gobj(), static_cast<int>(help_enabled));
}
bool OptionContext::get_help_enabled() const
@ -119,7 +128,7 @@ bool OptionContext::get_help_enabled() const
void OptionContext::set_ignore_unknown_options(bool ignore_unknown)
{
g_option_context_set_ignore_unknown_options(gobj(), static_cast<int>(ignore_unknown));
g_option_context_set_ignore_unknown_options(gobj(), static_cast<int>(ignore_unknown));
}
bool OptionContext::get_ignore_unknown_options() const
@ -127,12 +136,24 @@ bool OptionContext::get_ignore_unknown_options() const
return g_option_context_get_ignore_unknown_options(const_cast<GOptionContext*>(gobj()));
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool OptionContext::parse(int& argc, char**& argv)
#else
bool OptionContext::parse(int& argc, char**& argv, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError *error = 0;
bool retvalue = g_option_context_parse(gobj(), &argc, &(argv), &(error));
if(error) ::Glib::Error::throw_exception(error);
GError* gerror = 0;
bool retvalue = g_option_context_parse(gobj(), &argc, &(argv), &(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;
}

View File

@ -54,7 +54,14 @@ public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
#ifdef GLIBMM_EXCEPTIONS_ENABLED
static void throw_func(GError* gobject);
#else
//When not using exceptions, we just pass the Exception object around without throwing it:
static std::auto_ptr<Glib::Error> throw_func(GError* gobject);
#endif //GLIBMM_EXCEPTIONS_ENABLED
friend void wrap_init(); // uses throw_func()
#endif
};
@ -91,7 +98,7 @@ public:
* and &lt;option&gt;--help-&lt;/option&gt;&lt;replaceable&gt;groupname&lt;/replaceable&gt; and creates
* suitable output to stdout.
*
* Since: 2.6
* @newin2p6
* @param help_enabled <tt>true</tt> to enable &lt;option&gt;--help&lt;/option&gt;, <tt>false</tt> to disable it.
*/
void set_help_enabled(bool help_enabled = true);
@ -100,7 +107,7 @@ public:
* is turned on for @a context . See g_option_context_set_help_enabled().
* @return <tt>true</tt> if automatic help generation is turned on.
*
* Since: 2.6.
* @newin2p6.
*/
bool get_help_enabled() const;
@ -112,7 +119,7 @@ public:
* which don't start with a dash). But note that GOption cannot reliably
* determine whether a non-option belongs to a preceding unknown option.
*
* Since: 2.6
* @newin2p6
* @param ignore_unknown <tt>true</tt> to ignore unknown options, <tt>false</tt> to produce
* an error when unknown options are met.
*/
@ -122,7 +129,7 @@ public:
* g_option_context_set_ignore_unknown_options().
* @return <tt>true</tt> if unknown options are ignored.
*
* Since: 2.6.
* @newin2p6.
*/
bool get_ignore_unknown_options() const;
@ -134,8 +141,10 @@ public:
*
* If the parsing is successful, any parsed arguments are
* removed from the array and @a argc and @a argv are updated
* accordingly. In case of an error, @a argc and @a argv are
* left unmodified.
* accordingly. A '--' option is stripped from @a argv
* unless there are unparsed options before and after it,
* or some of the options after it start with '-'. In case
* of an error, @a argc and @a argv are left unmodified.
*
* If automatic &lt;option&gt;--help&lt;/option&gt; support is enabled
* (see g_option_context_set_help_enabled()), and the
@ -148,9 +157,14 @@ public:
* @return <tt>true</tt> if the parsing was successful,
* <tt>false</tt> if an error occurred
*
* Since: 2.6.
* @newin2p6.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool parse(int& argc, char**& argv);
#else
bool parse(int& argc, char**& argv, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
//g_option_context_add_main_entries(), just creates a group internally, adds them to it, and does a set_main_group()
//- a group without callbacks seems to do some simple default parsing.

View File

@ -1,5 +1,6 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#include <glibmm/optionentry.h>
#include <glibmm/private/optionentry_p.h>
@ -31,7 +32,6 @@ namespace Glib
{
OptionEntry::OptionEntry()
: gobject_( new GOptionEntry() )
{
gobject_ = g_new0(GOptionEntry, 1);
}
@ -47,7 +47,7 @@ OptionEntry::~OptionEntry()
OptionEntry::OptionEntry(const OptionEntry& src)
{
gobject_ = g_new0(GOptionEntry, 1);
operator=(src);
}
@ -57,29 +57,29 @@ OptionEntry& OptionEntry::operator=(const OptionEntry& src)
{
if(gobject_->long_name)
g_free(const_cast<char*>(gobject_->long_name));
gobject_->long_name = g_strdup(src.gobject_->long_name);
gobject_->short_name = src.gobject_->short_name; //It's just one char.
gobject_->flags = src.gobject_->flags;
gobject_->arg = src.gobject_->arg;
gobject_->arg_data = src.gobject_->arg_data; //Shared, because it's not owned by any instance of this class anyway.
if(gobject_->description)
g_free(const_cast<char*>(gobject_->description));
gobject_->description = g_strdup(src.gobject_->description);
if(gobject_->arg_description)
g_free(const_cast<char*>(gobject_->arg_description));
gobject_->arg_description = g_strdup(src.gobject_->arg_description);
}
return *this;
}
} // namespace Glib
@ -93,56 +93,56 @@ namespace Glib
{
Glib::ustring OptionEntry::get_long_name() const
Glib::ustring OptionEntry::get_long_name() const
{
return Glib::convert_const_gchar_ptr_to_ustring(gobj()->long_name);
}
void OptionEntry::set_long_name(const Glib::ustring& value)
void OptionEntry::set_long_name(const Glib::ustring& value)
{
gobj()->long_name = g_strdup((value).c_str());
}
gchar OptionEntry::get_short_name() const
gchar OptionEntry::get_short_name() const
{
return gobj()->short_name;
}
void OptionEntry::set_short_name(const gchar& value)
void OptionEntry::set_short_name(const gchar& value)
{
gobj()->short_name = value;
}
int OptionEntry::get_flags() const
int OptionEntry::get_flags() const
{
return gobj()->flags;
}
void OptionEntry::set_flags(const int& value)
void OptionEntry::set_flags(const int& value)
{
gobj()->flags = value;
}
Glib::ustring OptionEntry::get_description() const
Glib::ustring OptionEntry::get_description() const
{
return Glib::convert_const_gchar_ptr_to_ustring(gobj()->description);
}
void OptionEntry::set_description(const Glib::ustring& value)
void OptionEntry::set_description(const Glib::ustring& value)
{
gobj()->description = g_strdup((value).c_str());
}
Glib::ustring OptionEntry::get_arg_description() const
Glib::ustring OptionEntry::get_arg_description() const
{
return Glib::convert_const_gchar_ptr_to_ustring(gobj()->arg_description);
}
void OptionEntry::set_arg_description(const Glib::ustring& value)
void OptionEntry::set_arg_description(const Glib::ustring& value)
{
gobj()->arg_description = g_strdup((value).c_str());
}
} // namespace Glib

View File

@ -64,7 +64,11 @@ public:
{
FLAG_HIDDEN = 1 << 0,
FLAG_IN_MAIN = 1 << 1,
FLAG_REVERSE = 1 << 2
FLAG_REVERSE = 1 << 2,
FLAG_NO_ARG = 1 << 3,
FLAG_FILENAME = 1 << 4,
FLAG_OPTIONAL_ARG = 1 << 5,
FLAG_NOALIAS = 1 << 6
} GOptionFlags;
OptionEntry();
@ -74,23 +78,23 @@ public:
OptionEntry& operator=(const OptionEntry& src);
Glib::ustring get_long_name() const;
void set_long_name(const Glib::ustring& value);
gchar get_short_name() const;
void set_short_name(const gchar& value);
int get_flags() const;
void set_flags(const int& value);
Glib::ustring get_long_name() const;
void set_long_name(const Glib::ustring& value);
gchar get_short_name() const;
void set_short_name(const gchar& value);
int get_flags() const;
void set_flags(const int& value);
//TODO: G_OPTION_ARG_CALLBACK,
Glib::ustring get_description() const;
void set_description(const Glib::ustring& value);
Glib::ustring get_arg_description() const;
void set_arg_description(const Glib::ustring& value);
Glib::ustring get_description() const;
void set_description(const Glib::ustring& value);
Glib::ustring get_arg_description() const;
void set_arg_description(const Glib::ustring& value);
GOptionEntry* gobj() { return gobject_; }
const GOptionEntry* gobj() const { return gobject_; }

View File

@ -1,5 +1,6 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#include <glibmm/optiongroup.h>
#include <glibmm/private/optiongroup_p.h>
@ -166,17 +167,20 @@ void OptionGroup::add_entry_with_wrapper(const OptionEntry& entry, GOptionArg ar
CppOptionEntry cppEntry;
cppEntry.carg_type_ = arg_type;
cppEntry.allocate_c_arg();
cppEntry.cpparg_ = cpp_arg;
//Remember the C++/C mapping so that we can use it later:
map_entries_[name] = cppEntry;
//Give the information to the C API:
cppEntry.entry_ = new OptionEntry(entry); //g_option_group_add_entry() does not take its own copy, so we must keep the instance alive.*/
cppEntry.entry_ = new OptionEntry(entry); //g_option_group_add_entry() does not take its own copy, so we must keep the instance alive. */
//cppEntry.entry_ is deleted in release_c_arg(), via the destructor.
cppEntry.entry_->gobj()->arg = arg_type;
cppEntry.entry_->gobj()->arg_data = cppEntry.carg_;
//Remember the C++/C mapping so that we can use it later:
map_entries_[name] = cppEntry;
add_entry(*(cppEntry.entry_));
}
}
@ -444,7 +448,7 @@ namespace Glib
void OptionGroup::set_translation_domain(const Glib::ustring& domain)
{
g_option_group_set_translation_domain(gobj(), domain.c_str());
g_option_group_set_translation_domain(gobj(), domain.c_str());
}

View File

@ -96,7 +96,7 @@ void g_option_group_set_translate_func (GOptionGroup *group,
/** A convenience function to use gettext() for translating
* user-visible strings.
*
* Since: 2.6
* @newin2p6
* @param domain The domain to use.
*/
void set_translation_domain(const Glib::ustring& domain);

View File

@ -2,5 +2,7 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GLIBMM_CONVERT_P_H
#define _GLIBMM_CONVERT_P_H
#endif /* _GLIBMM_CONVERT_P_H */

View File

@ -2,5 +2,7 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GLIBMM_DATE_P_H
#define _GLIBMM_DATE_P_H
#endif /* _GLIBMM_DATE_P_H */

View File

@ -2,5 +2,7 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GLIBMM_FILEUTILS_P_H
#define _GLIBMM_FILEUTILS_P_H
#endif /* _GLIBMM_FILEUTILS_P_H */

View File

@ -2,5 +2,7 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GLIBMM_IOCHANNEL_P_H
#define _GLIBMM_IOCHANNEL_P_H
#endif /* _GLIBMM_IOCHANNEL_P_H */

View File

@ -2,5 +2,7 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GLIBMM_MARKUP_P_H
#define _GLIBMM_MARKUP_P_H
#endif /* _GLIBMM_MARKUP_P_H */

View File

@ -2,5 +2,7 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GLIBMM_MODULE_P_H
#define _GLIBMM_MODULE_P_H
#endif /* _GLIBMM_MODULE_P_H */

View File

@ -2,5 +2,7 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GLIBMM_OPTIONCONTEXT_P_H
#define _GLIBMM_OPTIONCONTEXT_P_H
#endif /* _GLIBMM_OPTIONCONTEXT_P_H */

View File

@ -2,5 +2,7 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GLIBMM_OPTIONENTRY_P_H
#define _GLIBMM_OPTIONENTRY_P_H
#endif /* _GLIBMM_OPTIONENTRY_P_H */

View File

@ -2,5 +2,7 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GLIBMM_OPTIONGROUP_P_H
#define _GLIBMM_OPTIONGROUP_P_H
#endif /* _GLIBMM_OPTIONGROUP_P_H */

View File

@ -2,5 +2,7 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GLIBMM_SHELL_P_H
#define _GLIBMM_SHELL_P_H
#endif /* _GLIBMM_SHELL_P_H */

View File

@ -2,5 +2,7 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GLIBMM_SPAWN_P_H
#define _GLIBMM_SPAWN_P_H
#endif /* _GLIBMM_SPAWN_P_H */

View File

@ -2,5 +2,7 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GLIBMM_THREAD_P_H
#define _GLIBMM_THREAD_P_H
#endif /* _GLIBMM_THREAD_P_H */

View File

@ -2,5 +2,7 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GLIBMM_UNICODE_P_H
#define _GLIBMM_UNICODE_P_H
#endif /* _GLIBMM_UNICODE_P_H */

View File

@ -19,6 +19,9 @@
*/
#include <glibmm/property.h>
#ifdef GLIBMM_PROPERTIES_ENABLED
#include <glibmm/object.h>
#include <cstddef>
@ -75,7 +78,7 @@ namespace
//
// We can reimplement this later if necessary.
unsigned int property_to_id(Glib::ObjectBase& object, Glib::PropertyBase& property)
static unsigned int property_to_id(Glib::ObjectBase& object, Glib::PropertyBase& property)
{
void *const base_ptr = dynamic_cast<void*>(&object);
void *const prop_ptr = &property;
@ -196,3 +199,5 @@ void PropertyBase::notify()
} // namespace Glib
#endif //GLIBMM_PROPERTIES_ENABLED

View File

@ -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 */

View File

@ -24,6 +24,7 @@
#include <glibmm/propertyproxy_base.h>
#ifdef GLIBMM_PROPERTIES_ENABLED
namespace Glib
{
@ -86,12 +87,7 @@ public:
/** Set the value of this property.
* @param data The new value for the property.
*/
void set_value(const PropertyType& data)
{
PropertyProxy_Base& base = *this;
// The downcast to PropertyProxy<T> is safe, and avoids code duplication.
static_cast<PropertyProxy<T>&>(base).set_value(data);
}
void set_value(const PropertyType& data);
/** Set the value of this property back to its default value
*/
@ -118,12 +114,7 @@ public:
/** Get the value of this property.
* @result The current value of the property.
*/
PropertyType get_value() const
{
const PropertyProxy_Base& base = *this;
// The downcast to PropertyProxy<T> is safe, and avoids code duplication.
return static_cast<const PropertyProxy<T>&>(base).get_value();
}
PropertyType get_value() const;
operator PropertyType() const
{ return this->get_value(); }
@ -154,10 +145,37 @@ T PropertyProxy<T>::get_value() const
return value.get();
}
//We previously just static_cast<> PropertyProxy_WriteOnly<> to PropertyProxy<> to call its set_value(),
//to avoid code duplication.
//But the AIX compiler does not like that hack.
template <class T>
void PropertyProxy_WriteOnly<T>::set_value(const T& data)
{
Glib::Value<T> value;
value.init(Glib::Value<T>::value_type());
value.set(data);
set_property_(value);
}
//We previously just static_cast<> PropertyProxy_WriteOnly<> to PropertyProxy<> to call its set_value(),
//to avoid code duplication.
//But the AIX compiler does not like that hack.
template <class T>
T PropertyProxy_ReadOnly<T>::get_value() const
{
Glib::Value<T> value;
value.init(Glib::Value<T>::value_type());
get_property_(value);
return value.get();
}
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
} // namespace Glib
#endif //GLIBMM_PROPERTIES_ENABLED
#endif /* _GLIBMM_PROPERTYPROXY_H */

View File

@ -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>
@ -28,26 +31,18 @@
namespace Glib
{
/** PropertyProxyConnectionNode is a connection node for use with SignalProxyProperty.
* It's like ProxyConnectionNode, but it contains the property name too.
*/
class PropertyProxyConnectionNode : public SignalProxyConnectionNode
PropertyProxyConnectionNode::PropertyProxyConnectionNode(const sigc::slot_base& slot, GObject* gobject)
: SignalProxyConnectionNode(slot, gobject)
{
public:
friend class SignalProxyProperty;
}
PropertyProxyConnectionNode(const sigc::slot_base& slot, GObject* gobject, const gchar* property_name);
protected:
//This will be examined in the callback.
//Should be a static string literal.
const gchar* property_name_;
};
PropertyProxyConnectionNode::PropertyProxyConnectionNode(const sigc::slot_base& slot, GObject* gobject, const gchar* property_name)
: SignalProxyConnectionNode(slot, gobject),
property_name_(property_name)
void PropertyProxyConnectionNode::callback(GObject*, GParamSpec* pspec, gpointer data) //static
{
if(pspec && data)
{
if(sigc::slot_base *const slot = SignalProxyBase::data_to_slot(data))
(*static_cast<sigc::slot<void>*>(slot))();
}
}
//SignalProxyProperty implementation:
@ -64,41 +59,23 @@ SignalProxyProperty::~SignalProxyProperty()
sigc::connection SignalProxyProperty::connect(const SlotType& sl)
{
// create a proxy to hold our connection info
PropertyProxyConnectionNode* pConnectionNode = new PropertyProxyConnectionNode(sl, obj_->gobj(), property_name_ );
// Create a proxy to hold our connection info
// This will be deleted by destroy_notify_handler.
PropertyProxyConnectionNode* pConnectionNode = new PropertyProxyConnectionNode(sl, obj_->gobj());
// connect it to gtk+
// pConnectionNode will be passed as the data argument to the callback.
// The callback will then call the virtual Object::property_change_notify() method,
// which will contain a switch/case statement which will examine the property name.
const Glib::ustring notify_signal_name = "notify::" + Glib::ustring(property_name_);
pConnectionNode->connection_id_ = g_signal_connect_data(obj_->gobj(),
"notify", (GCallback)(&callback), pConnectionNode,
notify_signal_name.c_str(), (GCallback)(&PropertyProxyConnectionNode::callback), pConnectionNode,
&PropertyProxyConnectionNode::destroy_notify_handler,
G_CONNECT_AFTER);
return sigc::connection(pConnectionNode->slot_);
}
void SignalProxyProperty::callback(GObject*, GParamSpec* pspec, gpointer data) //static
{
if(pspec && data)
{
//Get the name of the property that has changed:
const char* property_name_changed = pspec->name;
//Get the name of the property that we are waiting for:
PropertyProxyConnectionNode* conn = static_cast<PropertyProxyConnectionNode*>(data);
const char* property_name_monitored = conn->property_name_;
//If it's the correct property, then call the signal handler:
if(strcmp(property_name_changed, property_name_monitored) == 0)
{
if(sigc::slot_base *const slot = data_to_slot(data))
(*static_cast<sigc::slot<void>*>(slot))();
}
}
}
//PropertyProxy_Base implementation:
@ -149,3 +126,4 @@ void PropertyProxy_Base::reset_property_()
} // namespace Glib
#endif //GLIBMM_PROPERTIES_ENABLED

View File

@ -22,13 +22,16 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmmconfig.h>
#include <glibmm/value.h>
#include <glibmm/signalproxy.h>
namespace Glib
{
#ifdef GLIBMM_PROPERTIES_ENABLED
class ObjectBase;
/// Use the connect() method, with sigc::ptr_fun() or sig::mem_fun() to connect signals to signal handlers.
@ -44,7 +47,6 @@ public:
sigc::connection connect(const SlotType& sl);
protected:
static void callback(GObject* object, GParamSpec* pspec, gpointer data);
const char* property_name_; //Should be a static string literal.
@ -71,6 +73,7 @@ protected:
void reset_property_();
ObjectBase* obj_; //The C++ wrapper instance of which this PropertyProxy is a member.
const char* property_name_; //Should be a static string literal.
private:
@ -78,7 +81,31 @@ private:
PropertyProxy_Base& operator=(const PropertyProxy_Base&);
};
#endif //GLIBMM_PROPERTIES_ENABLED
#ifndef DOXYGEN_SHOULD_SKIP_THIS
class SignalProxyProperty;
/** PropertyProxyConnectionNode is a connection node for use with SignalProxyProperty.
* It's like ProxyConnectionNode, but it contains the property name too.
* This is not public API.
*/
class PropertyProxyConnectionNode : public SignalProxyConnectionNode
{
public:
friend class SignalProxyProperty;
PropertyProxyConnectionNode(const sigc::slot_base& slot, GObject* gobject);
static void callback(GObject* object, GParamSpec* pspec, gpointer data);
};
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
} // namespace Glib
#endif /* _GLIBMM_PROPERTYPROXY_BASE_H */

View File

@ -140,6 +140,16 @@ public:
template <class T_CastFrom>
static inline RefPtr<T_CppObject> cast_static(const RefPtr<T_CastFrom>& src);
/** Cast to non-const.
*
* The RefPtr can't be cast with the usual notation so instead you can use
* @code
* ptr_unconst = RefPtr<UnConstType>::cast_const(ptr_const);
* @endcode
*/
template <class T_CastFrom>
static inline RefPtr<T_CppObject> cast_const(const RefPtr<T_CastFrom>& src);
private:
T_CppObject* pCppObject_;
};
@ -302,6 +312,19 @@ RefPtr<T_CppObject> RefPtr<T_CppObject>::cast_static(const RefPtr<T_CastFrom>& s
return RefPtr<T_CppObject>(pCppObject);
}
template <class T_CppObject>
template <class T_CastFrom>
inline
RefPtr<T_CppObject> RefPtr<T_CppObject>::cast_const(const RefPtr<T_CastFrom>& src)
{
T_CppObject *const pCppObject = const_cast<T_CppObject*>(src.operator->());
if(pCppObject)
pCppObject->reference();
return RefPtr<T_CppObject>(pCppObject);
}
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
/** @relates Glib::RefPtr */

View File

@ -1,5 +1,6 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#include <glibmm/shell.h>
#include <glibmm/private/shell_p.h>
@ -85,9 +86,17 @@ Glib::ShellError::Code Glib::ShellError::code() const
return static_cast<Code>(Glib::Error::code());
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void Glib::ShellError::throw_func(GError* gobject)
{
throw Glib::ShellError(gobject);
}
#else
//When not using exceptions, we just pass the Exception object around without throwing it:
std::auto_ptr<Glib::Error> Glib::ShellError::throw_func(GError* gobject)
{
return std::auto_ptr<Glib::Error>(new Glib::ShellError(gobject));
}
#endif //GLIBMM_EXCEPTIONS_ENABLED

View File

@ -60,7 +60,14 @@ public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
#ifdef GLIBMM_EXCEPTIONS_ENABLED
static void throw_func(GError* gobject);
#else
//When not using exceptions, we just pass the Exception object around without throwing it:
static std::auto_ptr<Glib::Error> throw_func(GError* gobject);
#endif //GLIBMM_EXCEPTIONS_ENABLED
friend void wrap_init(); // uses throw_func()
#endif
};

View File

@ -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
}
}

View File

@ -1,5 +1,6 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#include <glibmm/spawn.h>
#include <glibmm/private/spawn_p.h>
@ -38,19 +39,23 @@ extern "C"
* We don't need to worry about (un)referencing, since the
* child process gets its own copy of the parent's memory anyway.
*/
void child_setup_callback(void* user_data)
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
}
void copy_output_buf(std::string* dest, const char* buf)
static void copy_output_buf(std::string* dest, const char* buf)
{
if(dest)
{
@ -303,9 +308,17 @@ Glib::SpawnError::Code Glib::SpawnError::code() const
return static_cast<Code>(Glib::Error::code());
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void Glib::SpawnError::throw_func(GError* gobject)
{
throw Glib::SpawnError(gobject);
}
#else
//When not using exceptions, we just pass the Exception object around without throwing it:
std::auto_ptr<Glib::Error> Glib::SpawnError::throw_func(GError* gobject)
{
return std::auto_ptr<Glib::Error>(new Glib::SpawnError(gobject));
}
#endif //GLIBMM_EXCEPTIONS_ENABLED

View File

@ -130,7 +130,14 @@ public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
#ifdef GLIBMM_EXCEPTIONS_ENABLED
static void throw_func(GError* gobject);
#else
//When not using exceptions, we just pass the Exception object around without throwing it:
static std::auto_ptr<Glib::Error> throw_func(GError* gobject);
#endif //GLIBMM_EXCEPTIONS_ENABLED
friend void wrap_init(); // uses throw_func()
#endif
};

View File

@ -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;
}

View File

@ -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)

View File

@ -1,5 +1,6 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#include <glibmm/thread.h>
#include <glibmm/private/thread_p.h>
@ -37,10 +38,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&)
{
@ -51,6 +55,7 @@ static void* call_thread_entry_slot(void* data)
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
delete slot;
return 0;
@ -391,9 +396,17 @@ Glib::ThreadError::Code Glib::ThreadError::code() const
return static_cast<Code>(Glib::Error::code());
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void Glib::ThreadError::throw_func(GError* gobject)
{
throw Glib::ThreadError(gobject);
}
#else
//When not using exceptions, we just pass the Exception object around without throwing it:
std::auto_ptr<Glib::Error> Glib::ThreadError::throw_func(GError* gobject)
{
return std::auto_ptr<Glib::Error>(new Glib::ThreadError(gobject));
}
#endif //GLIBMM_EXCEPTIONS_ENABLED

View File

@ -178,7 +178,14 @@ public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
#ifdef GLIBMM_EXCEPTIONS_ENABLED
static void throw_func(GError* gobject);
#else
//When not using exceptions, we just pass the Exception object around without throwing it:
static std::auto_ptr<Glib::Error> throw_func(GError* gobject);
#endif //GLIBMM_EXCEPTIONS_ENABLED
friend void wrap_init(); // uses throw_func()
#endif
};

View File

@ -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

View File

@ -1,5 +1,6 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#include <glibmm/unicode.h>
#include <glibmm/private/unicode_p.h>

View File

@ -193,7 +193,7 @@ inline AsciiType& operator^=(AsciiType& lhs, AsciiType rhs)
enum NormalizeMode
{
NORMALIZE_DEFAULT,
NORMALIZE_NFD,
NORMALIZE_NFD = NORMALIZE_DEFAULT,
NORMALIZE_DEFAULT_COMPOSE,
NORMALIZE_NFC = NORMALIZE_DEFAULT_COMPOSE,
NORMALIZE_ALL,

View File

@ -140,7 +140,7 @@ ustring::size_type utf8_char_offset(const std::string& str, ustring::size_type o
// Helper to implement ustring::find_first_of() and find_first_not_of().
// Returns the UTF-8 character offset, or ustring::npos if not found.
//
ustring::size_type utf8_find_first_of(const std::string& str, ustring::size_type offset,
static ustring::size_type utf8_find_first_of(const std::string& str, ustring::size_type offset,
const char* utf8_match, long utf8_match_size,
bool find_not_of)
{
@ -176,7 +176,7 @@ ustring::size_type utf8_find_first_of(const std::string& str, ustring::size_type
// Helper to implement ustring::find_last_of() and find_last_not_of().
// Returns the UTF-8 character offset, or ustring::npos if not found.
//
ustring::size_type utf8_find_last_of(const std::string& str, ustring::size_type offset,
static ustring::size_type utf8_find_last_of(const std::string& str, ustring::size_type offset,
const char* utf8_match, long utf8_match_size,
bool find_not_of)
{
@ -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;
}

View File

@ -233,11 +233,11 @@ public:
#endif /* GLIBMM_HAVE_SUN_REVERSE_ITERATOR */
#ifdef GLIBMM_HAVE_ALLOWS_STATIC_INLINE_NPOS
static const size_type npos = std::string::npos;
static GLIBMM_API const size_type npos = std::string::npos;
#else
//The IRIX MipsPro compiler says "The indicated constant value is not known",
//so we need to initalize the static member data elsewhere.
static const size_type npos;
static GLIBMM_API const size_type npos;
#endif
/*! Default constructor, which creates an empty string.
@ -269,13 +269,13 @@ public:
/*! Construct a ustring as a copy of a substring.
* @param src %Source ustring.
* @param i Index of first character to copy from.
* @param n Number of characters to copy (defaults to copying the remainder).
* @param n Number of UTF-8 characters to copy (defaults to copying the remainder).
*/
ustring(const ustring& src, size_type i, size_type n=npos);
/*! Construct a ustring as a partial copy of a C string.
* @param src %Source C string encoded as UTF-8.
* @param n Number of characters to copy.
* @param n Number of UTF-8 characters to copy.
*/
ustring(const char* src, size_type n);
@ -570,7 +570,7 @@ public:
//! @{
/*! Returns a new UTF-8 string with all characters characters converted to
* their lowercase equivalent, while honoring the current locale. The
* their uppercase equivalent, while honoring the current locale. The
* resulting string may change in the number of bytes as well as in the
* number of characters. For instance, the German sharp&nbsp;s
* <tt>&quot;&szlig;&quot;</tt> will be replaced by two characters

View File

@ -39,6 +39,14 @@ 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);

View File

@ -69,9 +69,21 @@ 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();

View File

@ -275,7 +275,7 @@ GParamSpec* Value<float>::create_param_spec(const Glib::ustring& name) const
{
return g_param_spec_float(
name.c_str(), 0, 0,
G_MINFLOAT, G_MAXFLOAT, g_value_get_float(&gobject_),
-G_MAXFLOAT, G_MAXFLOAT, g_value_get_float(&gobject_),
GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE));
}
@ -302,7 +302,7 @@ GParamSpec* Value<double>::create_param_spec(const Glib::ustring& name) const
{
return g_param_spec_double(
name.c_str(), 0, 0,
G_MINDOUBLE, G_MAXDOUBLE, g_value_get_double(&gobject_),
-G_MAXDOUBLE, G_MAXDOUBLE, g_value_get_double(&gobject_),
GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE));
}

View File

@ -26,7 +26,7 @@
namespace
{
void warn_already_registered(const char* location, const std::string& full_name)
static void warn_already_registered(const char* location, const std::string& full_name)
{
g_warning("file %s: (%s): The type name `%s' has been registered already.\n"
"This is not supposed to happen -- please send a mail with detailed "

View File

@ -17,6 +17,7 @@
#define GLIBMM_CONFIGURE
#elif defined(__MINGW32__)
#define GLIBMM_WIN32
#define GLIBMM_DLL
#define GLIBMM_CONFIGURE
#else
//AIX clR compiler complains about this even though it doesn't get this far:
@ -27,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
@ -45,6 +43,10 @@
#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
#undef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
#endif
#ifdef GLIBMM_MSC
@ -57,7 +59,10 @@
#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_HAVE_ALLOWS_STATIC_INLINE_NPOS 1
#define GLIBMM_PROPERTIES_ENABLED 1
#define GLIBMM_VFUNCS_ENABLED 1
#define GLIBMM_EXCEPTIONS_ENABLED 1
#define GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED 1
#pragma warning (disable: 4786 4355 4800 4181)
#endif

View File

@ -1,5 +0,0 @@
config.guess
config.sub
install-sh
ltmain.sh
missing

View File

@ -29,7 +29,7 @@ AC_DEFUN([AL_PROG_GNU_MAKE],[
dnl
dnl Check for GNU make (stolen from gtk+/configure.in)
AC_MSG_CHECKING(whether make is GNU Make)
if $ac_make --version 2>/dev/null | grep '^GNU Make ' >/dev/null ; then
if ${MAKE-make} --version 2>/dev/null | grep '^GNU Make ' >/dev/null ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)

View File

@ -0,0 +1,106 @@
## GLIBMM_ARG_ENABLE_API_PROPERTIES()
##
## Provide the --enable-api-properties configure argument, enabled
## by default.
##
AC_DEFUN([GLIBMM_ARG_ENABLE_API_PROPERTIES],
[
AC_ARG_ENABLE([api-properties],
[ --enable-api-properties Build properties API.
[[default=yes]]],
[glibmm_enable_api_properties="$enableval"],
[glibmm_enable_api_properties='yes'])
if test "x$glibmm_enable_api_properties" = "xyes"; then
{
AC_DEFINE([GLIBMM_PROPERTIES_ENABLED],[1], [Defined when the --enable-api-properties configure argument was given])
}
fi
])
## GLIBMM_ARG_ENABLE_API_VFUNCS()
##
## Provide the --enable-api-vfuncs configure argument, enabled
## by default.
##
AC_DEFUN([GLIBMM_ARG_ENABLE_API_VFUNCS],
[
AC_ARG_ENABLE([api-vfuncs],
[ --enable-api-vfuncs Build vfuncs API.
[[default=yes]]],
[glibmm_enable_api_vfuncs="$enableval"],
[glibmm_enable_api_vfuncs='yes'])
if test "x$glibmm_enable_api_vfuncs" = "xyes"; then
{
AC_DEFINE([GLIBMM_VFUNCS_ENABLED],[1], [Defined when the --enable-api-vfuncs configure argument was given])
}
fi
])
## GLIBMM_ARG_ENABLE_API_EXCEPTIONS()
##
## Provide the --enable-api-exceptions configure argument, enabled
## by default.
##
AC_DEFUN([GLIBMM_ARG_ENABLE_API_EXCEPTIONS],
[
AC_ARG_ENABLE([api-exceptions],
[ --enable-api-exceptions Build exceptions API.
[[default=yes]]],
[glibmm_enable_api_exceptions="$enableval"],
[glibmm_enable_api_exceptions='yes'])
if test "x$glibmm_enable_api_exceptions" = "xyes"; then
{
AC_DEFINE([GLIBMM_EXCEPTIONS_ENABLED],[1], [Defined when the --enable-api-exceptions configure argument was given])
}
fi
])
## GLIBMM_ARG_ENABLE_API_DEPRECATED()
##
## Provide the --enable-deprecated-api configure argument, enabled
## by default.
##
AC_DEFUN([GLIBMM_ARG_ENABLE_API_DEPRECATED],
[
AC_ARG_ENABLE(deprecated-api,
[ --enable-deprecated-api Include (build) deprecated API in the libraries.
[[default=yes]]],
[glibmm_enable_api_deprecated="$enableval"],
[glibmm_enable_api_deprecated='yes'])
if test "x$glibmm_enable_api_deprecated" = "xyes"; then
{
AC_MSG_WARN([Deprecated API will be built, for backwards-compatibility.])
}
else
{
AC_MSG_WARN([Deprecated API will not be built, breaking backwards-compatibility. Do not use this build for distribution packages.])
DISABLE_DEPRECATED_API_CFLAGS="-DGLIBMM_DISABLE_DEPRECATED"
AC_SUBST(DISABLE_DEPRECATED_API_CFLAGS)
}
fi
])
## GLIBMM_ARG_ENABLE_API_DEFAULT_SIGNAL_HANDLERS()
##
## Provide the --enable-api-default-signal-handlers configure argument, enabled
## by default.
##
AC_DEFUN([GLIBMM_ARG_ENABLE_API_DEFAULT_SIGNAL_HANDLERS],
[
AC_ARG_ENABLE([api-default-signal-handlers],
[ --enable-api-default-signal-handlers Build default signal handlers API.
[[default=yes]]],
[glibmm_enable_api_default_signal_handlers="$enableval"],
[glibmm_enable_api_default_signal_handlers='yes'])
if test "x$glibmm_enable_api_default_signal_handlers" = "xyes"; then
{
AC_DEFINE([GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED],[1], [Defined when the --enable-api-default-signal-handlers configure argument was given])
}
fi
])

View File

@ -0,0 +1,15 @@
AC_DEFUN([GLIBMM_PROG_CXX_SUN],
[AC_CACHE_CHECK(whether we are using SUN CC compiler, ac_cv_prog_sun_cxx,
[if AC_TRY_COMMAND(${CXX-g++} -V 2>&1) | egrep "Sun WorkShop" >/dev/null 2>&1; then
ac_cv_prog_sun_cxx=yes
else
ac_cv_prog_sun_cxx=no
fi]
)]
if test "x${ac_cv_prog_sun_cxx}" = "xyes"; then
{
AC_DEFINE([GLIBMM_COMPILER_SUN_FORTE],[1], [Defined when the SUN Forte C++ compiler is being used.])
}
fi
)