00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00061 #ifndef STLSOFT_INCL_STLSOFT_PROPERTIES_HPP_METHOD_PROPERTIES
00062 #define STLSOFT_INCL_STLSOFT_PROPERTIES_HPP_METHOD_PROPERTIES
00063
00064 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00065 # define STLSOFT_VER_STLSOFT_PROPERTIES_HPP_METHOD_PROPERTIES_MAJOR 4
00066 # define STLSOFT_VER_STLSOFT_PROPERTIES_HPP_METHOD_PROPERTIES_MINOR 0
00067 # define STLSOFT_VER_STLSOFT_PROPERTIES_HPP_METHOD_PROPERTIES_REVISION 3
00068 # define STLSOFT_VER_STLSOFT_PROPERTIES_HPP_METHOD_PROPERTIES_EDIT 57
00069 #endif
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087 #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
00088 # include <stlsoft/stlsoft.h>
00089 #endif
00090
00091 #if defined(STLSOFT_COMPILER_IS_MSVC) && \
00092 _MSC_VER < 1200
00093 # error stlsoft/properties/method_properties.hpp is not compatible with Visual C++ 5.0 or earlier
00094 #endif
00095
00096
00097
00098
00099
00100
00101
00102
00103 #if defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00104 # define STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00105 #endif
00106
00107
00108 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00109
00110 #elif ( defined(STLSOFT_COMPILER_IS_MSVC) && \
00111 _MSC_VER < 1200)
00112 # error Compiler is not compatible with method properties
00113 #endif
00114
00115
00116
00117
00118
00119 #ifndef _STLSOFT_NO_NAMESPACE
00120 namespace stlsoft
00121 {
00122 #endif
00123
00124
00125
00126
00127
00128 #define STLSOFT_METHOD_PROPERTY_OFFSET_NAME(C, P) \
00129 \
00130 P##_prop_offset_##C
00131
00132
00141 #define STLSOFT_METHOD_PROPERTY_DEFINE_OFFSET(C, P) \
00142 \
00143 static stlsoft_ns_qual(ss_ptrdiff_t) STLSOFT_METHOD_PROPERTY_OFFSET_NAME(C, P)() \
00144 { \
00145 return STLSOFT_RAW_OFFSETOF(C, P); \
00146 }
00147
00148
00162 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00163
00164 # define STLSOFT_METHOD_PROPERTY_GET(V, R, C, GM, P) \
00165 \
00166 STLSOFT_METHOD_PROPERTY_DEFINE_OFFSET(C, P) \
00167 \
00168 stlsoft_ns_qual(method_property_get)< V \
00169 , R \
00170 , C \
00171 , &C::STLSOFT_METHOD_PROPERTY_OFFSET_NAME(C, P) \
00172 , &C::GM \
00173 > P
00174
00175 #else
00176
00177 # define STLSOFT_METHOD_PROPERTY_GET(V, R, C, GM, P) \
00178 \
00179 STLSOFT_METHOD_PROPERTY_DEFINE_OFFSET(C, P) \
00180 \
00181 stlsoft_ns_qual(method_property_get)< V \
00182 , R \
00183 , C \
00184 , &C::STLSOFT_METHOD_PROPERTY_OFFSET_NAME(C, P) \
00185 > P
00186
00187 #endif
00188
00189
00190
00204 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00205
00206 # define STLSOFT_METHOD_PROPERTY_SET(V, R, C, SM, P) \
00207 \
00208 STLSOFT_METHOD_PROPERTY_DEFINE_OFFSET(C, P) \
00209 \
00210 stlsoft_ns_qual(method_property_set)< V \
00211 , R \
00212 , C \
00213 , &C::STLSOFT_METHOD_PROPERTY_OFFSET_NAME(C, P) \
00214 , &C::SM \
00215 > P
00216
00217 #else
00218
00219 #endif
00220
00221
00222
00238 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00239
00240 # define STLSOFT_METHOD_PROPERTY_GETSET(V, RG, RS, C, GM, SM, P) \
00241 \
00242 STLSOFT_METHOD_PROPERTY_DEFINE_OFFSET(C, P) \
00243 \
00244 stlsoft_ns_qual(method_property_getset)< V \
00245 , RG \
00246 , RS \
00247 , C \
00248 , &C::STLSOFT_METHOD_PROPERTY_OFFSET_NAME(C, P) \
00249 , &C::GM \
00250 , &C::SM \
00251 > P
00252
00253 #else
00254
00255 # define STLSOFT_METHOD_PROPERTY_GETSET(V, RG, RS, C, GM, SM, P) \
00256 \
00257 STLSOFT_METHOD_PROPERTY_DEFINE_OFFSET(C, P) \
00258 \
00259 stlsoft_ns_qual(method_property_getset)< V \
00260 , RG \
00261 , RS \
00262 , C \
00263 , &C::STLSOFT_METHOD_PROPERTY_OFFSET_NAME(C, P) \
00264 > P
00265
00266 #endif
00267
00268
00269
00282 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00283
00284 # define STLSOFT_METHOD_PROPERTY_GET_EXTERNAL_PROP(R, C, GM, P) \
00285 \
00286 stlsoft_ns_qual(method_property_get_external)< R \
00287 , C \
00288 , &C::STLSOFT_METHOD_PROPERTY_OFFSET_NAME(C, P) \
00289 , &C::GM \
00290 > P
00291
00292 # define STLSOFT_METHOD_PROPERTY_GET_EXTERNAL(R, C, GM, P) \
00293 \
00294 STLSOFT_METHOD_PROPERTY_DEFINE_OFFSET(C, P) \
00295 STLSOFT_METHOD_PROPERTY_GET_EXTERNAL_PROP(R, C, GM, P)
00296
00297 #else
00298
00299 # define STLSOFT_METHOD_PROPERTY_GET_EXTERNAL(R, C, GM, P) \
00300 \
00301 STLSOFT_METHOD_PROPERTY_DEFINE_OFFSET(C, P) \
00302 \
00303 stlsoft_ns_qual(method_property_get_external)< R \
00304 , C \
00305 , &C::STLSOFT_METHOD_PROPERTY_OFFSET_NAME(C, P) \
00306 > P
00307
00308 #endif
00309
00310
00311
00324 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00325
00326 # define STLSOFT_METHOD_PROPERTY_SET_EXTERNAL_PROP(R, C, SM, P) \
00327 \
00328 stlsoft_ns_qual(method_property_set_external)< R \
00329 , C \
00330 , &C::STLSOFT_METHOD_PROPERTY_OFFSET_NAME(C, P) \
00331 , &C::SM \
00332 > P
00333
00334 # define STLSOFT_METHOD_PROPERTY_SET_EXTERNAL(R, C, SM, P) \
00335 \
00336 STLSOFT_METHOD_PROPERTY_DEFINE_OFFSET(C, P) \
00337 STLSOFT_METHOD_PROPERTY_SET_EXTERNAL_PROP(R, C, SM, P)
00338
00339 #else
00340
00341 #endif
00342
00343
00344
00359 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00360
00361 # define STLSOFT_METHOD_PROPERTY_GETSET_EXTERNAL_PROP(RG, RS, C, GM, SM, P) \
00362 \
00363 stlsoft_ns_qual(method_property_getset_external)< RG \
00364 , RS \
00365 , C \
00366 , &C::STLSOFT_METHOD_PROPERTY_OFFSET_NAME(C, P) \
00367 , &C::GM \
00368 , &C::SM \
00369 > P
00370
00371 # define STLSOFT_METHOD_PROPERTY_GETSET_EXTERNAL(RG, RS, C, GM, SM, P) \
00372 \
00373 STLSOFT_METHOD_PROPERTY_DEFINE_OFFSET(C, P) \
00374 STLSOFT_METHOD_PROPERTY_GETSET_EXTERNAL_PROP(RG, RS, C, GM, SM, P)
00375
00376 #else
00377
00378 #endif
00379
00380
00381
00382
00383
00384
00385
00386
00387 struct property_tag
00388 {};
00389
00390 struct internal_property_tag
00391 : public property_tag
00392 {
00393 enum { is_internal = 1 };
00394 enum { is_external = 0 };
00395 };
00396
00397 struct external_property_tag
00398 : public property_tag
00399 {
00400 enum { is_internal = 0 };
00401 enum { is_external = 1 };
00402 };
00403
00406 template< int R
00407 , int W
00408 , int S
00409 >
00410 struct internal_property
00411 : public internal_property_tag
00412 {
00413 enum { is_read = R };
00414 enum { is_write = W };
00415 enum { is_static = S };
00416 };
00417
00420 template< int R
00421 , int W
00422 , int S
00423 >
00424 struct external_property
00425 : public external_property_tag
00426 {
00427 enum { is_read = R };
00428 enum { is_write = W };
00429 enum { is_static = S };
00430 };
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00446 template< ss_typename_param_k T
00447 , ss_typename_param_k R
00448 , ss_typename_param_k C
00449 >
00450 struct member_get_pointer
00451 {
00452 private:
00453 member_get_pointer(R (C::*pfn)() const)
00454 {
00455 function(pfn, NULL, NULL);
00456 }
00457
00458 STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND(T);
00459
00460 static R get(C *pC)
00461 {
00462 R r;
00463
00464 function(NULL, pC, &r);
00465
00466 return r;
00467 }
00468
00469 private:
00470 static void function(R (C::*pfn)() const , C *pC, R *pR)
00471 {
00472 static R (C::*s_pfn)() const = pfn;
00473
00474 STLSOFT_MESSAGE_ASSERT("member_get_pointer called before being initialised!", NULL != s_pfn);
00475
00476 if(NULL != pC)
00477 {
00478 *pR = (pC->*s_pfn)();
00479 }
00480 }
00481 };
00482
00483
00489 template< ss_typename_param_k T
00490 , ss_typename_param_k R
00491 , ss_typename_param_k C
00492 >
00493 struct member_set_pointer
00494 {
00495 private:
00496 member_set_pointer(void (C::*pfn)(R ))
00497 {
00498 function(pfn, NULL, NULL);
00499 }
00500
00501 STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND(T);
00502
00503 static void set(C *pC, R *pR)
00504 {
00505 function(NULL, pC, pR);
00506 }
00507
00508 private:
00509 static void function(void (C::*pfn)(R ) , C *pC, R *pR)
00510 {
00511 static void (C::*s_pfn)(R ) = pfn;
00512
00513 STLSOFT_MESSAGE_ASSERT("member_set_pointer called before being initialised!", NULL != s_pfn);
00514
00515 if(NULL != pC)
00516 {
00517 (pC->*s_pfn)(*pR);
00518 }
00519 }
00520 };
00521
00531 template< ss_typename_param_k V
00532 , ss_typename_param_k R
00533 , ss_typename_param_k C
00534 , ss_ptrdiff_t (*PFnOff)()
00535 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00536 , R (C::*PFnGet)() const
00537 #endif
00538 >
00539 class method_property_get
00540 : public internal_property<1, 0, 0>
00541 {
00544 public:
00545 typedef V value_type;
00546 typedef R reference_type;
00547 typedef C container_type;
00548 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00549 typedef method_property_get<V, R, C, PFnOff, PFnGet> class_type;
00550 #else
00551 typedef method_property_get<V, R, C, PFnOff> class_type;
00552 typedef member_get_pointer<class_type, R, C> member_pointer_type;
00553 #endif
00554
00555 # if defined(STLSOFT_COMPILER_IS_DMC)
00557
00560 public:
00561 # else
00562 private:
00563 # endif
00564 method_property_get()
00565 {}
00566 private:
00567 ss_explicit_k method_property_get(reference_type value)
00568 : m_value(value)
00569 {}
00570
00571 #ifndef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00572 private:
00573 typedef member_pointer_type PFnGet;
00574
00575 private:
00576 method_property_get(reference_type (C::*pfn)() const)
00577 {
00578 PFnGet f(pfn);
00579 }
00580 #endif
00581
00582 STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND(C);
00584
00587 public:
00589 operator reference_type() const
00590 {
00591 ss_ptrdiff_t offset = (*PFnOff)();
00592 container_type *pC = (container_type*)((ss_byte_t*)this - offset);
00593
00594 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00595 return (pC->*PFnGet)();
00596 #else
00597 return PFnGet::get(pC);
00598 #endif
00599 }
00601
00604 private:
00605 value_type m_value;
00607
00610 private:
00615 class_type& operator =(reference_type value);
00617 };
00618
00619
00629 template< ss_typename_param_k V
00630 , ss_typename_param_k R
00631 , ss_typename_param_k C
00632 , ss_ptrdiff_t (*PFnOff)()
00633 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00634 , void (C::*PFnSet)(R )
00635 #endif
00636 >
00637 class method_property_set
00638 : public internal_property<0, 1, 0>
00639 {
00642 private:
00643 typedef V value_type;
00644 typedef R reference_type;
00645 typedef C container_type;
00646 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00647 typedef method_property_set<V, R, C, PFnOff, PFnSet> class_type;
00648 #else
00649 typedef method_property_set<V, R, C, PFnOff> class_type;
00650 typedef member_set_pointer<class_type, R, C> member_pointer_type;
00651 #endif
00653
00656 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00657 # if defined(STLSOFT_COMPILER_IS_DMC)
00658 public:
00659 # else
00660 private:
00661 # endif
00662 method_property_set()
00663 {}
00664
00665 private:
00666 ss_explicit_k method_property_set(reference_type value)
00667 : m_value(value)
00668 {}
00669 #else
00670
00671 private:
00672 typedef member_pointer_type PFnSet;
00673
00674 private:
00675 ss_explicit_k method_property_set(void (C::*pfn)(reference_type ))
00676 {
00677 PFnSet f(pfn);
00678 }
00679 method_property_set(void (C::*pfn)(reference_type ), reference_type value)
00680 : m_value(value)
00681 {
00682 PFnSet f(pfn);
00683 }
00684
00685 #endif
00686
00687 STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND(C);
00689
00692 public:
00694 class_type& operator =(reference_type value)
00695 {
00696 ss_ptrdiff_t offset = (*PFnOff)();
00697 container_type *pC = (container_type*)((ss_byte_t*)this - offset);
00698
00699 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00700 (pC->*PFnSet)(value);
00701 #else
00702 PFnSet::set(pC, &value);
00703 #endif
00704
00705 return *this;
00706 }
00708
00711 private:
00712 value_type m_value;
00714 };
00715
00716
00727 template< ss_typename_param_k V
00728 , ss_typename_param_k RG
00729 , ss_typename_param_k RS
00730 , ss_typename_param_k C
00731 , ss_ptrdiff_t (*PFnOff)()
00732 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00733 , RG (C::*PFnGet)() const
00734 , void (C::*PFnSet)(RS)
00735 #endif
00736 >
00737 class method_property_getset
00738 : public internal_property<1, 1, 0>
00739 {
00742 private:
00743 typedef V value_type;
00744 typedef RG get_reference_type;
00745 typedef RS set_reference_type;
00746 typedef C container_type;
00747 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00748 typedef method_property_getset<V, RG, RS, C, PFnOff, PFnGet, PFnSet> class_type;
00749 #else
00750 typedef method_property_getset<V, RG, RS, C, PFnOff> class_type;
00751 typedef member_get_pointer<class_type, RG, C> get_member_pointer_type;
00752 typedef member_set_pointer<class_type, RS, C> set_member_pointer_type;
00753 #endif
00755
00758 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00759 # if defined(STLSOFT_COMPILER_IS_DMC)
00760 public:
00761 # else
00762 private:
00763 # endif
00764 method_property_getset()
00765 {}
00766 private:
00767 ss_explicit_k method_property_getset(set_reference_type value)
00768 : m_value(value)
00769 {}
00770 #else
00771 private:
00772 typedef get_member_pointer_type PFnGet;
00773 typedef set_member_pointer_type PFnSet;
00774
00775 private:
00776 method_property_getset(get_reference_type (C::*pfnGet)() const, void (C::*pfnSet)(set_reference_type ))
00777 {
00778 PFnGet fg(pfnGet);
00779 PFnSet fs(pfnSet);
00780 }
00781 method_property_getset(get_reference_type (C::*pfnGet)() const, void (C::*pfnSet)(set_reference_type ), set_reference_type value)
00782 : m_value(value)
00783 {
00784 PFnGet fg(pfnGet);
00785 PFnSet fs(pfnSet);
00786 }
00787 #endif
00789
00790 STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND(C);
00791
00794 public:
00796 operator get_reference_type () const
00797 {
00798 ss_ptrdiff_t offset = (*PFnOff)();
00799 container_type *pC = (container_type*)((ss_byte_t*)this - offset);
00800
00801 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00802 return (pC->*PFnGet)();
00803 #else
00804 return PFnGet::get(pC);
00805 #endif
00806 }
00807
00809 class_type& operator =(set_reference_type value)
00810 {
00811 ss_ptrdiff_t offset = (*PFnOff)();
00812 container_type *pC = (container_type*)((ss_byte_t*)this - offset);
00813
00814 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00815 (pC->*PFnSet)(value);
00816 #else
00817 PFnSet::set(pC, &value);
00818 #endif
00819
00820 return *this;
00821 }
00823
00826 private:
00827 value_type m_value;
00829 };
00830
00831
00832
00833
00834
00844 template< ss_typename_param_k R
00845 , ss_typename_param_k C
00846 , ss_ptrdiff_t (*PFnOff)()
00847 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00848 , R (C::*PFnGet)() const
00849 #endif
00850 >
00851 class method_property_get_external
00852 : public external_property<1, 0, 0>
00853 {
00856 public:
00857 typedef R reference_type;
00858 typedef C container_type;
00859 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00860 typedef method_property_get_external<R, C, PFnOff, PFnGet> class_type;
00861 #else
00862 typedef method_property_get_external<R, C, PFnOff> class_type;
00863 typedef member_get_pointer<class_type, R, C> member_pointer_type;
00864 #endif
00865
00866 #ifndef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00868
00871 private:
00872 method_property_get_external(R (C::*pfn)() const)
00873 {
00874 PFnGet f(pfn);
00875 }
00876
00877 STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND(C);
00878
00879 private:
00880 typedef member_pointer_type PFnGet;
00881
00882 #endif
00884
00887 public:
00889 operator reference_type () const
00890 {
00891 ss_ptrdiff_t offset = (*PFnOff)();
00892 container_type *pC = (container_type*)((ss_byte_t*)this - offset);
00893
00894 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00895 return (pC->*PFnGet)();
00896 #else
00897 return PFnGet::get(pC);
00898 #endif
00899 }
00901
00904 private:
00909 class_type& operator =(reference_type value);
00911 };
00912
00913
00923 template< ss_typename_param_k R
00924 , ss_typename_param_k C
00925 , ss_ptrdiff_t (*PFnOff)()
00926 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00927 , void (C::*PFnSet)(R )
00928 #endif
00929 >
00930 class method_property_set_external
00931 : public external_property<0, 1, 0>
00932 {
00935 public:
00936 typedef R reference_type;
00937 typedef C container_type;
00938 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00939 typedef method_property_set_external<R, C, PFnOff, PFnSet> class_type;
00940 #else
00941 typedef method_property_set_external<R, C, PFnOff> class_type;
00942 typedef member_set_pointer<class_type, R, C> member_pointer_type;
00943 #endif
00944
00945 #ifndef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00947
00950 private:
00951 method_property_set_external(void (C::*pfn)(R ))
00952 {
00953 PFnSet f(pfn);
00954 }
00955
00956 STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND(C);
00957
00958 private:
00959 typedef member_pointer_type PFnSet;
00960
00961 #endif
00963
00966 public:
00968 method_property_set_external& operator =(reference_type value)
00969 {
00970 ss_ptrdiff_t offset = (*PFnOff)();
00971 container_type *pC = (container_type*)((ss_byte_t*)this - offset);
00972
00973 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
00974 (pC->*PFnSet)(value);
00975 #else
00976 PFnSet::set(pC, &value);
00977 #endif
00978
00979 return *this;
00980 }
00982 };
00983
00984
00985
00995 template< ss_typename_param_k RG
00996 , ss_typename_param_k RS
00997 , ss_typename_param_k C
00998 , ss_ptrdiff_t (*PFnOff)()
00999 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
01000 , RG (C::*PFnGet)() const
01001 , void (C::*PFnSet)(RS )
01002 #endif
01003 >
01004 class method_property_getset_external
01005 : public external_property<1, 1, 0>
01006 {
01009 public:
01010 typedef RG get_reference_type;
01011 typedef RS set_reference_type;
01012 typedef C container_type;
01013 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
01014 typedef method_property_getset_external<RG, RS, C, PFnOff, PFnGet, PFnSet> class_type;
01015 #else
01016 typedef method_property_getset_external<RG, RS, C, PFnOff> class_type;
01017 typedef member_get_pointer<class_type, RG, C> get_member_pointer_type;
01018 typedef member_set_pointer<class_type, RS, C> set_member_pointer_type;
01019 #endif
01020
01021
01022 #ifndef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
01024
01027 private:
01028 method_property_getset_external(get_reference_type (C::*pfnGet)() const, void (C::*pfnSet)(set_reference_type ))
01029 {
01030 PFnGet fg(pfnGet);
01031 PFnSet fs(pfnSet);
01032 }
01033
01034 STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND(C);
01035
01036 private:
01037 typedef get_member_pointer_type PFnGet;
01038 typedef set_member_pointer_type PFnSet;
01039
01040 #endif
01042
01045 public:
01047 operator get_reference_type () const
01048 {
01049 ss_ptrdiff_t offset = (*PFnOff)();
01050 container_type *pC = (container_type*)((ss_byte_t*)this - offset);
01051
01052 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
01053 return (pC->*PFnGet)();
01054 #else
01055 return PFnGet::get(pC);
01056 #endif
01057 }
01058
01060 class_type& operator =(set_reference_type value)
01061 {
01062 ss_ptrdiff_t offset = (*PFnOff)();
01063 container_type *pC = (container_type*)((ss_byte_t*)this - offset);
01064
01065 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
01066 (pC->*PFnSet)(value);
01067 #else
01068 PFnSet::set(pC, &value);
01069 #endif
01070
01071 return *this;
01072 }
01074 };
01075
01076
01077
01078
01079
01084 template< ss_typename_param_k V
01085 , ss_typename_param_k R
01086 , ss_typename_param_k C
01087 , R (*PFn)(void)
01088 >
01089 class static_method_property_get
01090 : public internal_property<1, 0, 1>
01091 {
01094 public:
01095 typedef V value_type;
01096 typedef R reference_type;
01097 typedef C container_type;
01098 typedef static_method_property_get<V, R, C, PFn> class_type;
01100
01103 public:
01104 static_method_property_get()
01105 {}
01106 ss_explicit_k static_method_property_get(reference_type value)
01107 : m_value(value)
01108 {}
01109
01110 STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND(C);
01112
01115 public:
01116 operator reference_type() const
01117 {
01118 return (*PFn)();
01119 }
01121
01124 private:
01125 value_type m_value;
01127
01130 private:
01135 class_type& operator =(reference_type value);
01137 };
01138
01143 template< ss_typename_param_k V
01144 , ss_typename_param_k R
01145 , ss_typename_param_k C
01146 , void (*PFn)(R )
01147 >
01148 class static_method_property_set
01149 : public internal_property<0, 1, 1>
01150 {
01153 public:
01154 typedef V value_type;
01155 typedef R reference_type;
01156 typedef C container_type;
01157 typedef static_method_property_set<V, R, C, PFn> class_type;
01159
01162 public:
01163 static_method_property_set()
01164 {}
01165 ss_explicit_k static_method_property_set(reference_type value)
01166 : m_value(value)
01167 {}
01168
01169 STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND(C);
01171
01174 public:
01175 static_method_property_set& operator =(reference_type value)
01176 {
01177 (*PFn)(value);
01178
01179 return *this;
01180 }
01182
01185 private:
01186 value_type m_value;
01188 };
01189
01194 template< ss_typename_param_k V
01195 , ss_typename_param_k RG
01196 , ss_typename_param_k RS
01197 , ss_typename_param_k C
01198 , RG (*PFnGet)(void)
01199 , void (*PFnSet)(RS )
01200 >
01201 class static_method_property_getset
01202 : public internal_property<1, 1, 1>
01203 {
01206 public:
01207 typedef V value_type;
01208 typedef RG get_reference_type;
01209 typedef RS set_reference_type;
01210 typedef C container_type;
01211 typedef static_method_property_getset<V, RG, RS, C, PFnGet, PFnSet> class_type;
01212
01213 STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND(C);
01215
01218 public:
01219 static_method_property_getset()
01220 {}
01221 ss_explicit_k static_method_property_getset(set_reference_type value)
01222 : m_value(value)
01223 {}
01225
01228 public:
01229 operator get_reference_type() const
01230 {
01231 return (*PFnGet)();
01232 }
01233 static_method_property_getset& operator =(set_reference_type value)
01234 {
01235 (*PFnSet)(value);
01236
01237 return *this;
01238 }
01240
01243 private:
01244 value_type m_value;
01246 };
01247
01248
01249
01250
01251
01256 template< ss_typename_param_k R
01257 , R (*PFn)(void)
01258 >
01259 class static_method_property_get_external
01260 : public external_property<1, 0, 1>
01261 {
01264 public:
01265 typedef R reference_type;
01266 typedef static_method_property_get_external<R, PFn> class_type;
01268
01271 public:
01272 #if !defined(STLSOFT_COMPILER_IS_MSVC) || \
01273 _MSC_VER > 1200
01274 operator reference_type() const
01275 {
01276 return (*PFn)();
01277 }
01278 #else
01279 operator R() const
01280 {
01281 R (*pfn)() = PFn;
01282
01283 return (*pfn)();
01284 }
01285 #endif
01287
01290 private:
01295 class_type& operator =(reference_type value);
01297 };
01298
01301 template< ss_typename_param_k R
01302 , void (*PFn)(R )
01303 >
01304 class static_method_property_set_external
01305 : public external_property<0, 1, 1>
01306 {
01309 public:
01310 typedef R reference_type;
01311 typedef static_method_property_set_external<R, PFn> class_type;
01313
01316 public:
01317 static_method_property_set_external& operator =(reference_type value)
01318 {
01319 (*PFn)(value);
01320
01321 return *this;
01322 }
01324 };
01325
01330 template< ss_typename_param_k RG
01331 , ss_typename_param_k RS
01332 , RG (*PFnGet)(void)
01333 , void (*PFnSet)(RS )
01334 >
01335 class static_method_property_getset_external
01336 : public external_property<1, 1, 1>
01337 {
01340 public:
01341 typedef RG get_reference_type;
01342 typedef RS set_reference_type;
01343 typedef static_method_property_getset_external<RG, RS, PFnGet, PFnSet> class_type;
01345
01348 public:
01349 operator get_reference_type() const
01350 {
01351 return (*PFnGet)();
01352 }
01353 static_method_property_getset_external& operator =(set_reference_type value)
01354 {
01355 (*PFnSet)(value);
01356
01357 return *this;
01358 }
01360 };
01361
01362
01363
01364
01365
01366
01367
01368 template< ss_typename_param_k V
01369 , ss_typename_param_k RG
01370 , ss_typename_param_k RS
01371 , ss_typename_param_k C
01372 , ss_ptrdiff_t (*PFnOff)()
01373 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
01374 , RG (C::*PFnGet)() const
01375 , void (C::*PFnSet)(RS)
01376 #endif
01377 , ss_typename_param_k S
01378 >
01379 inline S& operator <<( S& s
01380 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
01381 , method_property_getset<V, RG, RS, C, PFnOff, PFnGet, PFnSet> const& prop)
01382 #else
01383 , method_property_getset<V, RG, RS, C, PFnOff> const& prop)
01384 #endif
01385 {
01386 s << static_cast<RG>(prop);
01387
01388 return s;
01389 }
01390
01391
01392
01393 template< ss_typename_param_k V
01394 , ss_typename_param_k R
01395 , ss_typename_param_k C
01396 , ss_ptrdiff_t (*PFnOff)()
01397 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
01398 , R (C::*PFnGet)() const
01399 #endif
01400 , ss_typename_param_k S
01401 >
01402 inline S& operator <<( S& s
01403 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
01404 , method_property_get<V, R, C, PFnOff, PFnGet> const& prop)
01405 #else
01406 , method_property_get<V, R, C, PFnOff> const& prop)
01407 #endif
01408 {
01409 s << static_cast<R>(prop);
01410
01411 return s;
01412 }
01413
01414
01415
01416 template< ss_typename_param_k RG
01417 , ss_typename_param_k RS
01418 , ss_typename_param_k C
01419 , ss_ptrdiff_t (*PFnOff)()
01420 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
01421 , RG (C::*PFnGet)() const
01422 , void (C::*PFnSet)(RS )
01423 #endif
01424 , ss_typename_param_k S
01425 >
01426 inline S& operator <<( S& s
01427 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
01428 , method_property_getset_external<RG, RS, C, PFnOff, PFnGet, PFnSet> const& prop)
01429 #else
01430 , method_property_getset_external<RG, RS, C, PFnOff> const& prop)
01431 #endif
01432 {
01433 s << static_cast<RG>(prop);
01434
01435 return s;
01436 }
01437
01438
01439
01440 template< ss_typename_param_k R
01441 , ss_typename_param_k C
01442 , ss_ptrdiff_t (*PFnOff)()
01443 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
01444 , R (C::*PFnGet)() const
01445 #endif
01446 , ss_typename_param_k S
01447 >
01448 inline S& operator <<( S& s
01449 #ifdef STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
01450 , method_property_get_external<R, C, PFnOff, PFnGet> const& prop)
01451 #else
01452 , method_property_get_external<R, C, PFnOff> const& prop)
01453 #endif
01454 {
01455 s << static_cast<R>(prop);
01456
01457 return s;
01458 }
01459
01460
01461
01462 #ifndef _STLSOFT_NO_NAMESPACE
01463 }
01464 #endif
01465
01466
01467
01468 #endif
01469
01470