1 // file : xsd-frontend/traversal/compositors.cxx 2 // copyright : Copyright (c) 2006-2017 Code Synthesis Tools CC 3 // license : GNU GPL v2 + exceptions; see accompanying LICENSE file 4 5 #include <xsd-frontend/traversal/compositors.hxx> 6 7 namespace XSDFrontend 8 { 9 namespace Traversal 10 { 11 // ContainsParticle 12 // 13 void ContainsParticle:: traverse(Type & c)14 traverse (Type& c) 15 { 16 dispatch (c.particle ()); 17 } 18 19 20 // ContainsCompositor 21 // 22 void ContainsCompositor:: traverse(Type & c)23 traverse (Type& c) 24 { 25 dispatch (c.compositor ()); 26 } 27 28 29 // Compositor 30 // 31 void Compositor:: traverse(Type & c)32 traverse (Type& c) 33 { 34 pre (c); 35 contains (c); 36 post (c); 37 } 38 39 void Compositor:: pre(Type &)40 pre (Type&) 41 { 42 } 43 44 void Compositor:: contains(Type & c)45 contains (Type& c) 46 { 47 iterate_and_dispatch ( 48 c.contains_begin (), c.contains_end (), edge_traverser ()); 49 } 50 51 void Compositor:: contains(Type & c,EdgeDispatcher & d)52 contains (Type& c, EdgeDispatcher& d) 53 { 54 iterate_and_dispatch (c.contains_begin (), c.contains_end (), d); 55 } 56 57 void Compositor:: post(Type &)58 post (Type&) 59 { 60 } 61 62 63 // All 64 // 65 void All:: traverse(Type & c)66 traverse (Type& c) 67 { 68 pre (c); 69 contains (c); 70 post (c); 71 } 72 73 void All:: pre(Type &)74 pre (Type&) 75 { 76 } 77 78 void All:: contains(Type & c)79 contains (Type& c) 80 { 81 iterate_and_dispatch ( 82 c.contains_begin (), c.contains_end (), edge_traverser ()); 83 } 84 85 void All:: contains(Type & c,EdgeDispatcher & d)86 contains (Type& c, EdgeDispatcher& d) 87 { 88 iterate_and_dispatch (c.contains_begin (), c.contains_end (), d); 89 } 90 91 void All:: post(Type &)92 post (Type&) 93 { 94 } 95 96 97 // Choice 98 // 99 void Choice:: traverse(Type & c)100 traverse (Type& c) 101 { 102 pre (c); 103 contains (c); 104 post (c); 105 } 106 107 void Choice:: pre(Type &)108 pre (Type&) 109 { 110 } 111 112 void Choice:: contains(Type & c)113 contains (Type& c) 114 { 115 iterate_and_dispatch ( 116 c.contains_begin (), c.contains_end (), edge_traverser ()); 117 } 118 119 void Choice:: contains(Type & c,EdgeDispatcher & d)120 contains (Type& c, EdgeDispatcher& d) 121 { 122 iterate_and_dispatch (c.contains_begin (), c.contains_end (), d); 123 } 124 125 void Choice:: post(Type &)126 post (Type&) 127 { 128 } 129 130 131 // Sequence 132 // 133 void Sequence:: traverse(Type & c)134 traverse (Type& c) 135 { 136 pre (c); 137 contains (c); 138 post (c); 139 } 140 141 void Sequence:: pre(Type &)142 pre (Type&) 143 { 144 } 145 146 void Sequence:: contains(Type & c)147 contains (Type& c) 148 { 149 iterate_and_dispatch ( 150 c.contains_begin (), c.contains_end (), edge_traverser ()); 151 } 152 153 void Sequence:: contains(Type & c,EdgeDispatcher & d)154 contains (Type& c, EdgeDispatcher& d) 155 { 156 iterate_and_dispatch (c.contains_begin (), c.contains_end (), d); 157 } 158 159 void Sequence:: post(Type &)160 post (Type&) 161 { 162 } 163 } 164 } 165