clang-tags
C/C++ source code indexing tool based on libclang
 All Classes Functions Variables Typedefs Groups Pages
Public Member Functions | List of all members
Request::Key< T > Class Template Reference

Scalar key parser. More...

#include <request.hxx>

Inheritance diagram for Request::Key< T >:
Inheritance graph
[legend]
Collaboration diagram for Request::Key< T >:
Collaboration graph
[legend]

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.
KeyParserBasemetavar (std::string metavar)
 Set the meta variable name for the key.
KeyParserBasedescription (std::string description)
 Set the description string for the key.
KeyParserBaserequired (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.

Detailed Description

template<typename T>
class Request::Key< T >

Scalar key parser.

Parses a key and stores a single value in a destination variable.

Parameters
Ttype of associated value

Constructor & Destructor Documentation

template<typename T>
Request::Key< T >::Key ( std::string  name,
T &  destination 
)
inline

Constructor.

Parameters
namekey name
destinationreference to a variable where the key value will be stored
Returns

Member Function Documentation

template<typename T>
virtual void Request::Key< T >::parse ( std::istream &  cin)
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.

Parameters
cininput stream

Implements Request::KeyParserBase.

template<typename T>
virtual void Request::Key< T >::set ( const Json::Value &  json)
inlinevirtual

Retrieve the key value from a JSON value and handle it.

This method is used for JSON-formatted requests.

Parameters
jsonJSON request

Implements Request::KeyParserBase.


The documentation for this class was generated from the following file: