Electroneum
has_token.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <boost/variant/static_visitor.hpp>
4 
5 #include "mstch/mstch.hpp"
6 
7 namespace mstch {
8 
9 class has_token: public boost::static_visitor<bool> {
10  public:
11  has_token(const std::string& token): m_token(token) {
12  }
13 
14  template<class T>
15  bool operator()(const T&) const {
16  return m_token == ".";
17  }
18 
19  bool operator()(const map& map) const {
20  return map.count(m_token) == 1;
21  }
22 
23  bool operator()(const std::shared_ptr<object>& object) const {
24  return object->has(m_token);
25  }
26 
27  private:
28  const std::string& m_token;
29 };
30 
31 }
bool operator()(const T &) const
Definition: has_token.hpp:15
const uint32_t T[512]
Definition: groestl_tables.h:34
bool operator()(const std::shared_ptr< object > &object) const
Definition: has_token.hpp:23
bool operator()(const map &map) const
Definition: has_token.hpp:19
Definition: mstch.hpp:95
Definition: mstch.hpp:11
const std::string & m_token
Definition: has_token.hpp:28
has_token(const std::string &token)
Definition: has_token.hpp:11
Definition: has_token.hpp:9
Definition: token.hpp:9