Let C++ inline functions return bool instead of sal_Bool
...to improve diagnosing misuses of boolean expressions in client code (cf. compilerplugins/clang/implicitboolconversion.cxx). This change should be transparent to client code. Change-Id: Ife614637082036dd17412f247be79233326c4f0b
This commit is contained in:
@@ -443,13 +443,13 @@ void Test::testBigStruct() {
|
||||
CPPUNIT_ASSERT_EQUAL(guard.p->m12.getLength(), static_cast< sal_Int32 >(0));
|
||||
CPPUNIT_ASSERT_EQUAL(
|
||||
+guard.p->m13.getTypeClass(), +com::sun::star::uno::TypeClass_VOID);
|
||||
CPPUNIT_ASSERT_EQUAL(guard.p->m14.hasValue(), sal_False);
|
||||
CPPUNIT_ASSERT_EQUAL(guard.p->m14.hasValue(), false);
|
||||
CPPUNIT_ASSERT_EQUAL(guard.p->m15.getLength(), static_cast< sal_Int32 >(0));
|
||||
CPPUNIT_ASSERT_EQUAL(
|
||||
+guard.p->m16, +test::codemaker::cppumaker::HelperEnum_ZERO);
|
||||
CPPUNIT_ASSERT_EQUAL(guard.p->m17.m1, sal_False);
|
||||
CPPUNIT_ASSERT_EQUAL(guard.p->m17.m2.is(), sal_False);
|
||||
CPPUNIT_ASSERT_EQUAL(guard.p->m18.is(), sal_False);
|
||||
CPPUNIT_ASSERT_EQUAL(guard.p->m17.m2.is(), false);
|
||||
CPPUNIT_ASSERT_EQUAL(guard.p->m18.is(), false);
|
||||
CPPUNIT_ASSERT_EQUAL(guard.p->m19, static_cast< sal_Int8 >(0));
|
||||
CPPUNIT_ASSERT_EQUAL(
|
||||
+guard.p->m20, +test::codemaker::cppumaker::HelperEnum_ZERO);
|
||||
|
@@ -147,7 +147,7 @@ public:
|
||||
|
||||
@return true if any has a value, false otherwise
|
||||
*/
|
||||
inline sal_Bool SAL_CALL hasValue() const SAL_THROW(())
|
||||
inline bool SAL_CALL hasValue() const SAL_THROW(())
|
||||
{ return (typelib_TypeClass_VOID != pType->eTypeClass); }
|
||||
|
||||
/** Gets a pointer to the set value.
|
||||
@@ -205,7 +205,7 @@ public:
|
||||
@param rType destination type
|
||||
@return true if this any is extractable to value of given type (e.g. using >>= operator)
|
||||
*/
|
||||
inline sal_Bool SAL_CALL isExtractableTo( const Type & rType ) const SAL_THROW(());
|
||||
inline bool SAL_CALL isExtractableTo( const Type & rType ) const SAL_THROW(());
|
||||
|
||||
/** Tests whether this any can provide a value of specified type.
|
||||
Widening conversion without data loss is taken into account.
|
||||
@@ -222,14 +222,14 @@ public:
|
||||
@param rAny another any (right side)
|
||||
@return true if both any contains equal values
|
||||
*/
|
||||
inline sal_Bool SAL_CALL operator == ( const Any & rAny ) const SAL_THROW(());
|
||||
inline bool SAL_CALL operator == ( const Any & rAny ) const SAL_THROW(());
|
||||
/** Unequality operator: compares two anys.
|
||||
The values need not be of equal type, e.g. a short integer is compared to a long integer.
|
||||
|
||||
@param rAny another any (right side)
|
||||
@return true if both any contains unequal values
|
||||
*/
|
||||
inline sal_Bool SAL_CALL operator != ( const Any & rAny ) const SAL_THROW(());
|
||||
inline bool SAL_CALL operator != ( const Any & rAny ) const SAL_THROW(());
|
||||
|
||||
private:
|
||||
/// @cond INTERNAL
|
||||
@@ -283,7 +283,7 @@ inline void SAL_CALL operator <<= ( Any & rAny, bool const & value )
|
||||
@return true if assignment was possible without data loss
|
||||
*/
|
||||
template< class C >
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, C & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, C & value ) SAL_THROW(());
|
||||
|
||||
/** Template equality operator: compares set value of left side any to right side value.
|
||||
The values need not be of equal type, e.g. a short integer is compared to a long integer.
|
||||
@@ -296,7 +296,7 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, C & value ) SAL_THROW(
|
||||
@return true if values are equal, false otherwise
|
||||
*/
|
||||
template< class C >
|
||||
inline sal_Bool SAL_CALL operator == ( const Any & rAny, const C & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator == ( const Any & rAny, const C & value ) SAL_THROW(());
|
||||
/** Template unequality operator: compares set value of left side any to right side value.
|
||||
The values need not be of equal type, e.g. a short integer is compared to a long integer.
|
||||
This operator can be implemented as template member function, if all supported compilers
|
||||
@@ -308,43 +308,43 @@ inline sal_Bool SAL_CALL operator == ( const Any & rAny, const C & value ) SAL_T
|
||||
@return true if values are unequal, false otherwise
|
||||
*/
|
||||
template< class C >
|
||||
inline sal_Bool SAL_CALL operator != ( const Any & rAny, const C & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator != ( const Any & rAny, const C & value ) SAL_THROW(());
|
||||
|
||||
// additional specialized >>= and == operators
|
||||
// bool
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Bool & value ) SAL_THROW(());
|
||||
inline sal_Bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Bool & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value ) SAL_THROW(());
|
||||
template<>
|
||||
inline sal_Bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
|
||||
inline bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
|
||||
SAL_THROW(());
|
||||
template<>
|
||||
inline sal_Bool SAL_CALL operator == ( Any const & rAny, bool const & value )
|
||||
inline bool SAL_CALL operator == ( Any const & rAny, bool const & value )
|
||||
SAL_THROW(());
|
||||
// byte
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int8 & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int8 & value ) SAL_THROW(());
|
||||
// short
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value ) SAL_THROW(());
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value ) SAL_THROW(());
|
||||
// long
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value ) SAL_THROW(());
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value ) SAL_THROW(());
|
||||
// hyper
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value ) SAL_THROW(());
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value ) SAL_THROW(());
|
||||
// float
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, float & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, float & value ) SAL_THROW(());
|
||||
// double
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, double & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, double & value ) SAL_THROW(());
|
||||
// string
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value ) SAL_THROW(());
|
||||
inline sal_Bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value ) SAL_THROW(());
|
||||
// type
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, Type & value ) SAL_THROW(());
|
||||
inline sal_Bool SAL_CALL operator == ( const Any & rAny, const Type & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, Type & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator == ( const Any & rAny, const Type & value ) SAL_THROW(());
|
||||
// any
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, Any & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value ) SAL_THROW(());
|
||||
// interface
|
||||
inline sal_Bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value ) SAL_THROW(());
|
||||
inline bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value ) SAL_THROW(());
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -140,7 +140,7 @@ inline void Any::clear() SAL_THROW(())
|
||||
this, (uno_ReleaseFunc)cpp_release );
|
||||
}
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool Any::isExtractableTo( const Type & rType ) const SAL_THROW(())
|
||||
inline bool Any::isExtractableTo( const Type & rType ) const SAL_THROW(())
|
||||
{
|
||||
return ::uno_type_isAssignableFromData(
|
||||
rType.getTypeLibType(), pData, pType,
|
||||
@@ -163,14 +163,14 @@ template <>
|
||||
bool Any::has<sal_uInt16>() const;
|
||||
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool Any::operator == ( const Any & rAny ) const SAL_THROW(())
|
||||
inline bool Any::operator == ( const Any & rAny ) const SAL_THROW(())
|
||||
{
|
||||
return ::uno_type_equalData(
|
||||
pData, pType, rAny.pData, rAny.pType,
|
||||
(uno_QueryInterfaceFunc)cpp_queryInterface, (uno_ReleaseFunc)cpp_release );
|
||||
}
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool Any::operator != ( const Any & rAny ) const SAL_THROW(())
|
||||
inline bool Any::operator != ( const Any & rAny ) const SAL_THROW(())
|
||||
{
|
||||
return (! ::uno_type_equalData(
|
||||
pData, pType, rAny.pData, rAny.pType,
|
||||
@@ -238,7 +238,7 @@ inline void SAL_CALL operator <<= ( Any & rAny, const rtl::OUStringConcat< C1, C
|
||||
#endif
|
||||
//__________________________________________________________________________________________________
|
||||
template< class C >
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, C & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, C & value ) SAL_THROW(())
|
||||
{
|
||||
const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
|
||||
return ::uno_type_assignData(
|
||||
@@ -250,17 +250,17 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, C & value ) SAL_THROW(
|
||||
|
||||
// bool
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Bool & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Bool & value ) SAL_THROW(())
|
||||
{
|
||||
if (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass)
|
||||
{
|
||||
value = (* reinterpret_cast< const sal_Bool * >( rAny.pData ) != sal_False);
|
||||
return sal_True;
|
||||
return true;
|
||||
}
|
||||
return sal_False;
|
||||
return false;
|
||||
}
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value ) SAL_THROW(())
|
||||
{
|
||||
return (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass &&
|
||||
(value != sal_False) == (* reinterpret_cast< const sal_Bool * >( rAny.pData ) != sal_False));
|
||||
@@ -268,7 +268,7 @@ inline sal_Bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value
|
||||
|
||||
//______________________________________________________________________________
|
||||
template<>
|
||||
inline sal_Bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
|
||||
inline bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
|
||||
SAL_THROW(())
|
||||
{
|
||||
if (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN)
|
||||
@@ -282,7 +282,7 @@ inline sal_Bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
|
||||
|
||||
//______________________________________________________________________________
|
||||
template<>
|
||||
inline sal_Bool SAL_CALL operator == ( Any const & rAny, bool const & value )
|
||||
inline bool SAL_CALL operator == ( Any const & rAny, bool const & value )
|
||||
SAL_THROW(())
|
||||
{
|
||||
return (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN &&
|
||||
@@ -293,240 +293,240 @@ inline sal_Bool SAL_CALL operator == ( Any const & rAny, bool const & value )
|
||||
|
||||
// byte
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int8 & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int8 & value ) SAL_THROW(())
|
||||
{
|
||||
if (typelib_TypeClass_BYTE == rAny.pType->eTypeClass)
|
||||
{
|
||||
value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
}
|
||||
return sal_False;
|
||||
return false;
|
||||
}
|
||||
// short
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value ) SAL_THROW(())
|
||||
{
|
||||
switch (rAny.pType->eTypeClass)
|
||||
{
|
||||
case typelib_TypeClass_BYTE:
|
||||
value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_SHORT:
|
||||
case typelib_TypeClass_UNSIGNED_SHORT:
|
||||
value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
default:
|
||||
return sal_False;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value ) SAL_THROW(())
|
||||
{
|
||||
switch (rAny.pType->eTypeClass)
|
||||
{
|
||||
case typelib_TypeClass_BYTE:
|
||||
value = (sal_uInt16)( * reinterpret_cast< const sal_Int8 * >( rAny.pData ) );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_SHORT:
|
||||
case typelib_TypeClass_UNSIGNED_SHORT:
|
||||
value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
default:
|
||||
return sal_False;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// long
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value ) SAL_THROW(())
|
||||
{
|
||||
switch (rAny.pType->eTypeClass)
|
||||
{
|
||||
case typelib_TypeClass_BYTE:
|
||||
value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_SHORT:
|
||||
value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_UNSIGNED_SHORT:
|
||||
value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_LONG:
|
||||
case typelib_TypeClass_UNSIGNED_LONG:
|
||||
value = * reinterpret_cast< const sal_Int32 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
default:
|
||||
return sal_False;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value ) SAL_THROW(())
|
||||
{
|
||||
switch (rAny.pType->eTypeClass)
|
||||
{
|
||||
case typelib_TypeClass_BYTE:
|
||||
value = (sal_uInt32)( * reinterpret_cast< const sal_Int8 * >( rAny.pData ) );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_SHORT:
|
||||
value = (sal_uInt32)( * reinterpret_cast< const sal_Int16 * >( rAny.pData ) );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_UNSIGNED_SHORT:
|
||||
value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_LONG:
|
||||
case typelib_TypeClass_UNSIGNED_LONG:
|
||||
value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
default:
|
||||
return sal_False;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// hyper
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value ) SAL_THROW(())
|
||||
{
|
||||
switch (rAny.pType->eTypeClass)
|
||||
{
|
||||
case typelib_TypeClass_BYTE:
|
||||
value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_SHORT:
|
||||
value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_UNSIGNED_SHORT:
|
||||
value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_LONG:
|
||||
value = * reinterpret_cast< const sal_Int32 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_UNSIGNED_LONG:
|
||||
value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_HYPER:
|
||||
case typelib_TypeClass_UNSIGNED_HYPER:
|
||||
value = * reinterpret_cast< const sal_Int64 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
default:
|
||||
return sal_False;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value ) SAL_THROW(())
|
||||
{
|
||||
switch (rAny.pType->eTypeClass)
|
||||
{
|
||||
case typelib_TypeClass_BYTE:
|
||||
value = (sal_uInt64)( * reinterpret_cast< const sal_Int8 * >( rAny.pData ) );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_SHORT:
|
||||
value = (sal_uInt64)( * reinterpret_cast< const sal_Int16 * >( rAny.pData ) );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_UNSIGNED_SHORT:
|
||||
value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_LONG:
|
||||
value = (sal_uInt64)( * reinterpret_cast< const sal_Int32 * >( rAny.pData ) );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_UNSIGNED_LONG:
|
||||
value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_HYPER:
|
||||
case typelib_TypeClass_UNSIGNED_HYPER:
|
||||
value = * reinterpret_cast< const sal_uInt64 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
default:
|
||||
return sal_False;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// float
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, float & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, float & value ) SAL_THROW(())
|
||||
{
|
||||
switch (rAny.pType->eTypeClass)
|
||||
{
|
||||
case typelib_TypeClass_BYTE:
|
||||
value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_SHORT:
|
||||
value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_UNSIGNED_SHORT:
|
||||
value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_FLOAT:
|
||||
value = * reinterpret_cast< const float * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
default:
|
||||
return sal_False;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// double
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, double & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, double & value ) SAL_THROW(())
|
||||
{
|
||||
switch (rAny.pType->eTypeClass)
|
||||
{
|
||||
case typelib_TypeClass_BYTE:
|
||||
value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_SHORT:
|
||||
value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_UNSIGNED_SHORT:
|
||||
value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_LONG:
|
||||
value = * reinterpret_cast< const sal_Int32 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_UNSIGNED_LONG:
|
||||
value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_FLOAT:
|
||||
value = * reinterpret_cast< const float * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
case typelib_TypeClass_DOUBLE:
|
||||
value = * reinterpret_cast< const double * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
default:
|
||||
return sal_False;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// string
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value ) SAL_THROW(())
|
||||
{
|
||||
if (typelib_TypeClass_STRING == rAny.pType->eTypeClass)
|
||||
{
|
||||
value = * reinterpret_cast< const ::rtl::OUString * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
}
|
||||
return sal_False;
|
||||
return false;
|
||||
}
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value ) SAL_THROW(())
|
||||
{
|
||||
return (typelib_TypeClass_STRING == rAny.pType->eTypeClass &&
|
||||
value.equals( * reinterpret_cast< const ::rtl::OUString * >( rAny.pData ) ));
|
||||
}
|
||||
// type
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, Type & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, Type & value ) SAL_THROW(())
|
||||
{
|
||||
if (typelib_TypeClass_TYPE == rAny.pType->eTypeClass)
|
||||
{
|
||||
value = * reinterpret_cast< const Type * >( rAny.pData );
|
||||
return sal_True;
|
||||
return true;
|
||||
}
|
||||
return sal_False;
|
||||
return false;
|
||||
}
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool SAL_CALL operator == ( const Any & rAny, const Type & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator == ( const Any & rAny, const Type & value ) SAL_THROW(())
|
||||
{
|
||||
return (typelib_TypeClass_TYPE == rAny.pType->eTypeClass &&
|
||||
value.equals( * reinterpret_cast< const Type * >( rAny.pData ) ));
|
||||
}
|
||||
// any
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, Any & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value ) SAL_THROW(())
|
||||
{
|
||||
if (&rAny != &value)
|
||||
{
|
||||
@@ -534,23 +534,23 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, Any & value ) SAL_THRO
|
||||
&value, rAny.pData, rAny.pType,
|
||||
(uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release );
|
||||
}
|
||||
return sal_True;
|
||||
return true;
|
||||
}
|
||||
// interface
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value ) SAL_THROW(())
|
||||
{
|
||||
if (typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass)
|
||||
{
|
||||
return reinterpret_cast< const BaseReference * >( rAny.pData )->operator == ( value );
|
||||
}
|
||||
return sal_False;
|
||||
return false;
|
||||
}
|
||||
|
||||
// operator to compare to an any.
|
||||
//__________________________________________________________________________________________________
|
||||
template< class C >
|
||||
inline sal_Bool SAL_CALL operator == ( const Any & rAny, const C & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator == ( const Any & rAny, const C & value ) SAL_THROW(())
|
||||
{
|
||||
const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
|
||||
return ::uno_type_equalData(
|
||||
@@ -561,7 +561,7 @@ inline sal_Bool SAL_CALL operator == ( const Any & rAny, const C & value ) SAL_T
|
||||
// operator to compare to an any. may use specialized operators ==.
|
||||
//__________________________________________________________________________________________________
|
||||
template< class C >
|
||||
inline sal_Bool SAL_CALL operator != ( const Any & rAny, const C & value ) SAL_THROW(())
|
||||
inline bool SAL_CALL operator != ( const Any & rAny, const C & value ) SAL_THROW(())
|
||||
{
|
||||
return (! operator == ( rAny, value ));
|
||||
}
|
||||
|
@@ -88,7 +88,7 @@ public:
|
||||
|
||||
@return true if reference acquires an interface, i.e. true if it is not null
|
||||
*/
|
||||
inline sal_Bool SAL_CALL is() const SAL_THROW(())
|
||||
inline bool SAL_CALL is() const SAL_THROW(())
|
||||
{ return (0 != _pInterface); }
|
||||
|
||||
/** Equality operator: compares two interfaces
|
||||
@@ -97,14 +97,14 @@ public:
|
||||
@param pInterface another interface
|
||||
@return true if both references are null or refer to the same object, false otherwise
|
||||
*/
|
||||
inline sal_Bool SAL_CALL operator == ( XInterface * pInterface ) const SAL_THROW(());
|
||||
inline bool SAL_CALL operator == ( XInterface * pInterface ) const SAL_THROW(());
|
||||
/** Unequality operator: compares two interfaces
|
||||
Checks if both references are null or refer to the same object.
|
||||
|
||||
@param pInterface another interface
|
||||
@return false if both references are null or refer to the same object, true otherwise
|
||||
*/
|
||||
inline sal_Bool SAL_CALL operator != ( XInterface * pInterface ) const SAL_THROW(());
|
||||
inline bool SAL_CALL operator != ( XInterface * pInterface ) const SAL_THROW(());
|
||||
|
||||
/** Equality operator: compares two interfaces
|
||||
Checks if both references are null or refer to the same object.
|
||||
@@ -112,21 +112,21 @@ public:
|
||||
@param rRef another reference
|
||||
@return true if both references are null or refer to the same object, false otherwise
|
||||
*/
|
||||
inline sal_Bool SAL_CALL operator == ( const BaseReference & rRef ) const SAL_THROW(());
|
||||
inline bool SAL_CALL operator == ( const BaseReference & rRef ) const SAL_THROW(());
|
||||
/** Unequality operator: compares two interfaces
|
||||
Checks if both references are null or refer to the same object.
|
||||
|
||||
@param rRef another reference
|
||||
@return false if both references are null or refer to the same object, true otherwise
|
||||
*/
|
||||
inline sal_Bool SAL_CALL operator != ( const BaseReference & rRef ) const SAL_THROW(());
|
||||
inline bool SAL_CALL operator != ( const BaseReference & rRef ) const SAL_THROW(());
|
||||
|
||||
/** Needed by some STL containers.
|
||||
|
||||
@param rRef another reference
|
||||
@return true, if this reference is less than rRef
|
||||
*/
|
||||
inline sal_Bool SAL_CALL operator < ( const BaseReference & rRef ) const SAL_THROW(());
|
||||
inline bool SAL_CALL operator < ( const BaseReference & rRef ) const SAL_THROW(());
|
||||
};
|
||||
|
||||
/** Enum defining UNO_QUERY for implicit interface query.
|
||||
@@ -420,13 +420,13 @@ public:
|
||||
@param rRef another reference
|
||||
@return true, if non-null interface was set
|
||||
*/
|
||||
inline sal_Bool SAL_CALL set( const Reference< interface_type > & rRef ) SAL_THROW(());
|
||||
inline bool SAL_CALL set( const Reference< interface_type > & rRef ) SAL_THROW(());
|
||||
/** Sets the given interface. An interface already set will be released.
|
||||
|
||||
@param pInterface another interface
|
||||
@return true, if non-null interface was set
|
||||
*/
|
||||
inline sal_Bool SAL_CALL set( interface_type * pInterface ) SAL_THROW(());
|
||||
inline bool SAL_CALL set( interface_type * pInterface ) SAL_THROW(());
|
||||
|
||||
/** Sets interface pointer without acquiring it. An interface already set will be released.
|
||||
|
||||
@@ -434,7 +434,7 @@ public:
|
||||
@param dummy SAL_NO_ACQUIRE to force obvious distinction to set methods
|
||||
@return true, if non-null interface was set
|
||||
*/
|
||||
inline sal_Bool SAL_CALL set( interface_type * pInterface, __sal_NoAcquire dummy) SAL_THROW(());
|
||||
inline bool SAL_CALL set( interface_type * pInterface, __sal_NoAcquire dummy) SAL_THROW(());
|
||||
/** Sets interface pointer without acquiring it. An interface already set will be released.
|
||||
Deprecated, please use SAL_NO_ACQUIRE version.
|
||||
|
||||
@@ -443,7 +443,7 @@ public:
|
||||
@param dummy UNO_REF_NO_ACQUIRE to force obvious distinction to set methods
|
||||
@return true, if non-null interface was set
|
||||
*/
|
||||
inline sal_Bool SAL_CALL set( interface_type * pInterface, UnoReference_NoAcquire dummy) SAL_THROW(());
|
||||
inline bool SAL_CALL set( interface_type * pInterface, UnoReference_NoAcquire dummy) SAL_THROW(());
|
||||
|
||||
/** Queries given interface for reference interface type (interface_type) and sets it.
|
||||
An interface already set will be released.
|
||||
@@ -452,7 +452,7 @@ public:
|
||||
@param dummy UNO_QUERY to force obvious distinction to set methods
|
||||
@return true, if non-null interface was set
|
||||
*/
|
||||
inline sal_Bool SAL_CALL set( XInterface * pInterface, UnoReference_Query dummy ) SAL_THROW( (RuntimeException) );
|
||||
inline bool SAL_CALL set( XInterface * pInterface, UnoReference_Query dummy ) SAL_THROW( (RuntimeException) );
|
||||
/** Queries given interface for reference interface type (interface_type) and sets it.
|
||||
An interface already set will be released.
|
||||
|
||||
@@ -460,7 +460,7 @@ public:
|
||||
@param dummy UNO_QUERY to force obvious distinction to set methods
|
||||
@return true, if non-null interface was set
|
||||
*/
|
||||
inline sal_Bool SAL_CALL set( const BaseReference & rRef, UnoReference_Query dummy) SAL_THROW( (RuntimeException) );
|
||||
inline bool SAL_CALL set( const BaseReference & rRef, UnoReference_Query dummy) SAL_THROW( (RuntimeException) );
|
||||
|
||||
/** Queries given any for reference interface type (interface_type)
|
||||
and sets it. An interface already set will be released.
|
||||
|
@@ -215,7 +215,7 @@ inline void Reference< interface_type >::clear() SAL_THROW(())
|
||||
}
|
||||
//__________________________________________________________________________________________________
|
||||
template< class interface_type >
|
||||
inline sal_Bool Reference< interface_type >::set(
|
||||
inline bool Reference< interface_type >::set(
|
||||
interface_type * pInterface ) SAL_THROW(())
|
||||
{
|
||||
if (pInterface)
|
||||
@@ -228,7 +228,7 @@ inline sal_Bool Reference< interface_type >::set(
|
||||
}
|
||||
//__________________________________________________________________________________________________
|
||||
template< class interface_type >
|
||||
inline sal_Bool Reference< interface_type >::set(
|
||||
inline bool Reference< interface_type >::set(
|
||||
interface_type * pInterface, __sal_NoAcquire ) SAL_THROW(())
|
||||
{
|
||||
XInterface * const pOld = _pInterface;
|
||||
@@ -239,7 +239,7 @@ inline sal_Bool Reference< interface_type >::set(
|
||||
}
|
||||
//__________________________________________________________________________________________________
|
||||
template< class interface_type >
|
||||
inline sal_Bool Reference< interface_type >::set(
|
||||
inline bool Reference< interface_type >::set(
|
||||
interface_type * pInterface, UnoReference_NoAcquire ) SAL_THROW(())
|
||||
{
|
||||
return set( pInterface, SAL_NO_ACQUIRE );
|
||||
@@ -247,21 +247,21 @@ inline sal_Bool Reference< interface_type >::set(
|
||||
|
||||
//__________________________________________________________________________________________________
|
||||
template< class interface_type >
|
||||
inline sal_Bool Reference< interface_type >::set(
|
||||
inline bool Reference< interface_type >::set(
|
||||
const Reference< interface_type > & rRef ) SAL_THROW(())
|
||||
{
|
||||
return set( castFromXInterface( rRef._pInterface ) );
|
||||
}
|
||||
//__________________________________________________________________________________________________
|
||||
template< class interface_type >
|
||||
inline sal_Bool Reference< interface_type >::set(
|
||||
inline bool Reference< interface_type >::set(
|
||||
XInterface * pInterface, UnoReference_Query ) SAL_THROW( (RuntimeException) )
|
||||
{
|
||||
return set( castFromXInterface(iquery( pInterface )), SAL_NO_ACQUIRE );
|
||||
}
|
||||
//__________________________________________________________________________________________________
|
||||
template< class interface_type >
|
||||
inline sal_Bool Reference< interface_type >::set(
|
||||
inline bool Reference< interface_type >::set(
|
||||
const BaseReference & rRef, UnoReference_Query ) SAL_THROW( (RuntimeException) )
|
||||
{
|
||||
return set( castFromXInterface(iquery( rRef.get() )), SAL_NO_ACQUIRE );
|
||||
@@ -358,10 +358,10 @@ inline Reference< interface_type > Reference< interface_type >::query(
|
||||
//##################################################################################################
|
||||
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool BaseReference::operator == ( XInterface * pInterface ) const SAL_THROW(())
|
||||
inline bool BaseReference::operator == ( XInterface * pInterface ) const SAL_THROW(())
|
||||
{
|
||||
if (_pInterface == pInterface)
|
||||
return sal_True;
|
||||
return true;
|
||||
try
|
||||
{
|
||||
// only the query to XInterface must return the same pointer if they belong to same objects
|
||||
@@ -371,16 +371,16 @@ inline sal_Bool BaseReference::operator == ( XInterface * pInterface ) const SAL
|
||||
}
|
||||
catch (RuntimeException &)
|
||||
{
|
||||
return sal_False;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
inline sal_Bool BaseReference::operator < (
|
||||
inline bool BaseReference::operator < (
|
||||
const BaseReference & rRef ) const SAL_THROW(())
|
||||
{
|
||||
if (_pInterface == rRef._pInterface)
|
||||
return sal_False;
|
||||
return false;
|
||||
try
|
||||
{
|
||||
// only the query to XInterface must return the same pointer:
|
||||
@@ -390,22 +390,22 @@ inline sal_Bool BaseReference::operator < (
|
||||
}
|
||||
catch (RuntimeException &)
|
||||
{
|
||||
return sal_False;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool BaseReference::operator != ( XInterface * pInterface ) const SAL_THROW(())
|
||||
inline bool BaseReference::operator != ( XInterface * pInterface ) const SAL_THROW(())
|
||||
{
|
||||
return (! operator == ( pInterface ));
|
||||
}
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool BaseReference::operator == ( const BaseReference & rRef ) const SAL_THROW(())
|
||||
inline bool BaseReference::operator == ( const BaseReference & rRef ) const SAL_THROW(())
|
||||
{
|
||||
return operator == ( rRef._pInterface );
|
||||
}
|
||||
//__________________________________________________________________________________________________
|
||||
inline sal_Bool BaseReference::operator != ( const BaseReference & rRef ) const SAL_THROW(())
|
||||
inline bool BaseReference::operator != ( const BaseReference & rRef ) const SAL_THROW(())
|
||||
{
|
||||
return (! operator == ( rRef._pInterface ));
|
||||
}
|
||||
|
@@ -140,7 +140,7 @@ public:
|
||||
|
||||
@return true, if elements count is greater than zero
|
||||
*/
|
||||
inline sal_Bool SAL_CALL hasElements() const SAL_THROW(())
|
||||
inline bool SAL_CALL hasElements() const SAL_THROW(())
|
||||
{ return (_pSequence->nElements > 0); }
|
||||
|
||||
/** Gets a pointer to elements array for reading.
|
||||
@@ -217,7 +217,7 @@ public:
|
||||
@param rSeq another sequence of same type (right side)
|
||||
@return true if both sequences are equal, false otherwise
|
||||
*/
|
||||
inline sal_Bool SAL_CALL operator == ( const Sequence< E > & rSeq ) const
|
||||
inline bool SAL_CALL operator == ( const Sequence< E > & rSeq ) const
|
||||
SAL_THROW(());
|
||||
|
||||
/** Unequality operator: Compares two sequences.
|
||||
@@ -225,7 +225,7 @@ public:
|
||||
@param rSeq another sequence of same type (right side)
|
||||
@return false if both sequences are equal, true otherwise
|
||||
*/
|
||||
inline sal_Bool SAL_CALL operator != ( const Sequence< E > & rSeq ) const
|
||||
inline bool SAL_CALL operator != ( const Sequence< E > & rSeq ) const
|
||||
SAL_THROW(());
|
||||
|
||||
/** Reallocates sequence to new length.
|
||||
|
@@ -110,11 +110,11 @@ inline Sequence< E > & Sequence< E >::operator = ( const Sequence< E > & rSeq )
|
||||
}
|
||||
|
||||
template< class E >
|
||||
inline sal_Bool Sequence< E >::operator == ( const Sequence< E > & rSeq ) const
|
||||
inline bool Sequence< E >::operator == ( const Sequence< E > & rSeq ) const
|
||||
SAL_THROW(())
|
||||
{
|
||||
if (_pSequence == rSeq._pSequence)
|
||||
return sal_True;
|
||||
return true;
|
||||
const Type & rType = ::cppu::getTypeFavourUnsigned( this );
|
||||
return ::uno_type_equalData(
|
||||
const_cast< Sequence< E > * >( this ), rType.getTypeLibType(),
|
||||
@@ -124,7 +124,7 @@ inline sal_Bool Sequence< E >::operator == ( const Sequence< E > & rSeq ) const
|
||||
}
|
||||
|
||||
template< class E >
|
||||
inline sal_Bool Sequence< E >::operator != ( const Sequence< E > & rSeq ) const
|
||||
inline bool Sequence< E >::operator != ( const Sequence< E > & rSeq ) const
|
||||
SAL_THROW(())
|
||||
{
|
||||
return (! operator == ( rSeq ));
|
||||
|
@@ -163,7 +163,7 @@ public:
|
||||
@return true if values of this type can be assigned from values of given type,
|
||||
false otherwise
|
||||
*/
|
||||
inline sal_Bool SAL_CALL isAssignableFrom( const Type & rType ) const SAL_THROW(())
|
||||
inline bool SAL_CALL isAssignableFrom( const Type & rType ) const SAL_THROW(())
|
||||
{ return ::typelib_typedescriptionreference_isAssignableFrom( _pType, rType._pType ); }
|
||||
|
||||
/** Compares two types.
|
||||
@@ -171,21 +171,21 @@ public:
|
||||
@param rType another type
|
||||
@return true if both types refer the same type, false otherwise
|
||||
*/
|
||||
inline sal_Bool SAL_CALL equals( const Type & rType ) const SAL_THROW(())
|
||||
inline bool SAL_CALL equals( const Type & rType ) const SAL_THROW(())
|
||||
{ return ::typelib_typedescriptionreference_equals( _pType, rType._pType ); }
|
||||
/** Equality operator: Compares two types.
|
||||
|
||||
@param rType another type
|
||||
@return true if both types refer the same type, false otherwise
|
||||
*/
|
||||
inline sal_Bool SAL_CALL operator == ( const Type & rType ) const SAL_THROW(())
|
||||
inline bool SAL_CALL operator == ( const Type & rType ) const SAL_THROW(())
|
||||
{ return ::typelib_typedescriptionreference_equals( _pType, rType._pType ); }
|
||||
/** Unequality operator: Compares two types.
|
||||
|
||||
@param rType another type
|
||||
@return false if both types refer the same type, true otherwise
|
||||
*/
|
||||
inline sal_Bool SAL_CALL operator != ( const Type & rType ) const SAL_THROW(())
|
||||
inline bool SAL_CALL operator != ( const Type & rType ) const SAL_THROW(())
|
||||
{ return (! ::typelib_typedescriptionreference_equals( _pType, rType._pType )); }
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user