stencet  v0.1.16
Build C++ web server modules that allow easy routing and deployment.
viewContext.h
1 /* Copyright (C) 2012-2013 Justin Berger
2  The full license is available in the LICENSE file at the root of this project and is also available at http://opensource.org/licenses/MIT. */
3 
4 #pragma once
5 #include <stencet/viewModel.h>
6 #include <stencet/variant.h>
7 
8 namespace stencet {
9  struct Template;
10  struct ViewContext : public ViewModel {
11  private:
12  std::vector<ViewModel*> scopes;
13  std::vector<Variant> _locals;
14  public:
15  std::map<std::string, const Template*> blocks;
16 
17  Variant& locals();
18  void push_scope(ViewModel*);
19  void pop_scope();
20 
21  virtual Type getType() const;
22  virtual size_t size() const;
23  virtual bool hasValue(const std::string& name);
24  virtual ViewModel* at(size_t);
25  virtual ViewModel* at(const std::string& name);
26  };
27 }