diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-02-18 17:07:45 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-02-18 19:00:51 +0100 |
commit | 2224ef39728f0ee654d82c51a900aa1837e6663d (patch) | |
tree | 5832d121ce12d61a2022a8cfe8025d8eb2d343fa /include/com | |
parent | 8e285728e634b8a2dafcfe87cd1fa7810791df5e (diff) |
Any: consistently use explicit specialization instead of overloading
Should be transparent to client code.
Change-Id: I5632fba87242ff9cb9a6b3481a179fa3e92c618b
Diffstat (limited to 'include/com')
-rw-r--r-- | include/com/sun/star/uno/Any.h | 18 | ||||
-rw-r--r-- | include/com/sun/star/uno/Any.hxx | 18 |
2 files changed, 36 insertions, 0 deletions
diff --git a/include/com/sun/star/uno/Any.h b/include/com/sun/star/uno/Any.h index d9afd93a4587..ca22957c1823 100644 --- a/include/com/sun/star/uno/Any.h +++ b/include/com/sun/star/uno/Any.h @@ -270,6 +270,7 @@ template< class C > inline void SAL_CALL operator <<= ( Any & rAny, const C & value ) SAL_THROW(()); // additionally for C++ bool: +template<> inline void SAL_CALL operator <<= ( Any & rAny, bool const & value ) SAL_THROW(()); @@ -312,7 +313,9 @@ inline bool SAL_CALL operator != ( const Any & rAny, const C & value ) SAL_THROW // additional specialized >>= and == operators // bool +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Bool & value ) SAL_THROW(()); +template<> inline bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value ) SAL_THROW(()); template<> inline bool SAL_CALL operator >>= ( Any const & rAny, bool & value ) @@ -321,29 +324,44 @@ template<> inline bool SAL_CALL operator == ( Any const & rAny, bool const & value ) SAL_THROW(()); // byte +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int8 & value ) SAL_THROW(()); // short +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value ) SAL_THROW(()); +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value ) SAL_THROW(()); // long +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value ) SAL_THROW(()); +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value ) SAL_THROW(()); // hyper +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value ) SAL_THROW(()); +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value ) SAL_THROW(()); // float +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, float & value ) SAL_THROW(()); // double +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, double & value ) SAL_THROW(()); // string +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value ) SAL_THROW(()); +template<> inline bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value ) SAL_THROW(()); // type +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, Type & value ) SAL_THROW(()); +template<> inline bool SAL_CALL operator == ( const Any & rAny, const Type & value ) SAL_THROW(()); // any +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value ) SAL_THROW(()); // interface +template<> inline bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value ) SAL_THROW(()); } diff --git a/include/com/sun/star/uno/Any.hxx b/include/com/sun/star/uno/Any.hxx index d04527ab111f..8046c0d2cae8 100644 --- a/include/com/sun/star/uno/Any.hxx +++ b/include/com/sun/star/uno/Any.hxx @@ -214,6 +214,7 @@ inline void SAL_CALL operator <<= ( Any & rAny, const C & value ) SAL_THROW(()) // additionally for C++ bool: //______________________________________________________________________________ +template<> inline void SAL_CALL operator <<= ( Any & rAny, bool const & value ) SAL_THROW(()) { @@ -250,6 +251,7 @@ inline bool SAL_CALL operator >>= ( const Any & rAny, C & value ) SAL_THROW(()) // bool //__________________________________________________________________________________________________ +template<> inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Bool & value ) SAL_THROW(()) { if (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass) @@ -260,6 +262,7 @@ inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal return false; } //__________________________________________________________________________________________________ +template<> inline bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value ) SAL_THROW(()) { return (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass && @@ -293,6 +296,7 @@ inline bool SAL_CALL operator == ( Any const & rAny, bool const & value ) // byte //__________________________________________________________________________________________________ +template<> inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int8 & value ) SAL_THROW(()) { if (typelib_TypeClass_BYTE == rAny.pType->eTypeClass) @@ -304,6 +308,7 @@ inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal } // short //__________________________________________________________________________________________________ +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value ) SAL_THROW(()) { switch (rAny.pType->eTypeClass) @@ -320,6 +325,7 @@ inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value ) SAL_TH } } //__________________________________________________________________________________________________ +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value ) SAL_THROW(()) { switch (rAny.pType->eTypeClass) @@ -337,6 +343,7 @@ inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value ) SAL_T } // long //__________________________________________________________________________________________________ +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value ) SAL_THROW(()) { switch (rAny.pType->eTypeClass) @@ -359,6 +366,7 @@ inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value ) SAL_TH } } //__________________________________________________________________________________________________ +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value ) SAL_THROW(()) { switch (rAny.pType->eTypeClass) @@ -382,6 +390,7 @@ inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value ) SAL_T } // hyper //__________________________________________________________________________________________________ +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value ) SAL_THROW(()) { switch (rAny.pType->eTypeClass) @@ -410,6 +419,7 @@ inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value ) SAL_TH } } //__________________________________________________________________________________________________ +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value ) SAL_THROW(()) { switch (rAny.pType->eTypeClass) @@ -439,6 +449,7 @@ inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value ) SAL_T } // float //__________________________________________________________________________________________________ +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, float & value ) SAL_THROW(()) { switch (rAny.pType->eTypeClass) @@ -461,6 +472,7 @@ inline bool SAL_CALL operator >>= ( const Any & rAny, float & value ) SAL_THROW( } // double //__________________________________________________________________________________________________ +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, double & value ) SAL_THROW(()) { switch (rAny.pType->eTypeClass) @@ -492,6 +504,7 @@ inline bool SAL_CALL operator >>= ( const Any & rAny, double & value ) SAL_THROW } // string //__________________________________________________________________________________________________ +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value ) SAL_THROW(()) { if (typelib_TypeClass_STRING == rAny.pType->eTypeClass) @@ -502,6 +515,7 @@ inline bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value ) return false; } //__________________________________________________________________________________________________ +template<> inline bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value ) SAL_THROW(()) { return (typelib_TypeClass_STRING == rAny.pType->eTypeClass && @@ -509,6 +523,7 @@ inline bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & val } // type //__________________________________________________________________________________________________ +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, Type & value ) SAL_THROW(()) { if (typelib_TypeClass_TYPE == rAny.pType->eTypeClass) @@ -519,6 +534,7 @@ inline bool SAL_CALL operator >>= ( const Any & rAny, Type & value ) SAL_THROW(( return false; } //__________________________________________________________________________________________________ +template<> inline bool SAL_CALL operator == ( const Any & rAny, const Type & value ) SAL_THROW(()) { return (typelib_TypeClass_TYPE == rAny.pType->eTypeClass && @@ -526,6 +542,7 @@ inline bool SAL_CALL operator == ( const Any & rAny, const Type & value ) SAL_TH } // any //__________________________________________________________________________________________________ +template<> inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value ) SAL_THROW(()) { if (&rAny != &value) @@ -538,6 +555,7 @@ inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value ) SAL_THROW(() } // interface //__________________________________________________________________________________________________ +template<> inline bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value ) SAL_THROW(()) { if (typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass) |