After this setup, \c varChanged will be called, whenever the value has changed.
- \section console_args Special argument types
+ \section console_args Special types
- By default, argument types which can be read and written using \c iostreams are automatically
+ By default, types which can be read and written using \c iostreams are automatically
supported. Other types need to be registered explicitly
\endhtmlonly
- \subsection console_args_convert Handling special argument types by conversion
+ \subsection console_args_convert Handling argument types by conversion
Sometimes an argument type is best handled by just pretending it to be of some other type. The
basic idea is, to us \c boost::function to convert the real argument type to some different type
process. Since the console library now sees the argument and return value of type \c unsigned,
the values will be parsed correctly as numeric values.
- The same idea can be used to support custom parsing rules. See senf::console::FlagCollection.
+
+ \subsection console_args_special Special Console types
+
+ The %console library defines some special types to be used as arguments and/or return values.
+ Some of these are wrappers around basic types which provide custom formatting. Those are used
+ via argument type conversion (see previous section).
+
+ \see \ref senf_console_utilities
\subsection console_args_custom Extending the library to support additional types
//#include "Utility.mpp"
///////////////////////////////hh.p////////////////////////////////////////
+/** \defgroup senf_console_utilities Special console utility types
+
+ These types are provided by the %console library to support special argument or return value
+ formatting rules.
+ */
+
namespace senf {
namespace console {
+ /** \brief Parse character value as single-char string
+
+ This helper types is a wrapper around \a CharT which must be a character type. A value of
+ this type will be represented as a single character string, not as numeric value (the
+ default interpretation of char arguments in the console library).
+
+ This wrapper is used via type conversion using \c boost::function to convert the
+ argument/return type \a CharT to CharAsString<CharT>:
+ \code
+ char foo(char v) { return v; }
+
+ senf::console::root().add(
+ "foo", boost::function< CharAsString<char> (CharAsString<char>) >(&foo));
+ \endcode
+
+ \tparam CharT character type, one of \c char, \c signed \c char or \c unsigned \c char
+
+ \ingroup senf_console_utilities
+ */
template <class CharT>
struct CharAsString
{
/** \brief Value range
A value range may be represented in the console either by a single value (setting both \a
- low and \a high to the same value) or as a lower and upper bound seperated by a colon
+ low and \a high to the same value) or as a lower and upper bound seperated by a colon.
+
+ \ingroup senf_console_utilities
*/
template <class T>
struct ValueRange
console:/$ func Foo
console:/$ func (Foo Boo)
</pre>
+
+ \ingroup senf_console_utilities
*/
template <class Enum>
struct FlagCollection
--- /dev/null
+#!/bin/sh -e
+
+base="`dirname "$0"`"
+
+text="`echo "$1" | perl -pe 's/[^a-zA-Z0-9]+/ /g;s/^ //;s/ $//'`"
+${base}/find-sources.sh -c \
+ | xargs perl -0777ne '
+ while(m{/\*\*<?(.*?)\*/|///<?(.*?)$}smg) {
+ $t=$1||$2;
+ $t=~s/\\\S+//g;
+ $t=~s/[^a-zA-Z0-9]+/ /g;
+ print $ARGV,"\n" if $t=~m{\Q'"$text"'\E};
+ }'\
+ | sort -u