clang-tags
C/C++ source code indexing tool based on libclang
|
Scalar key parser. More...
#include <request.hxx>
Public Member Functions | |
Key (std::string name, T &destination) | |
Constructor. | |
virtual void | parse (std::istream &cin) |
Parse an input stream and handle the key value. | |
virtual void | set (const Json::Value &json) |
Retrieve the key value from a JSON value and handle it. | |
Public Member Functions inherited from Request::KeyParserBase | |
KeyParserBase (std::string name) | |
Constructor. | |
const std::string & | name () const |
Get the key name. | |
void | display (std::ostream &cout) const |
Display help about the key. | |
KeyParserBase * | metavar (std::string metavar) |
Set the meta variable name for the key. | |
KeyParserBase * | description (std::string description) |
Set the description string for the key. | |
KeyParserBase * | required (bool req=true) |
Sets whether the key is optional or required. | |
virtual bool | isVector () const |
Tell whether the key takes more than one value. |
Additional Inherited Members | |
Protected Attributes inherited from Request::KeyParserBase | |
std::string | default_ |
Description of the default key value. |
Scalar key parser.
Parses a key and stores a single value in a destination variable.
T | type of associated value |
|
inline |
Constructor.
name | key name |
destination | reference to a variable where the key value will be stored |
|
inlinevirtual |
Parse an input stream and handle the key value.
Parse the key value in an input text stream and store it. This method is used for plain-text requests. Values associated to vector keys are appended to the list of previously read values.
cin | input stream |
Implements Request::KeyParserBase.
|
inlinevirtual |
Retrieve the key value from a JSON value and handle it.
This method is used for JSON-formatted requests.
json | JSON request |
Implements Request::KeyParserBase.