Protocol class
which defines the interface for pattern recognition class
es.
More...
#include <keyvalue/pattern/Pattern.h>
Classes | |
class | QueueRaii |
This class implements RAII for a frontend::Queue. More... | |
Public Member Functions | |
virtual bool | parse (frontend::Queue &queue)=0 |
Parses the beginning of a frontend::Queue. | |
virtual std::pair< string, value::Value > | pop ()=0 |
Gets and removes the next stored key-value pair. | |
virtual bool | isEmpty () const =0 |
Checks if the list of recognized key-value pairs is empty. |
Protocol class
which defines the interface for pattern recognition class
es.
Each derived class
is able to parse the beginning of a queue in an attempt to recognize a specific pattern of key-value pairs.
When a pattern is recognized (by parse()), the corresponding key-value pairs are stored in a list to be extracted later (by pop()).
virtual bool parse | ( | frontend::Queue & | queue | ) | [pure 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
. Implemented in KeyInSingle, KeysInMatrix, KeysInVector, and Table.
virtual std::pair<string, value::Value> pop | ( | ) | [pure 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. |
Implemented in KeyInSingle, KeysInMatrix, KeysInVector, and Table.
virtual bool isEmpty | ( | ) | const [pure virtual] |
Checks if the list of recognized key-value pairs is empty.
true
. Otherwise, it returns false
. Implemented in KeyInSingle, KeysInMatrix, KeysInVector, and Table.