CppCMS
cppcms/mount_point.h
00001 
00002 //                                                                             
00003 //  Copyright (C) 2008-2012  Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>     
00004 //                                                                             
00005 //  See accompanying file COPYING.TXT file for licensing details.
00006 //
00008 #ifndef CPPCMS_MOUNT_POINT_H
00009 #define CPPCMS_MOUNT_POINT_H
00010 
00011 #include <cppcms/defs.h>
00012 #include <string>
00013 #include <booster/perl_regex.h>
00014 #include <booster/copy_ptr.h>
00015 
00016 namespace cppcms {
00024         class CPPCMS_API mount_point {
00025         public:
00045                 typedef enum {
00046                         match_path_info,    
00047                         match_script_name   
00048                 } selection_type;
00049 
00053                 booster::regex host() const;
00057                 booster::regex script_name() const;
00061                 booster::regex path_info() const;
00065                 int group() const;
00066 
00070                 selection_type selection() const;
00071 
00075                 void host(booster::regex const &);
00079                 void script_name(booster::regex const &);
00083                 void path_info(booster::regex const &);
00087                 void group(int);
00091                 void selection(selection_type);
00092 
00098                 std::pair<bool,std::string> match(std::string const &h,std::string const &s,std::string const &p) const;
00104                 std::pair<bool,std::string> match(char const *h,char const *s,char const *p) const;
00105 
00109                 mount_point();
00112                 ~mount_point();
00116                 mount_point(mount_point const &);
00120                 mount_point const &operator=(mount_point const &);
00121 
00125                 mount_point(std::string const &path,int group);
00129                 mount_point(std::string const &script);
00134                 mount_point(std::string const &script,std::string const &path,int group);
00135 
00143                 mount_point(    selection_type sel,
00144                                 std::string const &selected_part,
00145                                 int group);
00146 
00155                 mount_point(    selection_type sel,
00156                                 std::string const &non_selected_part);
00157 
00168                 mount_point(    selection_type sel,
00169                                 std::string const &non_selected_part,
00170                                 std::string const &selected_part,
00171                                 int group);
00172 
00179 
00180                 mount_point(    selection_type sel,
00181                                 booster::regex const &http_host,
00182                                 booster::regex const &script,
00183                                 booster::regex const &path,
00184                                 int group);
00185 
00186         private:
00187                 booster::regex host_;
00188                 booster::regex script_name_;
00189                 booster::regex path_info_;
00190                 int group_;
00191                 selection_type selection_;
00192                 struct _data;
00193                 booster::copy_ptr<_data> d;
00194         };
00195 
00196 } // cppcms
00197 
00198 #endif
00199 
00200