NSVD Reader  0.0.1
visitor.hpp
Go to the documentation of this file.
1 
5 /*
6  * These codes are licensed under CC0.
7  * http://creativecommons.org/publicdomain/zero/1.0/
8  */
9 #ifndef __NODAMUSHI_VISITOR_VISITOR_HPP__
10 #define __NODAMUSHI_VISITOR_VISITOR_HPP__
11 
13 
14 namespace nodamushi{
15 namespace visitor{
16 
17 
18 template<typename CONTROLLER,typename VISITOR,typename T>
19 result apply(T& t);
20 
21 template<typename CONTROLLER,typename VISITOR,typename T>
22 result apply(T& t,VISITOR& visitor);
23 
24 template<typename CONTROLLER,typename VISITOR,typename T>
26 
27 template<typename CONTROLLER,typename VISITOR,typename T>
28 result applyController(T& t,VISITOR& visitor);
29 
30 
31 template<typename VISITOR,typename T>
32 result applyVisit(T& t);
33 
34 template<typename VISITOR,typename T>
35 result applyVisit(T& t,VISITOR& visitor);
36 
37 
38 template<typename VISITOR,typename T>
40 
41 template<typename VISITOR,typename T>
42 result applyPostVisit(T& t,VISITOR& visitor);
43 
44 
45 enum class _visitor_member_type_:int
46 {
47  staticmt=0,
48  mt=1
49 };
50 template<typename T,_visitor_member_type_ v>struct is_static
51 {
52  static constexpr bool value = v ==_visitor_member_type_::staticmt;
53 };
54 
55 
56 
57 #define __NODAMUSHI_VISIT_ENUM__(x,y) ::nodamushi::visitor::_visitor_member_type_::__NODAMUSHI_VISIT_ENUM2__(x,y)
58 #define __NODAMUSHI_VISIT_ENUM2__(x,y) x##y
59 #define VISITOR_INIT\
60  using result = ::nodamushi::visitor::result; \
61  static constexpr result CONTINUE = result::CONTINUE; \
62  static constexpr result BREAK = result::BREAK; \
63  static constexpr result SKIP = result::SKIP; \
64  template<typename T>VISITOR_MEMBER result visit(const T& t){return result::CONTINUE;} \
65  template<typename T>VISITOR_MEMBER result visit(T& t){return result::CONTINUE;} \
66  template<typename T>VISITOR_MEMBER result postVisit(const T& t){return result::CONTINUE;} \
67  template<typename T>VISITOR_MEMBER result postVisit(T& t){return result::CONTINUE;}
68 
69 # ifndef VISITOR_MEMBER
70 # define VISITOR_MEMBER
71 # endif
72 
73 } // end namespace visitor
74 }// end namespace nodamushi
75 
77 
78 #endif // __NODAMUSHI_VISITOR_VISITOR_HPP__
result applyPostVisit(T &t)
Definition: imple.hpp:311
Header file.
visitor imple
static constexpr bool value
Definition: visitor.hpp:52
result applyVisit(T &t)
Definition: imple.hpp:296
result apply(T &t)
Definition: imple.hpp:197
result applyController(T &t)
Definition: imple.hpp:212