@@ -113,9 +113,53 @@ namespace sl
113113 inline std::string return_type_string (std::string*) { return " string" ; }
114114 template <typename ... T>
115115 std::string return_type_string (sio<T...>*) { return " object" ; }
116+
117+ template <typename P, typename Ro, typename W>
118+ void generate_procedure (P p, Ro route, std::string tpl, W& write, path_generator path)
119+ {
120+ typedef std::remove_reference_t <decltype (p.value ().content .function ())> F;
121+ typedef std::remove_reference_t <std::remove_const_t <callable_return_type_t <F>>> R;
122+
123+ tpl_generator (
124+ tpl, write,
125+
126+ " procedure_path" , [&] (const char *&) {
127+ write (path (p.symbol ().name ()));
128+ },
129+ " procedure_description" , [&] (const char *&) {
130+ write (procedure_description (p.value ().route , p.value ().content ));
131+ },
132+ " procedure_url_string" , [&] (const char *&) {
133+ write (path (p.symbol ().name (), " /" , true ));
134+ },
135+ " procedure_url" , [&] (const char *&) {
136+ auto url = p.value ().route ;
137+ write (" {" );
138+ foreach (url.path ) | [&] (auto e)
139+ {
140+ std::string name =
141+ static_if<is_symbol<decltype (e)>::value>(
142+ [&] (auto e) { return e.name (); },
143+ [&] (auto e) { return e.symbol ().name (); }, e);
144+
145+ write (name + " : { is_param: " +
146+ (!is_symbol<decltype (e)>::value ? " true" : " false" ) + " }," );
147+ };
148+ write (" }" );
149+ },
150+
151+ " return_type" , [&] (const char *&) {
152+ write (return_type_string ((R*)0 ));
153+ },
154+ " root_scope" , [&] (const char *&) {
155+ write (path.root ());
156+ }
157+
158+ );
159+ }
116160
117- template <typename P, typename W>
118- void generate_procedure (P p, std::string tpl, W& write, path_generator path)
161+ template <typename P, typename ... Ro, typename W>
162+ void generate_procedure (P p, const http_route<Ro...>& route, std::string tpl, W& write, path_generator path)
119163 {
120164 typedef std::remove_reference_t <decltype (p.value ().content .function ())> F;
121165 typedef std::remove_reference_t <std::remove_const_t <callable_return_type_t <F>>> R;
@@ -197,7 +241,7 @@ namespace sl
197241 [] (auto m) {
198242 },
199243 [&] (auto m) {
200- generate_procedure (m, proc_tpl, write, path);
244+ generate_procedure (m, m. value (). route , proc_tpl, write, path);
201245 }, m);
202246 };
203247
0 commit comments