diff options
author | Martin Schulze <teebaum@cvs.gnome.org> | 2003-11-30 20:04:18 +0000 |
---|---|---|
committer | Martin Schulze <teebaum@src.gnome.org> | 2003-11-30 20:04:18 +0000 |
commit | 0e7a8c6f542757142b482f7adbf31f2617214186 (patch) | |
tree | 1b4a4e557a57a3fe9b1a5b8593c06601db1e2f27 | |
parent | 9b6271108aa886368f8f51394621d134edcf7faf (diff) | |
download | sigc++-0e7a8c6f542757142b482f7adbf31f2617214186.tar.gz |
Bump version number to 1.9.13. Add ChangeLog summary for version 1.9.13.
2003-11-30 Martin Schulze <teebaum@cvs.gnome.org>
* configure.ac: Bump version number to 1.9.13.
* NEWS: Add ChangeLog summary for version 1.9.13.
* Makefile.am, MSVC_Net2003/Makefile.am, configure.ac:
Distribute MS .Net project files.
* sigc++/adaptors/macros/[bind,hide].h.m4: Correct and add
documentation. Make hide_functor ctor explicit.
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | MSVC_Net2003/.cvsignore | 1 | ||||
-rw-r--r-- | MSVC_Net2003/Makefile.am | 20 | ||||
-rw-r--r-- | MSVC_Net2003/tests/test_retype/test_retype.vcproj (renamed from MSVC_Net2003/tests/test_retype/test_reytype.vcproj) | 0 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | sigc++/adaptors/macros/bind.h.m4 | 14 | ||||
-rw-r--r-- | sigc++/adaptors/macros/hide.h.m4 | 142 |
9 files changed, 157 insertions, 42 deletions
@@ -1,3 +1,14 @@ +1.9.13: + +2003-11-30 Martin Schulze <teebaum@cvs.gnome.org> + + * configure.ac: Bump version number to 1.9.13. + * NEWS: Add ChangeLog summary for version 1.9.13. + * Makefile.am, MSVC_Net2003/Makefile.am, configure.ac: + Distribute MS .Net project files. + * sigc++/adaptors/macros/[bind,hide].h.m4: Correct and add + documentation. Make hide_functor ctor explicit. + 2003-11-11 Martin Schulze <teebaum@cvs.gnome.org> * sigc++/adaptors/macros/[bind,hide].h.m4: Change to zero-based diff --git a/MSVC_Net2003/.cvsignore b/MSVC_Net2003/.cvsignore new file mode 100644 index 0000000..6179e0d --- /dev/null +++ b/MSVC_Net2003/.cvsignore @@ -0,0 +1 @@ +Makefile Makefile.in diff --git a/MSVC_Net2003/Makefile.am b/MSVC_Net2003/Makefile.am new file mode 100644 index 0000000..cde94b2 --- /dev/null +++ b/MSVC_Net2003/Makefile.am @@ -0,0 +1,20 @@ +EXTRA_DIST=libsigc++2_msvcNet2003.vcproj libsigc++2_msvcNet2003.sln \ + tests/test_accumulated/test_accumulated.vcproj \ + tests/test_bind/test_bind.vcproj \ + tests/test_bind_return/test_bind_return.vcproj \ + tests/test_compatibility/test_compatibility.vcproj \ + tests/test_compose/test_compose.vcproj \ + tests/test_deduce_result_type/test_deduce_result_type.vcproj \ + tests/test_disconnect/test_disconnect.vcproj \ + tests/test_exception_catch/test_exception_catch.vcproj \ + tests/test_functor_trait/test_functor_trait.vcproj \ + tests/test_hide/test_hide.vcproj \ + tests/test_lambda/test_lambda.vcproj \ + tests/test_mem_fun/test_mem_fun.vcproj \ + tests/test_ptr_fun/test_ptr_fun.vcproj \ + tests/test_retype/test_retype.vcproj \ + tests/test_retype_return/test_retype_return.vcproj \ + tests/test_signal/test_signal.vcproj \ + tests/test_size/test_size.vcproj \ + tests/test_slot/test_slot.vcproj \ + tests/test_trackable/test_trackable.vcproj diff --git a/MSVC_Net2003/tests/test_retype/test_reytype.vcproj b/MSVC_Net2003/tests/test_retype/test_retype.vcproj index 441e12d..441e12d 100644 --- a/MSVC_Net2003/tests/test_retype/test_reytype.vcproj +++ b/MSVC_Net2003/tests/test_retype/test_retype.vcproj diff --git a/Makefile.am b/Makefile.am index ea8a8a6..2a3c9e9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,7 @@ EXTRA_DIST = autogen.sh # ACLOCAL_FLAGS = -I scripts SUBDIRS = sigc++ tests -DIST_SUBDIRS = $(SUBDIRS) examples docs +DIST_SUBDIRS = $(SUBDIRS) examples docs MSVC_Net2003 pkgconfigdir = $(libdir)/pkgconfig @@ -21,9 +21,9 @@ This version of libsigc++ needs GNU g++ 3.2 or higher to compile. * Fixed passing references through sigc::slot (Reported by Jeff Franks). * Enabled binding of objects to method slots through sigc::bind(). -* Reworked sigc::bind() API: Added overloads for binding of up to 7 - arguments from the back (when no template argument is provided). - Made the template argument for the parameter position zero-based. +* Reworked sigc::bind() API: Made the template argument for the + parameter position zero-based and optional. Added overloads for + binding of up to 7 arguments at a time when no position is specified. * Reworked sigc::hide() API: Made the template argument for the parameter position zero-based and optional. * Fixed compilation problems with MSVC .Net 2003 (Roel Vanhout). diff --git a/configure.ac b/configure.ac index 1dbb008..c5b3384 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ dnl This version stuff is just for the packaging section of the tool. dnl thus make format_package-0.0.1.tar.gz FP_MAJOR_VERSION=1 FP_MINOR_VERSION=9 -FP_MICRO_VERSION=12 +FP_MICRO_VERSION=13 FP_VERSION=$FP_MAJOR_VERSION.$FP_MINOR_VERSION.$FP_MICRO_VERSION dnl For automake. @@ -124,6 +124,7 @@ AC_OUTPUT([ sigc++/Makefile tests/Makefile examples/Makefile + MSVC_Net2003/Makefile docs/Makefile docs/images/Makefile diff --git a/sigc++/adaptors/macros/bind.h.m4 b/sigc++/adaptors/macros/bind.h.m4 index 5fa2d69..09e00aa 100644 --- a/sigc++/adaptors/macros/bind.h.m4 +++ b/sigc++/adaptors/macros/bind.h.m4 @@ -205,7 +205,7 @@ namespace sigc { * sigc::bind<2>(&foo,1)(2,3); //fixes the third argument and calls foo(2,3,1) * // multi argument binding ... * sigc::bind(&foo,1,2)(3); //fixes the last two arguments and calls foo(3,1,2) - * sigc::bind(&foo,1,2,3)(); //fixes all three arguments and calls foo(3,1,2) + * sigc::bind(&foo,1,2,3)(); //fixes all three arguments and calls foo(1,2,3) * @endcode * * The functor sigc::bind() returns can be passed into @@ -244,7 +244,7 @@ namespace sigc { * * For a more powerful version of this functionality see the lambda * library adaptor sigc::group() which can bind, hide and reorder - * arguments arbitrarily. Although lambda call is more flexible, + * arguments arbitrarily. Although sigc::group() is more flexible, * sigc::bind() provides a means of binding parameters when then total * number of parameters called is variable. * @@ -255,8 +255,9 @@ namespace sigc { * Use the convenience function bind() to create an instance of bind_functor. * * The following template arguments are used: - * - @e I_location Number of the argument to fix (counting starts from @p 1, @p 0 stands for the last argument). - * - @e T_type Type of the bound argument. + * - @e I_location Zero-based position of the argument to fix (@p -1 for the last argument). +FOR(1, CALL_SIZE,[ + * - @e T_type%1 Type of the %1st bound argument.]) * - @e T_functor Type of the functor to wrap. * * @ingroup bind @@ -282,9 +283,8 @@ void visit_each(const T_action& _A_action, FOR(1,CALL_SIZE,[[BIND_FUNCTOR_COUNT(%1)]])dnl /** Creates an adaptor of type sigc::bind_functor which binds the passed argument to the passed functor. - * The template argument @e I_location is mandatory and specifies the - * number of the argument to be fixed (counting starts from @p 1, - * @p 0 stands for the last argument). + * The optional template argument @e I_location specifies the zero-based + * position of the argument to be fixed (@p -1 stands for the last argument). * * @param _A_func Functor that should be wrapped. * @param _A_b1 Argument to bind to @e _A_func. diff --git a/sigc++/adaptors/macros/hide.h.m4 b/sigc++/adaptors/macros/hide.h.m4 index 9cabbb9..d603885 100644 --- a/sigc++/adaptors/macros/hide.h.m4 +++ b/sigc++/adaptors/macros/hide.h.m4 @@ -30,12 +30,22 @@ ifelse($1,0,[dnl define([HIDE_OPERATOR],[dnl ifelse($2,0,,[dnl ifelse($2,1,[dnl + /** Invokes the wrapped functor ignoring the only argument. + * @param _A_arg%1 Argument to be ignored. + * @return The return value of the functor invocation. + */ template <class T_arg1> typename deduce_result_type<T_arg1>::type operator()(T_arg1 _A_a1) { return functor_(); } ],$1,0,[dnl + /** Invokes the wrapped functor ignoring the last argument.dnl +FOR(1, eval($2-1),[ + * @param _A_arg%1 Argument to be passed on to the functor.]) + * @param _A_arg$2 Argument to be ignored. + * @return The return value of the functor invocation. + */ template <LOOP([class T_arg%1], $2)> typename deduce_result_type<LOOP(T_arg%1, $2)>::type operator()(LOOP(T_arg%1 _A_a%1, $2)) @@ -43,15 +53,28 @@ ifelse($2,1,[dnl (LIST(FOR(1,eval($2-1),[_A_a%1,]))); } ],[dnl + /** Invokes the wrapped functor ignoring the $1[]th argument.dnl +FOR(1, eval($1-1),[ + * @param _A_arg%1 Argument to be passed on to the functor.]) + * @param _A_arg$1 Argument to be ignored.dnl +FOR(eval($1+1), $2,[ + * @param _A_arg%1 Argument to be passed on to the functor.]) + * @return The return value of the functor invocation. + */ template <LOOP([class T_arg%1], $2)> typename deduce_result_type<LOOP(T_arg%1, $2)>::type operator()(LOOP(T_arg%1 _A_a%1, $2)) { return functor_.LIBSIGC_TEMPLATE_PREFIX operator() <LIST(FOR(1,eval($1-1),[_P_(T_arg%1),]),FOR(eval($1+1), $2,[_P_(T_arg%1),]))> - (LIST(FOR(1,eval($1-1),[_A_a%1,]),FOR(eval($1+1), $2,[_A_a%1,]))); } + (LIST(FOR(1,eval($1-1),[_A_a%1,]),FOR(eval($1+1),$2,[_A_a%1,]))); } ])])dnl ]) define([HIDE_FUNCTOR],[dnl +/** Adaptor that adds a dummy parameter to the wrapped functor. + * This template specialization ignores the value of the ifelse($1,-1,[last],[$1[]th]) parameter in operator()(). + * + * @ingroup hide + */ template <class T_functor> struct hide_functor <$1, T_functor> : public adapts<T_functor> { @@ -61,9 +84,11 @@ DEDUCE_RESULT_TYPE(eval($1+1),CALL_SIZE)dnl typedef typename adaptor_type::result_type result_type; FOR(eval($1+1),CALL_SIZE,[[HIDE_OPERATOR(eval($1+1),%1)]])dnl - hide_functor() - {} - hide_functor(const T_functor& _A_func) + + /** Constructs a hide_functor object that adds a dummy parameter to the passed functor. + * @param _A_functor Functor to invoke from operator()(). + */ + explicit hide_functor(const T_functor& _A_func) : adapts<T_functor>(_A_func) {} }; @@ -71,33 +96,79 @@ FOR(eval($1+1),CALL_SIZE,[[HIDE_OPERATOR(eval($1+1),%1)]])dnl ]) divert(0)dnl -/* - functor adaptor: hide<#>(functor) - usage: - This converter takes a functor and hides a parameter in effect - ignoring that value. The argument number is specified - by the non-optional integer template argument. An argument of - 0 hides the last argument automatically. - - void foo (int, int); - hide<0>(&foo)(1,2,3) -> calls foo(1,2); - hide<1>(&foo)(1,2,3) -> calls foo(2,3); - - For a more powerful version of this functionality see the - lamda library "call" adaptor which can bind, reorder and - hide arguments in one statement. - -*/ __FIREWALL__ #include <sigc++/adaptors/adaptor_trait.h> namespace sigc { +/** @defgroup hide hide() + * sigc::hide() alters an arbitrary functor in that it adds a parameter + * whose value is ignored on invocation of the returned functor. + * Thus you can discard one or more of the arguments of a signal. + * + * You may optionally specify the zero-based position of the parameter + * to ignore as a template argument. The default is to ignore the last + * parameter. + * (A value of @p -1 adds a parameter at the end so sigc::hide<-1>() gives the same result as sigc::hide().) + * + * The type of the parameter can optionally be specified if not deduced. + * + * @par Examples: + * @code + * void foo(int, int); + * // single argument hiding ... + * sigc::hide(&foo)(1,2,3); // adds a dummy parameter at the back and calls foo(1,2) + * sigc::hide<-1>(&foo)(1,2,3); // same as sigc::hide(&foo)(1,2,3) (calls foo(1,2)) + * sigc::hide<0>(&foo)(1,2,3); // adds a dummy parameter at the beginning and calls foo(2,3) + * sigc::hide<1>(&foo)(1,2,3); // adds a dummy parameter in the middle and calls foo(1,3) + * sigc::hide<2>(&foo)(1,2,3); // adds a dummy parameter at the back and calls foo(1,2) + * // multiple argument hiding ... + * sigc::hide(sigc::hide(&foo))(1,2,3,4); // adds two dummy parameters at the back and calls foo(1,2) + * @endcode + * + * The functor sigc::hide() returns can be passed into + * sigc::signal::connect() directly. + * + * @par Example: + * @code + * sigc::signal<void,int> some_signal; + * void foo(); + * some_signal.connect(sigc::hide(&foo)); + * @endcode + * + * sigc::hide_return() alters an arbitrary functor by + * dropping its return value, thus converting it to a void functor. + * + * For a more powerful version of this functionality see the lambda + * library adaptor sigc::group() which can bind, hide and reorder + * arguments arbitrarily. Although sigc::group() is more flexible, + * sigc::hide() provides a means of hiding parameters when then total + * number of parameters called is variable. + * + * @ingroup adaptors + */ + +/** Adaptor that adds a dummy parameter to the wrapped functor. + * Use the convenience function sigc::hide() to create an instance of hide_functor. + * + * The following template arguments are used: + * - @e I_location Zero-based position of the dummy parameter (@p -1 for the last parameter). + * - @e T_type Type of the dummy parameter. + * - @e T_functor Type of the functor to wrap. + * + * @ingroup hide + */ template <int I_location, class T_functor> struct hide_functor; FOR(-1,eval(CALL_SIZE-1),[[HIDE_FUNCTOR(%1)]])dnl +/** Performs a functor on each of the targets of a functor. + * The function overload for sigc::hide_functor performs a functor on the + * functor and on the object instances stored in the sigc::hide_functor object. + * + * @ingroup hide + */ template <class T_action, int I_location, class T_functor> void visit_each(const T_action& _A_action, const hide_functor<I_location, T_functor>& _A_target) @@ -106,20 +177,31 @@ void visit_each(const T_action& _A_action, } +/** Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed functor. + * The optional template argument @e I_location specifies the zero-based + * position of the dummy parameter in the returned functor (@p -1 stands for the last parameter). + * + * @param _A_func Functor that should be wrapped. + * @return Adaptor that executes _A_func ignoring the value of the dummy parameter. + * + * @ingroup hide + */ template <int I_location, class T_functor> inline hide_functor<I_location, T_functor> hide(const T_functor& _A_func) -{ - return hide_functor<I_location, T_functor> - (_A_func); -} - + { return hide_functor<I_location, T_functor>(_A_func); } + +/** Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed functor. + * This overload adds a dummy parameter at the back of the functor's parameter list. + * + * @param _A_func Functor that should be wrapped. + * @return Adaptor that executes _A_func ignoring the value of the last parameter. + * + * @ingroup hide + */ template <class T_functor> inline hide_functor<-1, T_functor> hide(const T_functor& _A_func) -{ - return hide_functor<-1, T_functor> - (_A_func); -} + { return hide_functor<-1, T_functor> (_A_func); } } /* namespace sigc */ |