Wolframe, 0.0.3

execContextInputFilter.hpp
Go to the documentation of this file.
1 /************************************************************************
2 
3  Copyright (C) 2011 - 2014 Project Wolframe.
4  All rights reserved.
5 
6  This file is part of Project Wolframe.
7 
8  Commercial Usage
9  Licensees holding valid Project Wolframe Commercial licenses may
10  use this file in accordance with the Project Wolframe
11  Commercial License Agreement provided with the Software or,
12  alternatively, in accordance with the terms contained
13  in a written agreement between the licensee and Project Wolframe.
14 
15  GNU General Public License Usage
16  Alternatively, you can redistribute this file and/or modify it
17  under the terms of the GNU General Public License as published by
18  the Free Software Foundation, either version 3 of the License, or
19  (at your option) any later version.
20 
21  Wolframe is distributed in the hope that it will be useful,
22  but WITHOUT ANY WARRANTY; without even the implied warranty of
23  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  GNU General Public License for more details.
25 
26  You should have received a copy of the GNU General Public License
27  along with Wolframe. If not, see <http://www.gnu.org/licenses/>.
28 
29  If you have questions regarding the use of this file, please contact
30  Project Wolframe.
31 
32 ************************************************************************/
35 #ifndef _WOLFRAME_FILTER_EXEC_CONTEXT_INPUT_FILTER_HPP_INCLUDED
36 #define _WOLFRAME_FILTER_EXEC_CONTEXT_INPUT_FILTER_HPP_INCLUDED
38 #include "filter/typedfilter.hpp"
39 #include <string>
40 
41 namespace _Wolframe {
42 namespace langbind {
43 
47 {
48  enum Value
49  {
57  };
58  enum {MaxValue=(int)Resource};
59 
60  static const char* valueName( Value v)
61  {
62  static const char* ar[] = {"Const","UserName","SocketId","RemoteHost","ConnectionType","Authenticator","Resource"};
63  return ar[v];
64  }
65  static Value valueFromId( const std::string& v);
66 
67  std::string name;
69  std::string const_value;
70  char value_delim;
71  std::size_t value_idx;
72 
74  :value(Const),value_delim(0),value_idx(0){}
76  :name(o.name),value(o.value),const_value(o.const_value),value_delim(o.value_delim),value_idx(o.value_idx){}
77  ExecContextElement( const std::string& name_, const std::string& const_value_)
78  :name(name_),value(Const),const_value(const_value_),value_delim(0),value_idx(0){}
79  ExecContextElement( const std::string& name_, Value value_)
80  :name(name_),value(value_),value_delim(0),value_idx(0){}
81  ExecContextElement( const std::string& name_, Value value_, char value_delim_, std::size_t value_idx_)
82  :name(name_),value(value_),value_delim(value_delim_),value_idx(value_idx_){}
83 };
84 
89 {
90 public:
91  explicit ExecContextInputFilter( const std::vector<ExecContextElement>& params_, const proc::ExecContext& ctx_, const std::string& resource_);
94 
96  {
97  return new ExecContextInputFilter(*this);
98  }
99 
100  const std::string& getElement( const std::string& ar, char delim, std::size_t idx);
101 
102  virtual bool getNext( ElementType& type, types::VariantConst& element);
103 
104  virtual void resetIterator();
105 
106 private:
107  int m_state;
108  std::size_t m_paramidx;
109  const std::vector<ExecContextElement>* m_params;
112  std::string m_elembuf;
113 };
114 
115 }}
116 #endif
117 
std::size_t m_paramidx
Definition: execContextInputFilter.hpp:108
Definition: execContextInputFilter.hpp:55
std::size_t value_idx
index >= 1 in case of array access (0 else)
Definition: execContextInputFilter.hpp:71
Definition: execContextInputFilter.hpp:53
ExecContextElement(const std::string &name_, Value value_)
Definition: execContextInputFilter.hpp:79
char value_delim
delimiter in case of array access (0 else)
Definition: execContextInputFilter.hpp:70
std::string m_elembuf
Definition: execContextInputFilter.hpp:112
ExecContextElement(const std::string &name_, const std::string &const_value_)
Definition: execContextInputFilter.hpp:77
Definition: execContextInputFilter.hpp:54
int m_state
Definition: execContextInputFilter.hpp:107
std::string const_value
value in case of const
Definition: execContextInputFilter.hpp:69
ExecContextElement(const ExecContextElement &o)
Definition: execContextInputFilter.hpp:75
Execution context passed to functions for referencing resources and to define authorization dependend...
Definition: execContext.hpp:47
Definition: execContextInputFilter.hpp:50
Definition: execContextInputFilter.hpp:56
std::string m_authorizationResource
Definition: execContextInputFilter.hpp:111
ExecContextElement(const std::string &name_, Value value_, char value_delim_, std::size_t value_idx_)
Definition: execContextInputFilter.hpp:81
Variant value type that represents a variant copy without content ownership.
Definition: variant.hpp:286
Definition: execContextInputFilter.hpp:58
Execution context.
Filter for passing seleced elements of an execution context as parameters to a function.
Definition: execContextInputFilter.hpp:87
Value value
value taken from execution context
Definition: execContextInputFilter.hpp:68
virtual langbind::TypedInputFilter * copy() const
Get a self copy.
Definition: execContextInputFilter.hpp:95
const std::vector< ExecContextElement > * m_params
Definition: execContextInputFilter.hpp:109
Definition: execContextInputFilter.hpp:51
ExecContextElement()
Definition: execContextInputFilter.hpp:73
virtual ~ExecContextInputFilter()
Definition: execContextInputFilter.hpp:93
Value
Definition: execContextInputFilter.hpp:48
const proc::ExecContext * m_ctx
Definition: execContextInputFilter.hpp:110
One element of an execution context input filter definition.
Definition: execContextInputFilter.hpp:46
Typed interface for input/output filter.
std::string name
name of the parameter
Definition: execContextInputFilter.hpp:67
Input filter with atomic values having a type.
Definition: typedfilter.hpp:48
static Value valueFromId(const std::string &v)
Definition: execContextInputFilter.hpp:52
static const char * valueName(Value v)
Definition: execContextInputFilter.hpp:60