## Class scope

zeep::http::scope — The class that stores variables for the current scope.

## Synopsis

    // In header: <zeep/http/el-processing.hpp>

    class scope {
    public:
      // types
      typedef xml::node > > ;

      // construct/copy/destruct
      ();
      (request &);
      (basic_server &, request &);
      (scope &);
      scope & (scope &);

      // public member functions
      template<typename T>  (, );
      template<typename ForwardIterator>
         (, , );
      object & (,  = ) ;
      object & () ;
      object & ();
      object & ();
      request & () ;
       () ;
      json::element () ;
       (object &);
       () ;
       (, );
       () ;
       () ;
      template<>  (, object &);

      // friend functions
       (, scope &);
    };

## Description

When processing tags and in expression language constructs we use variables. These are stored in scope instances.

### `scope` public types

1. typedef xml::node > > ;

   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/destruct

1.     ();

   simple constructor, used where there's no request available

2.     (request & req);

   constructor to be used only in debugging

   Parameters:

   `req` | The incomming HTTP request

3.     (basic_server & server, request & req);

   constructor used in a HTTP request context

   Parameters:

   `req` | The incomming HTTP request
   `server` | The server that handles the incomming request

4.     (scope & next);

   chaining constructor

   Scopes can be nested, introducing new namespaces

   Parameters:

   `next` | The next scope up the chain.

5.     scope & (scope &);

### `scope` public member functions

1.     template<typename T>  ( name,  value);

   put variable in the scope with name and value

2.     template<typename ForwardIterator>
          ( name,  begin,
                   end);

   put variable of type array in the scope with name and values from begin to end

3.     object &
       ( name,  includeSelected = ) ;

   return variable with name

   Parameters:

   `includeSelected` | If this is true, and the variable was not found as a regular variable in the current scope, the selected objects will be search for members with name This is used by the tag processing lib v2 in z2:object
   `name` | The name of the variable to return

   Returns: | The value found or null if there was no such variable.

4.     object & ( name) ;

   return variable with name

5.     object & ( name);

   return variable with name

   Parameters:

   `name` | The name of the variable to return

   Returns: | The value found or null if there was no such variable.

6.     object & ( name);

   return variable with name

7.     request & () ;

   return the HTTP request, will throw if the scope chain was not created with a request

8.      () ;

   return the context_name of the server

9.     json::element () ;

   return the credentials of the current user

10.      (object & o);

    select object o , used in z2:object constructs

11.      ( name) ;

    return the node_set_type with name name

12.      ( name,  nodes);

    store node_set_type nodes with name name

13.      ( name) ;

    return whether a node_set with name name is stored

14.      () ;

    get the CSRF token from the request burried in scope

15.     template<>  ( name, object & value);

### `scope` friend functions

1.      ( lhs, scope & rhs);

   for debugging purposes