Pattern made by a value::Vector whose entries are keys followed by a value::Vector or value::Matrix. More...
#include <keyvalue/pattern/KeysInVector.h>
Public Member Functions | |
bool | parse (frontend::Queue &queue) |
Parses the beginning of a frontend::Queue. | |
std::pair< string, value::Value > | pop () |
Gets and removes the next stored key-value pair. | |
bool | isEmpty () const |
Checks if the list of recognized key-value pairs is empty. | |
Private Attributes | |
size_t | next_ |
vector< std::pair< string, value::Value > > | data_ |
Pattern made by a value::Vector whose entries are keys followed by a value::Vector or value::Matrix.
The pattern is defined by a value::Vector K, where all entries are keys, followed by a value::Value object V which is either a value::Vector or value::Matrix such that
In the first case the n-th row of V (which is either a value::Single or a row value::Vector) is considered the value associated to the n-th key in K.
Similarly, in the second case the n-th column of V is the value associated to the n-th key in K.
bool parse | ( | frontend::Queue & | queue | ) | [virtual] |
Parses the beginning of a frontend::Queue.
When a pattern is recognized, the value::Value objects which make it are removed from frontend::Queue and all corresponding key-value pairs are stored inside the this class
for later queries.
queue | : frontend::Queue to be parsed. |
true
. Otherwise, it returns false
. Implements Pattern.
std::pair<string, value::Value> pop | ( | ) | [virtual] |
Gets and removes the next stored key-value pair.
The debug version checks if there is any key-value pair be popped (by calling isEmpty()) and throw an exception when the check fails. Release version has undefined behavior when the list is empty.
LogicError | : (Debug build only) When the list is empty. |
Implements Pattern.
bool isEmpty | ( | ) | const [virtual] |
Checks if the list of recognized key-value pairs is empty.
true
. Otherwise, it returns false
. Implements Pattern.