CppCMS

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

url_mapper.h
1 //
3 // Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
4 //
5 // See accompanying file COPYING.TXT file for licensing details.
6 //
8 #ifndef CPPCMS_URL_MAPPER_H
9 #define CPPCMS_URL_MAPPER_H
10
11 #include <cppcms/defs.h>
12 #include <cppcms/string_key.h>
13 #include <booster/noncopyable.h>
14 #include <booster/hold_ptr.h>
15 #include <cppcms/filters.h>
16 #include <string>
17 #include <vector>
18
19
20 namespace cppcms {
21 class application;
22
149 class CPPCMS_API url_mapper : public booster::noncopyable {
150 public:
152 url_mapper(application *app);
153 ~url_mapper();
155
161 std::string root();
167 void root(std::string const &r);
168
199 void assign(std::string const &key,std::string const &url);
204 void assign(std::string const &url);
205
213 void set_value(std::string const &key,std::string const &value);
220 void clear_value(std::string const &key);
221
225 void map( std::ostream &out,
226 char const *path);
227
231 void map( std::ostream &out,
232 char const *path,
233 filters::streamable const &p1);
234
238 void map( std::ostream &out,
239 char const *path,
240 filters::streamable const &p1,
241 filters::streamable const &p2);
242
246 void map( std::ostream &out,
247 char const *path,
248 filters::streamable const &p1,
249 filters::streamable const &p2,
250 filters::streamable const &p3);
251
255 void map( std::ostream &out,
256 char const *path,
257 filters::streamable const &p1,
258 filters::streamable const &p2,
259 filters::streamable const &p3,
260 filters::streamable const &p4);
264 void map( std::ostream &out,
265 char const *path,
266 filters::streamable const &p1,
267 filters::streamable const &p2,
268 filters::streamable const &p3,
269 filters::streamable const &p4,
270 filters::streamable const &p5);
274 void map( std::ostream &out,
275 char const *path,
276 filters::streamable const &p1,
277 filters::streamable const &p2,
278 filters::streamable const &p3,
279 filters::streamable const &p4,
280 filters::streamable const &p5,
281 filters::streamable const &p6);
285 void map( std::ostream &out,
286 std::string const &path);
287
291 void map( std::ostream &out,
292 std::string const &path,
293 filters::streamable const &p1);
294
298 void map( std::ostream &out,
299 std::string const &path,
300 filters::streamable const &p1,
301 filters::streamable const &p2);
302
306 void map( std::ostream &out,
307 std::string const &path,
308 filters::streamable const &p1,
309 filters::streamable const &p2,
310 filters::streamable const &p3);
311
315 void map( std::ostream &out,
316 std::string const &path,
317 filters::streamable const &p1,
318 filters::streamable const &p2,
319 filters::streamable const &p3,
320 filters::streamable const &p4);
324 void map( std::ostream &out,
325 std::string const &path,
326 filters::streamable const &p1,
327 filters::streamable const &p2,
328 filters::streamable const &p3,
329 filters::streamable const &p4,
330 filters::streamable const &p5);
334 void map( std::ostream &out,
335 std::string const &path,
336 filters::streamable const &p1,
337 filters::streamable const &p2,
338 filters::streamable const &p3,
339 filters::streamable const &p4,
340 filters::streamable const &p5,
341 filters::streamable const &p6);
342
350 void mount(std::string const &name,std::string const &url,application &app);
354 url_mapper &child(std::string const &name);
355
359 url_mapper &parent();
363 url_mapper &topmost();
364
365 private:
366 void real_assign(std::string const &key,std::string const &url,application *child = 0);
367 url_mapper &get_mapper_for_key(string_key const &key,string_key &real_key,std::vector<string_key> &direct);
368 url_mapper *root_mapper();
369 void real_map( char const *key,
370 filters::streamable const *const *params,
371 size_t params_no,
372 std::ostream &output);
373
374 struct data;
375 booster::hold_ptr<data> d;
376 };
377
378 };
379
380 #endif
booster::hold_ptr< data >
cppcms
This is the namespace where all CppCMS functionality is placed.
Definition: application.h:19
cppcms::url_mapper
class for mapping URLs - the opposite of dispatch
Definition: url_mapper.h:149
cppcms::string_key
This is a special object that may hold an std::string or alternatively reference to external (unowned...
Definition: string_key.h:30
cppcms::application
application class is the base class for all user created applications.
Definition: application.h:82
cppcms::filters::streamable
A special proxy object for writing any object to a std::ostream.
Definition: filters.h:67
booster::noncopyable
This class makes impossible to copy any class derived from this one.
Definition: noncopyable.h:15