![]() |
zeep::http::scope — The class that stores variables for the current scope.
// In header: <zeep/http/el-processing.hpp> class scope { public: // types typedef std::vector< std::unique_ptr< xml::node > > node_set_type; // construct/copy/destruct scope(); scope(const request &); scope(const server &, const request &); explicit scope(const scope &); scope & operator=(const scope &); // public member functions template<typename T> void put(const std::string &, const T &); template<typename ForwardIterator> void put(const std::string &, ForwardIterator, ForwardIterator); const object & lookup(const std::string &, bool = false) const; const object & operator[](const std::string &) const; object & lookup(const std::string &); object & operator[](const std::string &); const request & get_request() const; std::string get_context_name() const; json::element get_credentials() const; void select_object(const object &); node_set_type get_nodeset(const std::string &) const; void set_nodeset(const std::string &, node_set_type &&); bool has_nodeset(const std::string &) const; std::string get_csrf_token() const; template<> void put(const std::string &, const object &); // friend functions friend std::ostream & operator<<(std::ostream &, const scope &); };
When processing tags and in expression language constructs we use variables. These are stored in scope instances.
scope
public
typestypedef std::vector< std::unique_ptr< xml::node > > node_set_type;
In tag processors it is sometimes needed to take a selection of zeep::xml::nodes and reuse these, as a copy when inserting templates e.g.
scope
public
construct/copy/destructscope();simple constructor, used where there's no request available
scope(const request & req);constructor to be used only in debugging
Parameters: |
|
scope(const server & server, const request & req);constructor used in a HTTP request context
Parameters: |
|
explicit scope(const scope & next);chaining constructor
Scopes can be nested, introducing new namespaces
Parameters: |
|
scope & operator=(const scope &);
scope
public member functionstemplate<typename T> void put(const std::string & name, const T & value);put variable in the scope with name and value
template<typename ForwardIterator> void put(const std::string & name, ForwardIterator begin, ForwardIterator end);put variable of type array in the scope with name and values from begin to end
const object & lookup(const std::string & name, bool includeSelected = false) const;return variable with name
Parameters: |
|
||||
Returns: |
The value found or null if there was no such variable. |
const object & operator[](const std::string & name) const;return variable with name
object & lookup(const std::string & name);return variable with name
Parameters: |
|
||
Returns: |
The value found or null if there was no such variable. |
object & operator[](const std::string & name);return variable with name
const request & get_request() const;return the HTTP request, will throw if the scope chain was not created with a request
std::string get_context_name() const;return the context_name of the server
json::element get_credentials() const;return the credentials of the current user
void select_object(const object & o);select object o , used in z2:object constructs
node_set_type get_nodeset(const std::string & name) const;return the node_set_type with name name
void set_nodeset(const std::string & name, node_set_type && nodes);store node_set_type nodes with name name
bool has_nodeset(const std::string & name) const;return whether a node_set with name name is stored
std::string get_csrf_token() const;get the CSRF token from the request burried in scope
template<> void put(const std::string & name, const object & value);
scope
friend functionsfriend std::ostream & operator<<(std::ostream & lhs, const scope & rhs);for debugging purposes