Kaydet (Commit) 2224ef39 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Any: consistently use explicit specialization instead of overloading

Should be transparent to client code.

Change-Id: I5632fba87242ff9cb9a6b3481a179fa3e92c618b
üst 8e285728
......@@ -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(());
}
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment