url_mapper.h
//
// Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
//
// See accompanying file COPYING.TXT file for licensing details.
//
#ifndef CPPCMS_URL_MAPPER_H
#define CPPCMS_URL_MAPPER_H
#include <cppcms/defs.h>
#include <cppcms/string_key.h>
#include <booster/noncopyable.h>
#include <booster/hold_ptr.h>
#include <cppcms/filters.h>
#include <string>
#include <vector>
namespace cppcms {
class application;
class CPPCMS_API url_mapper : public booster::noncopyable {
public:
url_mapper(application *app);
~url_mapper();
std::string root();
void root(std::string const &r);
void assign(std::string const &key,std::string const &url);
void assign(std::string const &url);
void set_value(std::string const &key,std::string const &value);
void clear_value(std::string const &key);
void map( std::ostream &out,
char const *path);
void map( std::ostream &out,
char const *path,
filters::streamable const &p1);
void map( std::ostream &out,
char const *path,
filters::streamable const &p1,
filters::streamable const &p2);
void map( std::ostream &out,
char const *path,
filters::streamable const &p1,
filters::streamable const &p2,
filters::streamable const &p3);
void map( std::ostream &out,
char const *path,
filters::streamable const &p1,
filters::streamable const &p2,
filters::streamable const &p3,
filters::streamable const &p4);
void map( std::ostream &out,
char const *path,
filters::streamable const &p1,
filters::streamable const &p2,
filters::streamable const &p3,
filters::streamable const &p4,
filters::streamable const &p5);
void map( std::ostream &out,
char const *path,
filters::streamable const &p1,
filters::streamable const &p2,
filters::streamable const &p3,
filters::streamable const &p4,
filters::streamable const &p5,
filters::streamable const &p6);
void map( std::ostream &out,
std::string const &path);
void map( std::ostream &out,
std::string const &path,
filters::streamable const &p1);
void map( std::ostream &out,
std::string const &path,
filters::streamable const &p1,
filters::streamable const &p2);
void map( std::ostream &out,
std::string const &path,
filters::streamable const &p1,
filters::streamable const &p2,
filters::streamable const &p3);
void map( std::ostream &out,
std::string const &path,
filters::streamable const &p1,
filters::streamable const &p2,
filters::streamable const &p3,
filters::streamable const &p4);
void map( std::ostream &out,
std::string const &path,
filters::streamable const &p1,
filters::streamable const &p2,
filters::streamable const &p3,
filters::streamable const &p4,
filters::streamable const &p5);
void map( std::ostream &out,
std::string const &path,
filters::streamable const &p1,
filters::streamable const &p2,
filters::streamable const &p3,
filters::streamable const &p4,
filters::streamable const &p5,
filters::streamable const &p6);
void mount(std::string const &name,std::string const &url,application &app);
url_mapper &child(std::string const &name);
url_mapper &parent();
url_mapper &topmost();
private:
void real_assign(std::string const &key,std::string const &url,application *child = 0);
url_mapper &get_mapper_for_key(string_key const &key,string_key &real_key,std::vector<string_key> &direct);
url_mapper *root_mapper();
void real_map( char const *key,
filters::streamable const *const *params,
size_t params_no,
std::ostream &output);
struct data;
booster::hold_ptr<data> d;
};
};
#endif
booster::hold_ptr< data >
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:81
cppcms::filters::streamable
A special proxy object for writing any object to a std::ostream.
Definition: filters.h:34
booster::noncopyable
This class makes impossible to copy any class derived from this one.
Definition: noncopyable.h:15