ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

fadapter.h
Go to the documentation of this file.
00001 #ifndef _fadapter_h_
00002 #define _fadapter_h_
00003 
00004 #include <functional>
00005 
00006 // used as adaptor's return/argument type,
00007 // to allow binders/composers usage
00008 struct __void_tag {};
00009 
00010 #if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
00011 using std::unary_function;
00012 #endif
00013 
00014 template <class Result>
00015 class pointer_to_void_function {
00016 protected:
00017   Result (*ptr)();
00018 public:
00019   explicit pointer_to_void_function(Result (*x)()) : ptr(x) {}
00020   Result operator()() const { return ptr(); }
00021   Result operator()(__void_tag) const { return ptr(); }
00022 };
00023 
00024 // to feed composers
00025 template <class Arg1>
00026 struct projectvoid : public unary_function<Arg1,__void_tag> {
00027   __void_tag operator()(const Arg1& x) const { return __void_tag(); }
00028 };
00029 
00030 #if !defined (_STLP_MEMBER_POINTER_PARAM_BUG)
00031 
00032 template <class Result>
00033 pointer_to_void_function<Result> ptr_fun(Result (*x)()) {
00034   return pointer_to_void_function<Result>(x);
00035 }
00036 
00037 // alternate name
00038 template <class Result>
00039 pointer_to_void_function<Result> ptr_gen(Result (*x)()) {
00040   return pointer_to_void_function<Result>(x);
00041 }
00042 
00043 #endif /*  !defined (_STLP_MEMBER_POINTER_PARAM_BUG) */
00044 
00045 template <class Arg>
00046 class pointer_to_unary_procedure /* :public unary_function<Arg, __void_tag> */ {
00047 protected:
00048   typedef void (*fun_type)(Arg);
00049   fun_type ptr;
00050 public:
00051   typedef Arg argument_type;
00052   pointer_to_unary_procedure() {}
00053   pointer_to_unary_procedure(fun_type x) : ptr(x) {}
00054   void operator() (Arg x) const { ptr(x); }
00055 };
00056 
00057 template <class Arg>
00058 inline pointer_to_unary_procedure<Arg> ptr_proc(void (*x)(Arg)) {
00059   return pointer_to_unary_procedure<Arg>(x);
00060 }
00061 
00062 template <class Arg1, class Arg2>
00063 class pointer_to_binary_procedure /* : public unary_function<Arg1, Arg2, __void_tag> */ {
00064 protected:
00065   typedef void (*fun_type)(Arg1, Arg2);
00066   fun_type ptr;
00067 public:
00068   typedef Arg1 first_argument_type;
00069   typedef Arg2 second_argument_type;
00070   pointer_to_binary_procedure() {}
00071   pointer_to_binary_procedure(fun_type x) : ptr(x) {}
00072   void operator() (Arg1 x, Arg2 y) const { ptr(x, y); }
00073 };
00074 
00075 template <class Arg1, class Arg2>
00076 inline pointer_to_binary_procedure<Arg1, Arg2> ptr_proc(void (*x)(Arg1, Arg2)) {
00077   return pointer_to_binary_procedure<Arg1, Arg2>(x);
00078 }
00079 
00080 #endif

Generated on Mon May 28 2012 04:35:11 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.