arg_router
1.4.0
C++ command line argument parsing and routing
|
#include <arg_router/parsing/dynamic_token_adapter.hpp>
Classes | |
class | iterator |
Public Types | |
using | value_type = token_type |
using | size_type = std::size_t |
Public Member Functions | |
dynamic_token_adapter (vector< token_type > &processed, vector< token_type > &unprocessed) | |
bool | operator== (dynamic_token_adapter other) const |
bool | operator!= (dynamic_token_adapter other) const |
iterator | begin () |
iterator | end () |
size_type | size () const |
bool | empty () const |
vector< value_type > & | processed () |
vector< value_type > & | unprocessed () |
iterator | insert (iterator it, value_type value) |
template<typename Iter > | |
iterator | insert (iterator it, Iter first, Iter last) |
iterator | erase (iterator it) |
void | transfer (iterator it) |
An adaptor over the processed and unprocessed tokens. This is used during the pre-parse phase.
If an iterator element is read from that is beyond the end of the processed token container, then one is returned from the equivalent position in the unprocessed token container (as if the two containers were concatenated). Using iterator::set(value_type) will update the element pointed at by the iterator, if the iterator is passed the end of the processed tokens container then elements from the unprocessed container are transferred into it verbatim.
This allows the pre-parse phase implementing policies to not concern themselves with managing the processed/unprocessed containers.
Definition at line 22 of file dynamic_token_adapter.hpp.
using arg_router::parsing::dynamic_token_adapter::size_type = std::size_t |
Size type.
Definition at line 28 of file dynamic_token_adapter.hpp.
Value type.
Definition at line 26 of file dynamic_token_adapter.hpp.
|
inline |
Constructor.
processed | Processed tokens container |
unprocessed | Unprocessed tokens container |
Definition at line 311 of file dynamic_token_adapter.hpp.
|
inline |
Returns an iterator to the beginning of the processed container.
If the processed container is empty, this will initialise it by moving an entry from the front of the raw command line token container into it, using prefix_type::none.
Definition at line 347 of file dynamic_token_adapter.hpp.
|
inline |
Definition at line 364 of file dynamic_token_adapter.hpp.
|
inline |
Returns a one-past-the-end iterator.
Definition at line 354 of file dynamic_token_adapter.hpp.
Erases the element at it.
Does not perform any transfer between the process and unprocessed sides.
it | Element to remove. If one-past-the-end iterator, this method is a no-op |
Definition at line 423 of file dynamic_token_adapter.hpp.
|
inline |
Inserts the value in the range [ first, last ) at position it.
it | Position to start inserting at |
first | Iterator to first instance in range to insert |
last | One-past-the-end iterator of range to insert |
Definition at line 405 of file dynamic_token_adapter.hpp.
|
inline |
Inserts token at position it.
it | Position to insert at |
value | Value to insert |
Definition at line 385 of file dynamic_token_adapter.hpp.
|
inline |
Inequality operator.
other | Instance to compare against |
Definition at line 339 of file dynamic_token_adapter.hpp.
|
inline |
Equality operator.
other | Instance to compare against |
Definition at line 327 of file dynamic_token_adapter.hpp.
|
inline |
The underlying processed container.
Definition at line 370 of file dynamic_token_adapter.hpp.
|
inline |
Returns the count of all tokens, processed and unprocessed.
Definition at line 360 of file dynamic_token_adapter.hpp.
|
inline |
Transfer elements from the raw command line token container to processed one up to and including the one represented by it.
If it is before or within the processed container, then this is a no-op.
it | Iterator, and the preceding elements too, to transfer |
Definition at line 447 of file dynamic_token_adapter.hpp.
|
inline |
The underlying unprocessed container.
Definition at line 376 of file dynamic_token_adapter.hpp.