X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=ETL%2Ftrunk%2FETL%2F_handle.h;h=3f0750381096b766c0fd9f5708d491b66ab98308;hb=d15c4522466bedfbe61620c401becae0931854f5;hp=7eb711077ad633518cd5e68795702a4974e4c5f3;hpb=7da2edef94e87ba8ba1223198be96942b5829aaf;p=synfig.git diff --git a/ETL/trunk/ETL/_handle.h b/ETL/trunk/ETL/_handle.h index 7eb7110..3f07503 100644 --- a/ETL/trunk/ETL/_handle.h +++ b/ETL/trunk/ETL/_handle.h @@ -6,6 +6,7 @@ ** ** \legal ** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** Copyright (c) 2007 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -140,6 +141,9 @@ public: typedef int size_type; protected: +#ifdef _DEBUG +public: +#endif value_type *obj; //!< Pointer to object public: @@ -264,41 +268,29 @@ public: operator handle()const { return handle(static_cast(obj)); } - //! static_cast\<\> wrapper - template static - handle cast_static(const handle &x) - { return handle(static_cast(x.get())); } - + template static handle cast_static (const handle &x) { return handle(static_cast (x.get())); } //! dynamic_cast\<\> wrapper - template static - handle cast_dynamic(const handle &x) - { return handle(dynamic_cast(x.get())); } - + template static handle cast_dynamic (const handle &x) { return handle(dynamic_cast (x.get())); } //! const_cast\<\> wrapper - template static - handle cast_const(const handle &x) - { return handle(const_cast(x.get())); } - + template static handle cast_const (const handle &x) { return handle(const_cast (x.get())); } //! reinterpret_cast\<\> wrapper - template static - handle cast_reinterpret(const handle &x) - { return handle(reinterpret_cast(x.get())); } + template static handle cast_reinterpret(const handle &x) { return handle(reinterpret_cast(x.get())); } - template static handle cast_static(const loose_handle &x); - template static handle cast_dynamic(const loose_handle &x); - template static handle cast_const(const loose_handle &x); - template static handle cast_reinterpret(const loose_handle &x); + template static handle cast_static (const loose_handle &x); + template static handle cast_dynamic (const loose_handle &x); + template static handle cast_const (const loose_handle &x); + template static handle cast_reinterpret(const loose_handle &x); - template static handle cast_static(const rhandle &x); - template static handle cast_dynamic(const rhandle &x); - template static handle cast_const(const rhandle &x); - template static handle cast_reinterpret(const rhandle &x); + template static handle cast_static (const rhandle &x); + template static handle cast_dynamic (const rhandle &x); + template static handle cast_const (const rhandle &x); + template static handle cast_reinterpret(const rhandle &x); - template static handle cast_static(U* x); - template static handle cast_dynamic(U* x); - template static handle cast_const(U* x); - template static handle cast_reinterpret(U* x); + template static handle cast_static (U* x); + template static handle cast_dynamic (U* x); + template static handle cast_const (U* x); + template static handle cast_reinterpret(U* x); //! Returns pointer to the object that is being wrapped pointer get()const { return obj; } @@ -370,8 +362,8 @@ public: using handle::unique; using handle::operator bool; using handle::get; - using handle::operator *; - using handle::operator ->; + using handle::operator*; + using handle::operator->; /* operator const handle&()const @@ -623,11 +615,6 @@ public: }; // END of template class rhandle - - - - - // ======================================================================== /*! \class loose_handle _handle.h ETL/handle ** \brief Loose Object Handle @@ -648,6 +635,9 @@ public: typedef int size_type; protected: +#ifdef _DEBUG +public: +#endif value_type *obj; //!< Pointer to object public: @@ -763,141 +753,53 @@ public: bool unref() { if(obj && !obj->unref()){ obj=0; return false; } return true; } }; // END of template class loose_handle - - - -template template handle -handle::cast_static(const loose_handle &x) - { return handle(static_cast(x.get())); } - -template template handle -handle::cast_dynamic(const loose_handle &x) - { return handle(dynamic_cast(x.get())); } - -template template handle -handle::cast_const(const loose_handle &x) - { return handle(const_cast(x.get())); } - -template template handle -handle::cast_reinterpret(const loose_handle &x) - { return handle(reinterpret_cast(x.get())); } - - - -template template handle -handle::cast_static(const rhandle &x) - { return handle(static_cast(x.get())); } - -template template handle -handle::cast_dynamic(const rhandle &x) - { return handle(dynamic_cast(x.get())); } - -template template handle -handle::cast_const(const rhandle &x) - { return handle(const_cast(x.get())); } - -template template handle -handle::cast_reinterpret(const rhandle &x) - { return handle(reinterpret_cast(x.get())); } - - - -template template handle -handle::cast_static(U* x) - { return handle(static_cast(x)); } - -template template handle -handle::cast_dynamic(U* x) - { return handle(dynamic_cast(x)); } - -template template handle -handle::cast_const(U* x) - { return handle(const_cast(x)); } - -template template handle -handle::cast_reinterpret(U* x) - { return handle(reinterpret_cast(x)); } - - - - - -template bool -operator==(const handle &lhs,const handle &rhs) - { return (lhs.get()==rhs.get()); } -template bool -operator==(const loose_handle &lhs,const loose_handle &rhs) - { return (lhs.get()==rhs.get()); } -template bool -operator==(const handle &lhs,const loose_handle &rhs) - { return (lhs.get()==rhs.get()); } -template bool -operator==(const loose_handle &lhs,const handle &rhs) - { return (lhs.get()==rhs.get()); } -template bool -operator==(const handle &lhs,const T *rhs) - { return (lhs.get()==rhs); } -template bool -operator==(const loose_handle &lhs,const T *rhs) - { return (lhs.get()==rhs); } -template bool -operator==(const T *lhs,const handle &rhs) - { return (lhs==rhs.get()); } -template bool -operator==(const T *lhs,const loose_handle &rhs) - { return (lhs==rhs.get()); } - - -template bool -operator!=(const handle &lhs,const handle &rhs) - { return (lhs.get()!=rhs.get()); } -template bool -operator!=(const loose_handle &lhs,const loose_handle &rhs) - { return (lhs.get()!=rhs.get()); } -template bool -operator!=(const handle &lhs,const loose_handle &rhs) - { return (lhs.get()!=rhs.get()); } -template bool -operator!=(const loose_handle &lhs,const handle &rhs) - { return (lhs.get()!=rhs.get()); } -template bool -operator!=(const handle &lhs,const T *rhs) - { return (lhs.get()!=rhs); } -template bool -operator!=(const loose_handle &lhs,const T *rhs) - { return (lhs.get()!=rhs); } -template bool -operator!=(const T *lhs,const handle &rhs) - { return (lhs!=rhs.get()); } -template bool -operator!=(const T *lhs,const loose_handle &rhs) - { return (lhs!=rhs.get()); } - - -template bool -operator<(const handle &lhs,const handle &rhs) - { return (lhs.get() bool -operator<(const loose_handle &lhs,const loose_handle &rhs) - { return (lhs.get() bool -operator<(const handle &lhs,const loose_handle &rhs) - { return (lhs.get() bool -operator<(const loose_handle &lhs,const handle &rhs) - { return (lhs.get() bool -operator<(const handle &lhs,const T *rhs) - { return (lhs.get() bool -operator<(const loose_handle &lhs,const T *rhs) - { return (lhs.get() bool -operator<(const T *lhs,const handle &rhs) - { return (lhs bool -operator<(const T *lhs,const loose_handle &rhs) - { return (lhs -> handle<> +template template handle handle::cast_static (const loose_handle& x) { return handle(static_cast (x.get())); } +template template handle handle::cast_dynamic (const loose_handle& x) { return handle(dynamic_cast (x.get())); } +template template handle handle::cast_const (const loose_handle& x) { return handle(const_cast (x.get())); } +template template handle handle::cast_reinterpret(const loose_handle& x) { return handle(reinterpret_cast(x.get())); } + +// cast rhandle_handle<> -> handle<> +template template handle handle::cast_static (const rhandle& x) { return handle(static_cast (x.get())); } +template template handle handle::cast_dynamic (const rhandle& x) { return handle(dynamic_cast (x.get())); } +template template handle handle::cast_const (const rhandle& x) { return handle(const_cast (x.get())); } +template template handle handle::cast_reinterpret(const rhandle& x) { return handle(reinterpret_cast(x.get())); } + +// cast U* -> handle<> +template template handle handle::cast_static (U* x) { return handle(static_cast (x)); } +template template handle handle::cast_dynamic (U* x) { return handle(dynamic_cast (x)); } +template template handle handle::cast_const (U* x) { return handle(const_cast (x)); } +template template handle handle::cast_reinterpret(U* x) { return handle(reinterpret_cast(x)); } + +// operator== for handle<>, loose_handle<> and T* +template bool operator==(const handle & lhs,const handle & rhs) { return (lhs.get()==rhs.get()); } +template bool operator==(const loose_handle& lhs,const loose_handle& rhs) { return (lhs.get()==rhs.get()); } +template bool operator==(const handle & lhs,const loose_handle& rhs) { return (lhs.get()==rhs.get()); } +template bool operator==(const loose_handle& lhs,const handle & rhs) { return (lhs.get()==rhs.get()); } +template bool operator==(const handle& lhs,const T* rhs) { return (lhs.get()==rhs); } +template bool operator==(const loose_handle& lhs,const T* rhs) { return (lhs.get()==rhs); } +template bool operator==(const T* lhs,const handle& rhs) { return (lhs ==rhs.get()); } +template bool operator==(const T* lhs,const loose_handle& rhs) { return (lhs ==rhs.get()); } + +// operator!= for handle<>, loose_handle<> and T* +template bool operator!=(const handle & lhs,const handle & rhs) { return (lhs.get()!=rhs.get()); } +template bool operator!=(const loose_handle& lhs,const loose_handle& rhs) { return (lhs.get()!=rhs.get()); } +template bool operator!=(const handle & lhs,const loose_handle& rhs) { return (lhs.get()!=rhs.get()); } +template bool operator!=(const loose_handle& lhs,const handle & rhs) { return (lhs.get()!=rhs.get()); } +template bool operator!=(const handle& lhs,const T* rhs) { return (lhs.get()!=rhs); } +template bool operator!=(const loose_handle& lhs,const T* rhs) { return (lhs.get()!=rhs); } +template bool operator!=(const T* lhs,const handle& rhs) { return (lhs !=rhs.get()); } +template bool operator!=(const T* lhs,const loose_handle& rhs) { return (lhs !=rhs.get()); } + +// operator< for handle<>, loose_handle<> and T* +template bool operator<(const handle& lhs,const handle& rhs) { return (lhs.get() bool operator<(const loose_handle& lhs,const loose_handle& rhs) { return (lhs.get() bool operator<(const handle& lhs,const loose_handle& rhs) { return (lhs.get() bool operator<(const loose_handle& lhs,const handle& rhs) { return (lhs.get() bool operator<(const handle& lhs,const T* rhs) { return (lhs.get() bool operator<(const loose_handle& lhs,const T* rhs) { return (lhs.get() bool operator<(const T* lhs,const handle& rhs) { return (lhs bool operator<(const T* lhs,const loose_handle& rhs) { return (lhs