Classes |
struct | chain< ArgStreamFirst, ArgStreamSecond > |
| chain 2 arg_streams together by calling the first stream until depleted, then calling the second. More...
|
struct | dictionary_arg_stream< Dictionary, InputRange, NoThrow > |
| dictionary_arg_stream implements the arg_stream interface More...
|
struct | no_more_args |
struct | result_type< F > |
| result_type<F>::type is the return type of the function f. More...
|
struct | signature< F > |
| returns the function signature of the callable object type F More...
|
struct | traits< T > |
| defines any traits that help with the implementation of arg_stream::call() and/or helper objects like arg_stream::chain. More...
|
Functions |
template<typename F , typename ArgStream > |
result_type< F >::type | call (F f, ArgStream &astream) |
template<class T , typename F , typename ArgStream > |
result_type< F >::type | call (T *that, F f, ArgStream &astream) |
template<typename F , typename Dictionary , typename SingleArg > |
arg_stream::result_type< F >::type | call_with_dictionary (F f, Dictionary const &dict, SingleArg const &key_or_key_range) |
template<typename ArgStream > |
bool | eof (ArgStream const &as) |
template<typename R > |
R | get_dictionary_entry (adobe::dictionary_t const &dict, adobe::name_t const &key) |
template<typename R , typename ArgStream > |
R | get_next_arg (ArgStream const &as) |
Detailed Description
arg_stream
is a namespace wrapping together the concept of a stream from which you can retrieve items (ie function arguments) of various types.
An arg_stream is any object which implements a templatized member function
and (optionally) implements
arg_stream implementors can communicate that they have an eof function by specializing arg_stream::traits<T>::has_eof_memberfunction
.
namespace adobe { namespace arg_stream {
template <typename>
struct traits<my_arg_stream_goes_here>
{
static const bool has_eof_memberfunction = true;
};
} }
Alternatively, you may rely on the default implementation of traits<T>, which uses compile time type inspection to determine if T has an eof function.
The point of arg_stream is the arg_stream::call()
function:
template<typename F, typename ArgStream>
result_type<F>::type arg_stream::call(F f, ArgStream argstream);
Function Documentation
result_type<F>::type adobe::arg_stream::call |
( |
F |
f, |
|
|
ArgStream & |
astream |
|
) |
| |
Calls function/callable-object f with function arguments supplied by the arg_stream.
- This is the point of arg_stream. To call a function with typed-args pulled out of some abstracted object.
Definition at line 306 of file arg_stream.hpp.
result_type<F>::type adobe::arg_stream::call |
( |
T * |
that, |
|
|
F |
f, |
|
|
ArgStream & |
astream |
|
) |
| |
specialization of arg_stream::call for handling member function calls.
Definition at line 318 of file arg_stream.hpp.
arg_stream::result_type<F>::type adobe::call_with_dictionary |
( |
F |
f, |
|
|
Dictionary const & |
dict, |
|
|
SingleArg const & |
key_or_key_range |
|
) |
| |
call the function/callable-object f
with args pulled from dictionary dict
via keys from key_range
Definition at line 305 of file dictionary_arg_stream.hpp.
bool adobe::arg_stream::eof |
( |
ArgStream const & |
as ) |
|
arg_stream::eof(argstream)
returns true if there are no more args available.
- This function is available for specialization by arg_streams. If not specialized, the default implementation attempts to call the arg_stream's member function eof() if one is available. If there is no member function, it returns false - ie if it is not known, then it is assumed that more args exist, and thus we must still always consider that the arg_stream::no_more_args exception may be thrown.
Definition at line 168 of file arg_stream.hpp.
dictionary_arg_stream requires specializations of get_dictionary_entry for the dictionary. For example, the adobe::dictionary_t specializations.
- we use 'get_dictionary_entry' instead of the standard adobe::get_value because
- Seems a bit too specific of an interface to ask someone to implement
Definition at line 53 of file dictionary_arg_stream.hpp.
R adobe::arg_stream::get_next_arg |
( |
ArgStream const & |
as ) |
|
arg_stream::get_next_arg<T>(argstream)
returns the next arg as a T
- This function is what defines something as an arg_stream. An arg_stream must either: 1. implement a templatized member function get_next_arg<T>() or 2. specialize arg_stream::get_next_arg<T>(YourArgStream & argstream) ie If not specialized, this default implementation attempts to call the arg_stream's member function get_next_arg<T>(). If there is no member function, and the global function is not specialized, it will not compile.
Definition at line 186 of file arg_stream.hpp.