Adobe Source Libraries 1.49.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
arg_stream

Classes

struct  no_more_args
struct  traits< T >
 defines any traits that help with the implementation of arg_stream::call() and/or helper objects like arg_stream::chain. More...
struct  signature< F >
 returns the function signature of the callable object type F More...
struct  result_type< F >
 result_type<F>::type is the return type of the function f. More...
struct  chain< ArgStreamFirst, ArgStreamSecond >
 chain 2 arg_streams together by calling the first stream until depleted, then calling the second. More...

Functions

template<typename ArgStream>
bool eof (ArgStream const &as)
 arg_stream::eof(argstream) returns true if there are no more args available.
template<typename R, typename ArgStream>
get_next_arg (ArgStream const &as)
 arg_stream::get_next_arg<T>(argstream) returns the next arg as a T
template<typename F, typename ArgStream>
result_type< F >::type call (F f, ArgStream &astream)
 Calls function/callable-object f with function arguments supplied by the arg_stream.
template<class T, typename F, typename ArgStream>
result_type< F >::type call (T *that, F f, ArgStream &astream)
 specialization of arg_stream::call for handling member function calls.

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

template <typename R> R get_next_arg();

and (optionally) implements

bool eof();

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);
result_type< F >::type call(F f, ArgStream &astream)
Calls function/callable-object f with function arguments supplied by the arg_stream.

Function Documentation

◆ eof()

template<typename ArgStream>
bool eof ( ArgStream const & as)
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 148 of file arg_stream.hpp.

◆ get_next_arg()

template<typename R, typename ArgStream>
R get_next_arg ( ArgStream const & as)
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 167 of file arg_stream.hpp.

◆ call() [1/2]

template<typename F, typename ArgStream>
result_type< F >::type call ( F f,
ArgStream & astream )
This is the point of arg_stream. To call a function with typed-args pulled out of some
abstracted object.

Definition at line 269 of file arg_stream.hpp.

◆ call() [2/2]

template<class T, typename F, typename ArgStream>
result_type< F >::type call ( T * that,
F f,
ArgStream & astream )

Definition at line 279 of file arg_stream.hpp.