CppCMS

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

- File List
- File Members

url_dispatcher.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_DISPATCHER_H
9 #define CPPCMS_URL_DISPATCHER_H
10
11 #include <booster/noncopyable.h>
12 #include <cppcms/defs.h>
13 #include <booster/function.h>
14 #include <booster/hold_ptr.h>
15 #include <booster/traits/enable_if.h>
16 #include <booster/traits/is_base_of.h>
17 #include <booster/traits/type_traits.h>
18 #include <booster/regex.h>
19 #include <cppcms/application.h>
20 #include <cppcms/steal_buf.h>
21 #include <string>
22 #include <list>
23
24 namespace cppcms {
25
30 inline bool parse_url_parameter(util::const_char_istream &parameter,std::string &output)
31 {
32 output.assign(parameter.begin(),parameter.end());
33 return true;
34 }
39 template<typename ParamType>
40 bool parse_url_parameter(util::const_char_istream &parameter,ParamType &value)
41 {
42 parameter >> value;
43 if(!parameter || !parameter.eof())
44 return false;
45 return true;
46 }
47
48
58
101 class CPPCMS_API url_dispatcher : public booster::noncopyable {
102 public:
109 typedef booster::function<bool(cppcms::application &,booster::cmatch const &)> generic_handler;
110 // Handlers
111 typedef booster::function<void()> handler;
112 typedef booster::function<void(booster::cmatch const &)> rhandler;
113 typedef booster::function<void(std::string)> handler1;
114 typedef booster::function<void(std::string,std::string)> handler2;
115 typedef booster::function<void(std::string,std::string,std::string)> handler3;
116 typedef booster::function<void(std::string,std::string,std::string,std::string)> handler4;
117 typedef booster::function<void(std::string,std::string,std::string,std::string,std::string)> handler5;
118 typedef booster::function<void(std::string,std::string,std::string,std::string,std::string,std::string)> handler6;
119
120
129 void map_generic(std::string const &method,booster::regex const &re,generic_handler const &h);
137 void map_generic(booster::regex const &re,generic_handler const &h);
138
139
140 #ifdef CPPCMS_DOXYGEN_DOCS
141
179 template<typename Application,typename... ApplicationMemberArgs>
180 void map(std::string const &method,std::string const &re,void (Application::*member)(ApplicationMemberArgs...),Application *app, int ... groups );
181
218 template<typename Application,typename... ApplicationMemberArgs>
219 void map(std::string const &re,void (Application::*member)(ApplicationMemberArgs...),Application *app, int ... groups );
220
221
260 template<typename Application,typename... ApplicationMemberArgs>
261 void map(std::string const &method,booster::regex const &re,void (Application::*member)(ApplicationMemberArgs...),Application *app, int ... groups );
262
300 template<typename Application,typename... ApplicationMemberArgs>
301 void map(booster::regex const &re,void (Application::*member)(ApplicationMemberArgs...),Application *app, int ... groups );
302
303
304
305 #endif
306
311 void assign_generic(std::string const &regex,rhandler handler);
316 void assign(std::string const &regex,handler handler);
327 void assign(std::string const &regex,handler1 handler,int exp1);
333 void assign(std::string const &regex,handler2 handler,int exp1,int exp2);
339 void assign(std::string const &regex,handler3 handler,int exp1,int exp2,int exp3);
345 void assign(std::string const &regex,handler4 handler,int exp1,int exp2,int exp3,int exp4);
352 void assign(std::string const &regex,handler5 handler,int exp1,int exp2,int exp3,int exp4,int exp5);
359 void assign(std::string const &regex,handler6 handler,int exp1,int exp2,int exp3,int exp4,int exp5,int exp6);
360
367
368 bool dispatch(std::string url);
369
371 url_dispatcher(application *app);
372 url_dispatcher();
373 ~url_dispatcher();
375
384 template<typename C>
385 void assign(std::string const &regex,void (C::*member)(),C *object)
386 {
387 assign(regex,binder0<C>(member,object));
388 }
397 template<typename C>
398 void assign_generic(std::string const &regex,void (C::*member)(booster::cmatch const &),C *object)
399 {
400 assign_generic(regex,rbinder<C>(member,object));
401 }
409 template<typename C>
410 void assign(std::string const &regex,void (C::*member)(std::string),C *object,int e1)
411 {
412 assign(regex,binder1<C>(member,object),e1);
413 }
421 template<typename C>
422 void assign(std::string const &regex,void (C::*member)(std::string,std::string),C *object,int e1,int e2)
423 {
424 assign(regex,binder2<C>(member,object),e1,e2);
425 }
426 template<typename C>
434 void assign(std::string const &regex,void (C::*member)(std::string,std::string,std::string),C *object,int e1,int e2,int e3)
435 {
436 assign(regex,binder3<C>(member,object),e1,e2,e3);
437 }
445 template<typename C>
446 void assign(std::string const &regex,void (C::*member)(std::string,std::string,std::string,std::string),C *object,int e1,int e2,int e3,int e4)
447 {
448 assign(regex,binder4<C>(member,object),e1,e2,e3,e4);
449 }
458 template<typename C>
459 void assign(std::string const &regex,void (C::*member)(std::string,std::string,std::string,std::string,std::string),C *object,int e1,int e2,int e3,int e4,int e5)
460 {
461 assign(regex,binder5<C>(member,object),e1,e2,e3,e4,e5);
462 }
471 template<typename C>
472 void assign(std::string const &regex,void (C::*member)(std::string,std::string,std::string,std::string,std::string,std::string),C *object,int e1,int e2,int e3,int e4,int e5,int e6)
473 {
474 assign(regex,binder6<C>(member,object),e1,e2,e3,e4,e5,e6);
475 }
476
489 void mount(std::string const &match,application &app,int part);
490
491 private:
492
493 template<typename C,typename Enable = void>
494 class page_guard {
495 public:
496 page_guard(C * /*o*/) {}
497 page_guard(C * /*o*/,std::istream &) {}
498 application *app() { return 0; }
499 };
500
501 template<typename C>
502 class page_guard<C,typename booster::enable_if<booster::is_base_of< cppcms::application,C> >::type > {
503 public:
504 page_guard(C *o) :
505 object_(o)
506 {
507 object_->init();
508 }
509 application *app() { return object_; }
510 ~page_guard()
511 {
512 object_->clear();
513 }
514 private:
515 application *object_;
516 };
517
518 template<typename C>
519 struct binder0{
520 typedef void (C::*member_type)();
521 member_type member;
522 C *object;
523
524 binder0(member_type m,C *o) :
525 member(m),
526 object(o)
527 {
528 }
529 void operator()() const
530 {
531 page_guard<C> guard(object);
532 (object->*member)();
533 }
534 };
535
536 template<typename C>
537 struct rbinder{
538 typedef void (C::*member_type)(booster::cmatch const &);
539 member_type member;
540 C *object;
541
542 rbinder(member_type m,C *o) :
543 member(m),
544 object(o)
545 {
546 }
547 void operator()(booster::cmatch const &p1) const
548 {
549 page_guard<C> guard(object);
550 (object->*member)(p1);
551 }
552 };
553
554 template<typename C>
555 struct binder1{
556 typedef void (C::*member_type)(std::string);
557 member_type member;
558 C *object;
559
560 binder1(member_type m,C *o) :
561 member(m),
562 object(o)
563 {
564 }
565 void operator()(std::string p1) const
566 {
567 page_guard<C> guard(object);
568 (object->*member)(p1);
569 }
570 };
571
572 template<typename C>
573 struct binder2{
574 typedef void (C::*member_type)(std::string,std::string);
575 member_type member;
576 C *object;
577
578 binder2(member_type m,C *o) :
579 member(m),
580 object(o)
581 {
582 }
583 void operator()(std::string p1,std::string p2) const
584 {
585 page_guard<C> guard(object);
586 (object->*member)(p1,p2);
587 }
588 };
589 template<typename C>
590 struct binder3{
591 typedef void (C::*member_type)(std::string,std::string,std::string);
592 member_type member;
593 C *object;
594
595 binder3(member_type m,C *o) :
596 member(m),
597 object(o)
598 {
599 }
600 void operator()(std::string p1,std::string p2,std::string p3) const
601 {
602 page_guard<C> guard(object);
603 (object->*member)(p1,p2,p3);
604 }
605 };
606 template<typename C>
607 struct binder4{
608 typedef void (C::*member_type)(std::string,std::string,std::string,std::string);
609 member_type member;
610 C *object;
611
612 binder4(member_type m,C *o) :
613 member(m),
614 object(o)
615 {
616 }
617 void operator()(std::string p1,std::string p2,std::string p3,std::string p4) const
618 {
619 page_guard<C> guard(object);
620 (object->*member)(p1,p2,p3,p4);
621 }
622 };
623
624 template<typename C>
625 struct binder5{
626 typedef void (C::*member_type)(std::string,std::string,std::string,std::string,std::string);
627 member_type member;
628 C *object;
629
630 binder5(member_type m,C *o) :
631 member(m),
632 object(o)
633 {
634 }
635 void operator()(std::string p1,std::string p2,std::string p3,std::string p4,std::string p5) const
636 {
637 page_guard<C> guard(object);
638 (object->*member)(p1,p2,p3,p4,p5);
639 }
640 };
641
642 static bool validate_encoding(application &app,char const *begin,char const *end);
643 static void setup_stream(application &app,std::istream &s);
644
645 template<typename C>
646 struct binder6{
647 typedef void (C::*member_type)(std::string,std::string,std::string,std::string,std::string,std::string);
648 member_type member;
649 C *object;
650
651 binder6(member_type m,C *o) :
652 member(m),
653 object(o)
654 {
655 }
656 void operator()(std::string p1,std::string p2,std::string p3,std::string p4,std::string p5,std::string p6) const
657 {
658 page_guard<C> guard(object);
659 (object->*member)(p1,p2,p3,p4,p5,p6);
660 }
661 };
662
663
664
665 template<typename T>
666 static bool parse(application &app,util::const_char_istream &p,booster::cmatch const &m,int group,T &v)
667 {
668 if(!validate_encoding(app,m[group].first,m[group].second))
669 return false;
670 p.range(m[group].first,m[group].second);
671 return parse_url_parameter(p,v);
672 }
673
674
675 template<typename F>
676 struct url_binder;
677
678
679 #define CPPCMS_DEFANDPARSE(N) typename booster::remove_const_reference<P##N>::type p##N; \
680 if(!parse(app,s,m,g##N,p##N)) return false;
681
682 #define CPPCMS_DEFANDPARSE2(N1,N2) CPPCMS_DEFANDPARSE(N1) CPPCMS_DEFANDPARSE(N2)
683 #define CPPCMS_DEFANDPARSE3(N1,N2,N3) CPPCMS_DEFANDPARSE(N1) CPPCMS_DEFANDPARSE2(N2,N3)
684 #define CPPCMS_DEFANDPARSE4(N1,N2,N3,N4) CPPCMS_DEFANDPARSE2(N1,N2) CPPCMS_DEFANDPARSE2(N3,N4)
685 #define CPPCMS_DEFANDPARSE5(N1,N2,N3,N4,N5) CPPCMS_DEFANDPARSE2(N1,N2) CPPCMS_DEFANDPARSE3(N3,N4,N5)
686
687
688
689 #define CPPCMS_URLBINDER \
690 private: \
691 template<typename C CPPCMS_URLBINDER_PRD CPPCMS_URLBINDER_TPAR> \
692 struct url_binder<void (C::*)(CPPCMS_URLBINDER_MPAR)> { \
693 typedef void (C::*member_type)(CPPCMS_URLBINDER_MPAR); \
694 member_type member; C *self; \
695 CPPCMS_URLBINDER_GPAR \
696 url_binder( \
697 member_type m,C *s CPPCMS_URLBINDER_PRD \
698 CPPCMS_URLBINDER_IPAR \
699 ) : member(m), \
700 self(s) CPPCMS_URLBINDER_PRD \
701 CPPCMS_URLBINDER_CPAR \
702 {} \
703 bool operator()(application &CPPCMS_URLBINDER_P1,booster::cmatch const &CPPCMS_URLBINDER_P2) { \
704 CPPCMS_URLBINDER_INIT CPPCMS_URLBINDER_PARSE \
705 page_guard<C> guard(self); \
706 (self->*member)(CPPCMS_URLBINDER_PPAR); \
707 return true; \
708 } \
709 }; \
710 public: \
711 template<typename C CPPCMS_URLBINDER_PRD CPPCMS_URLBINDER_TPAR> \
712 void map(std::string const &me,std::string const &re, \
713 void (C::*mb)(CPPCMS_URLBINDER_MPAR),C *app CPPCMS_URLBINDER_PRD \
714 CPPCMS_URLBINDER_IPAR) \
715 { \
716 typedef url_binder<void(C::*)(CPPCMS_URLBINDER_MPAR)> btype; \
717 map_generic(me,re,btype(mb,app CPPCMS_URLBINDER_PRD CPPCMS_URLBINDER_PPAR)); \
718 } \
719 template<typename C CPPCMS_URLBINDER_PRD CPPCMS_URLBINDER_TPAR> \
720 void map(std::string const &re, \
721 void (C::*mb)(CPPCMS_URLBINDER_MPAR),C *app CPPCMS_URLBINDER_PRD \
722 CPPCMS_URLBINDER_IPAR) \
723 { \
724 typedef url_binder<void (C::*)(CPPCMS_URLBINDER_MPAR)> btype; \
725 map_generic(re,btype(mb,app CPPCMS_URLBINDER_PRD CPPCMS_URLBINDER_PPAR)); \
726 } \
727 template<typename C CPPCMS_URLBINDER_PRD CPPCMS_URLBINDER_TPAR> \
728 void map(std::string const &me,booster::regex const &re, \
729 void (C::*mb)(CPPCMS_URLBINDER_MPAR),C *app CPPCMS_URLBINDER_PRD \
730 CPPCMS_URLBINDER_IPAR) \
731 { \
732 typedef url_binder<void (C::*)(CPPCMS_URLBINDER_MPAR)> btype; \
733 map_generic(me,re,btype(mb,app CPPCMS_URLBINDER_PRD CPPCMS_URLBINDER_PPAR)); \
734 } \
735 template<typename C CPPCMS_URLBINDER_PRD CPPCMS_URLBINDER_TPAR> \
736 void map(booster::regex const &re, \
737 void (C::*mb)(CPPCMS_URLBINDER_MPAR),C *app CPPCMS_URLBINDER_PRD \
738 CPPCMS_URLBINDER_IPAR) \
739 { \
740 typedef url_binder<void (C::*)(CPPCMS_URLBINDER_MPAR)> btype; \
741 map_generic(re,btype(mb,app CPPCMS_URLBINDER_PRD CPPCMS_URLBINDER_PPAR)); \
742 } \
743 private:
744
745
746 #define CPPCMS_URLBINDER_PRD
747 #define CPPCMS_URLBINDER_INIT
748 #define CPPCMS_URLBINDER_TPAR
749 #define CPPCMS_URLBINDER_MPAR
750 #define CPPCMS_URLBINDER_PPAR
751 #define CPPCMS_URLBINDER_GPAR
752 #define CPPCMS_URLBINDER_IPAR
753 #define CPPCMS_URLBINDER_CPAR
754 #define CPPCMS_URLBINDER_PARSE
755 #define CPPCMS_URLBINDER_P1
756 #define CPPCMS_URLBINDER_P2
757
758 CPPCMS_URLBINDER
759
760 #undef CPPCMS_URLBINDER_TPAR
761 #undef CPPCMS_URLBINDER_MPAR
762 #undef CPPCMS_URLBINDER_PPAR
763 #undef CPPCMS_URLBINDER_GPAR
764 #undef CPPCMS_URLBINDER_IPAR
765 #undef CPPCMS_URLBINDER_CPAR
766 #undef CPPCMS_URLBINDER_PARSE
767
768 #undef CPPCMS_URLBINDER_INIT
769 #undef CPPCMS_URLBINDER_PRD
770 #undef CPPCMS_URLBINDER_P1
771 #undef CPPCMS_URLBINDER_P2
772
773
774 #define CPPCMS_URLBINDER_PRD ,
775 #define CPPCMS_URLBINDER_INIT util::const_char_istream s; setup_stream(app,s);
776 #define CPPCMS_URLBINDER_P1 app
777 #define CPPCMS_URLBINDER_P2 m
778
779 #define CPPCMS_URLBINDER_TPAR typename P1
780 #define CPPCMS_URLBINDER_MPAR P1
781 #define CPPCMS_URLBINDER_PPAR p1
782 #define CPPCMS_URLBINDER_GPAR int g1;
783 #define CPPCMS_URLBINDER_IPAR int p1
784 #define CPPCMS_URLBINDER_CPAR g1(p1)
785 #define CPPCMS_URLBINDER_PARSE CPPCMS_DEFANDPARSE(1)
786
787 CPPCMS_URLBINDER
788
789 #undef CPPCMS_URLBINDER_TPAR
790 #undef CPPCMS_URLBINDER_MPAR
791 #undef CPPCMS_URLBINDER_PPAR
792 #undef CPPCMS_URLBINDER_GPAR
793 #undef CPPCMS_URLBINDER_IPAR
794 #undef CPPCMS_URLBINDER_CPAR
795 #undef CPPCMS_URLBINDER_PARSE
796
797
798 #define CPPCMS_URLBINDER_TPAR typename P1,typename P2
799 #define CPPCMS_URLBINDER_MPAR P1,P2
800 #define CPPCMS_URLBINDER_PPAR p1,p2
801 #define CPPCMS_URLBINDER_GPAR int g1,g2;
802 #define CPPCMS_URLBINDER_IPAR int p1,int p2
803 #define CPPCMS_URLBINDER_CPAR g1(p1),g2(p2)
804 #define CPPCMS_URLBINDER_PARSE CPPCMS_DEFANDPARSE2(1,2)
805
806 CPPCMS_URLBINDER
807
808 #undef CPPCMS_URLBINDER_TPAR
809 #undef CPPCMS_URLBINDER_MPAR
810 #undef CPPCMS_URLBINDER_PPAR
811 #undef CPPCMS_URLBINDER_GPAR
812 #undef CPPCMS_URLBINDER_IPAR
813 #undef CPPCMS_URLBINDER_CPAR
814 #undef CPPCMS_URLBINDER_PARSE
815
816
817 #define CPPCMS_URLBINDER_TPAR typename P1,typename P2,typename P3
818 #define CPPCMS_URLBINDER_MPAR P1,P2,P3
819 #define CPPCMS_URLBINDER_PPAR p1,p2,p3
820 #define CPPCMS_URLBINDER_GPAR int g1,g2,g3;
821 #define CPPCMS_URLBINDER_IPAR int p1,int p2,int p3
822 #define CPPCMS_URLBINDER_CPAR g1(p1),g2(p2),g3(p3)
823 #define CPPCMS_URLBINDER_PARSE CPPCMS_DEFANDPARSE3(1,2,3)
824
825 CPPCMS_URLBINDER
826
827 #undef CPPCMS_URLBINDER_TPAR
828 #undef CPPCMS_URLBINDER_MPAR
829 #undef CPPCMS_URLBINDER_PPAR
830 #undef CPPCMS_URLBINDER_GPAR
831 #undef CPPCMS_URLBINDER_IPAR
832 #undef CPPCMS_URLBINDER_CPAR
833 #undef CPPCMS_URLBINDER_PARSE
834
835
836 #define CPPCMS_URLBINDER_TPAR typename P1,typename P2,typename P3,typename P4
837 #define CPPCMS_URLBINDER_MPAR P1,P2,P3,P4
838 #define CPPCMS_URLBINDER_PPAR p1,p2,p3,p4
839 #define CPPCMS_URLBINDER_GPAR int g1,g2,g3,g4;
840 #define CPPCMS_URLBINDER_IPAR int p1,int p2,int p3,int p4
841 #define CPPCMS_URLBINDER_CPAR g1(p1),g2(p2),g3(p3),g4(p4)
842 #define CPPCMS_URLBINDER_PARSE CPPCMS_DEFANDPARSE4(1,2,3,4)
843
844 CPPCMS_URLBINDER
845
846 #undef CPPCMS_URLBINDER_TPAR
847 #undef CPPCMS_URLBINDER_MPAR
848 #undef CPPCMS_URLBINDER_PPAR
849 #undef CPPCMS_URLBINDER_GPAR
850 #undef CPPCMS_URLBINDER_IPAR
851 #undef CPPCMS_URLBINDER_CPAR
852 #undef CPPCMS_URLBINDER_PARSE
853
854
855 #define CPPCMS_URLBINDER_TPAR typename P1,typename P2,typename P3,typename P4,typename P5
856 #define CPPCMS_URLBINDER_MPAR P1,P2,P3,P4,P5
857 #define CPPCMS_URLBINDER_PPAR p1,p2,p3,p4,p5
858 #define CPPCMS_URLBINDER_GPAR int g1,g2,g3,g4,g5;
859 #define CPPCMS_URLBINDER_IPAR int p1,int p2,int p3,int p4,int p5
860 #define CPPCMS_URLBINDER_CPAR g1(p1),g2(p2),g3(p3),g4(p4),g5(p5)
861 #define CPPCMS_URLBINDER_PARSE CPPCMS_DEFANDPARSE5(1,2,3,4,5)
862
863 CPPCMS_URLBINDER
864
865 #undef CPPCMS_URLBINDER_TPAR
866 #undef CPPCMS_URLBINDER_MPAR
867 #undef CPPCMS_URLBINDER_PPAR
868 #undef CPPCMS_URLBINDER_GPAR
869 #undef CPPCMS_URLBINDER_IPAR
870 #undef CPPCMS_URLBINDER_CPAR
871 #undef CPPCMS_URLBINDER_PARSE
872
873
874 #define CPPCMS_URLBINDER_TPAR typename P1,typename P2,typename P3,typename P4,typename P5,typename P6
875 #define CPPCMS_URLBINDER_MPAR P1,P2,P3,P4,P5,P6
876 #define CPPCMS_URLBINDER_PPAR p1,p2,p3,p4,p5,p6
877 #define CPPCMS_URLBINDER_GPAR int g1,g2,g3,g4,g5,g6;
878 #define CPPCMS_URLBINDER_IPAR int p1,int p2,int p3,int p4,int p5,int p6
879 #define CPPCMS_URLBINDER_CPAR g1(p1),g2(p2),g3(p3),g4(p4),g5(p5),g6(p6)
880 #define CPPCMS_URLBINDER_PARSE CPPCMS_DEFANDPARSE5(1,2,3,4,5) CPPCMS_DEFANDPARSE(6)
881
882 CPPCMS_URLBINDER
883
884 #undef CPPCMS_URLBINDER_TPAR
885 #undef CPPCMS_URLBINDER_MPAR
886 #undef CPPCMS_URLBINDER_PPAR
887 #undef CPPCMS_URLBINDER_GPAR
888 #undef CPPCMS_URLBINDER_IPAR
889 #undef CPPCMS_URLBINDER_CPAR
890 #undef CPPCMS_URLBINDER_PARSE
891
892 #define CPPCMS_URLBINDER_TPAR typename P1,typename P2,typename P3,typename P4,typename P5,typename P6,typename P7
893 #define CPPCMS_URLBINDER_MPAR P1,P2,P3,P4,P5,P6,P7
894 #define CPPCMS_URLBINDER_PPAR p1,p2,p3,p4,p5,p6,p7
895 #define CPPCMS_URLBINDER_GPAR int g1,g2,g3,g4,g5,g6,g7;
896 #define CPPCMS_URLBINDER_IPAR int p1,int p2,int p3,int p4,int p5,int p6,int p7
897 #define CPPCMS_URLBINDER_CPAR g1(p1),g2(p2),g3(p3),g4(p4),g5(p5),g6(p6),g7(p7)
898 #define CPPCMS_URLBINDER_PARSE CPPCMS_DEFANDPARSE5(1,2,3,4,5) CPPCMS_DEFANDPARSE2(6,7)
899
900 CPPCMS_URLBINDER
901
902 #undef CPPCMS_URLBINDER_TPAR
903 #undef CPPCMS_URLBINDER_MPAR
904 #undef CPPCMS_URLBINDER_PPAR
905 #undef CPPCMS_URLBINDER_GPAR
906 #undef CPPCMS_URLBINDER_IPAR
907 #undef CPPCMS_URLBINDER_CPAR
908 #undef CPPCMS_URLBINDER_PARSE
909
910 #define CPPCMS_URLBINDER_TPAR typename P1,typename P2,typename P3,typename P4,typename P5,typename P6,typename P7,typename P8
911 #define CPPCMS_URLBINDER_MPAR P1,P2,P3,P4,P5,P6,P7,P8
912 #define CPPCMS_URLBINDER_PPAR p1,p2,p3,p4,p5,p6,p7,p8
913 #define CPPCMS_URLBINDER_GPAR int g1,g2,g3,g4,g5,g6,g7,g8;
914 #define CPPCMS_URLBINDER_IPAR int p1,int p2,int p3,int p4,int p5,int p6,int p7,int p8
915 #define CPPCMS_URLBINDER_CPAR g1(p1),g2(p2),g3(p3),g4(p4),g5(p5),g6(p6),g7(p7),g8(p8)
916 #define CPPCMS_URLBINDER_PARSE CPPCMS_DEFANDPARSE5(1,2,3,4,5) CPPCMS_DEFANDPARSE3(6,7,8)
917
918 CPPCMS_URLBINDER
919
920 #undef CPPCMS_URLBINDER_TPAR
921 #undef CPPCMS_URLBINDER_MPAR
922 #undef CPPCMS_URLBINDER_PPAR
923 #undef CPPCMS_URLBINDER_GPAR
924 #undef CPPCMS_URLBINDER_IPAR
925 #undef CPPCMS_URLBINDER_CPAR
926 #undef CPPCMS_URLBINDER_PARSE
927
928 #undef CPPCMS_URLBINDER
929 #undef CPPCMS_URLBINDER_INIT
930 #undef CPPCMS_URLBINDER_PRD
931 #undef CPPCMS_URLBINDER_P1
932 #undef CPPCMS_URLBINDER_P2
933
934 struct _data;
935 booster::hold_ptr<_data> d;
936 };
937
938 } // cppcms
939
940 #endif
booster::regex
This is a simple wrapper of PCRE library.
Definition: perl_regex.h:35
cppcms::url_dispatcher::assign
void assign(std::string const &regex, void(C::*member)(std::string, std::string, std::string), C *object, int e1, int e2, int e3)
Definition: url_dispatcher.h:434
cppcms::util::const_char_istream::range
void range(char const *begin, char const *end)
Definition: steal_buf.h:106
cppcms::util::const_char_istream::end
char const * end() const
Definition: steal_buf.h:99
cppcms::url_dispatcher::assign
void assign(std::string const &regex, void(C::*member)(std::string, std::string, std::string, std::string), C *object, int e1, int e2, int e3, int e4)
Definition: url_dispatcher.h:446
booster::hold_ptr< _data >
cppcms::util::const_char_istream
Definition: steal_buf.h:72
cppcms::url_dispatcher::generic_handler
booster::function< bool(cppcms::application &, booster::cmatch const &)> generic_handler
RESTful API Handler that validates parameters and executes a method.
Definition: url_dispatcher.h:109
cppcms::url_dispatcher::assign
void assign(std::string const &regex, void(C::*member)(std::string, std::string), C *object, int e1, int e2)
Definition: url_dispatcher.h:422
booster::match_results
The object that hold the result of matching a regular expression against the text using regex_match a...
Definition: regex_match.h:110
cppcms::url_dispatcher::assign
void assign(std::string const &regex, void(C::*member)(std::string), C *object, int e1)
Definition: url_dispatcher.h:410
cppcms::url_dispatcher::assign_generic
void assign_generic(std::string const &regex, void(C::*member)(booster::cmatch const &), C *object)
Definition: url_dispatcher.h:398
cppcms::url_dispatcher::assign
void assign(std::string const &regex, void(C::*member)(std::string, std::string, std::string, std::string, std::string, std::string), C *object, int e1, int e2, int e3, int e4, int e5, int e6)
Definition: url_dispatcher.h:472
cppcms
This is the namespace where all CppCMS functionality is placed.
Definition: application.h:19
cppcms::application::clear
virtual void clear()
cppcms::url_dispatcher::assign
void assign(std::string const &regex, void(C::*member)(), C *object)
Definition: url_dispatcher.h:385
cppcms::url_dispatcher::assign
void assign(std::string const &regex, void(C::*member)(std::string, std::string, std::string, std::string, std::string), C *object, int e1, int e2, int e3, int e4, int e5)
Definition: url_dispatcher.h:459
booster::function
Definition: function.h:16
cppcms::application
application class is the base class for all user created applications.
Definition: application.h:82
cppcms::url_dispatcher
This class is used to glue between member function of application class and urls. ...
Definition: url_dispatcher.h:101
cppcms::util::const_char_istream::begin
char const * begin() const
Definition: steal_buf.h:92
booster::noncopyable
This class makes impossible to copy any class derived from this one.
Definition: noncopyable.h:15
cppcms::parse_url_parameter
bool parse_url_parameter(util::const_char_istream &parameter, std::string &output)
Definition: url_dispatcher.h:30