summaryrefslogtreecommitdiff
path: root/comphelper/source/misc/anycompare.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'comphelper/source/misc/anycompare.cxx')
-rw-r--r--comphelper/source/misc/anycompare.cxx39
1 files changed, 4 insertions, 35 deletions
diff --git a/comphelper/source/misc/anycompare.cxx b/comphelper/source/misc/anycompare.cxx
index 68cd6dc0f9d2..8a23877239be 100644
--- a/comphelper/source/misc/anycompare.cxx
+++ b/comphelper/source/misc/anycompare.cxx
@@ -26,10 +26,13 @@
#include <com/sun/star/util/Time.hpp>
#include <com/sun/star/util/DateTime.hpp>
+#include "typedescriptionref.hxx"
+
namespace comphelper
{
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Type;
+ using ::com::sun::star::uno::TypeDescription;
using ::com::sun::star::uno::TypeClass_CHAR;
using ::com::sun::star::uno::TypeClass_BOOLEAN;
using ::com::sun::star::uno::TypeClass_BYTE;
@@ -50,6 +53,7 @@ namespace comphelper
using ::com::sun::star::util::Date;
using ::com::sun::star::util::Time;
using ::com::sun::star::util::DateTime;
+ using ::comphelper::detail::TypeDescriptionRef;
namespace {
@@ -178,41 +182,6 @@ namespace comphelper
return std::nullopt; // equal, so can't yet tell if anyLess() should return
}
- using com::sun::star::uno::TypeDescription;
-
- // This is like com::sun::star::uno::TypeDescription, but it uses TYPELIB_DANGER_GET
- // (which the code used originally, but it's easier to have a class to handle ownership).
- class TypeDescriptionRef
- {
- public:
- TypeDescriptionRef( typelib_TypeDescriptionReference* typeDef )
- {
- TYPELIB_DANGER_GET( &typeDescr, typeDef );
- }
- ~TypeDescriptionRef()
- {
- TYPELIB_DANGER_RELEASE( typeDescr );
- }
- typelib_TypeDescription* get()
- {
- return typeDescr;
- }
- typelib_TypeDescription* operator->()
- {
- return typeDescr;
- }
- bool is()
- {
- return typeDescr != nullptr;
- }
- bool equals( const TypeDescriptionRef& other ) const
- {
- return typeDescr && other.typeDescr && typelib_typedescription_equals( typeDescr, other.typeDescr );
- }
- private:
- typelib_TypeDescription* typeDescr = nullptr;
- };
-
// This is typelib_typedescription_equals(), but returns -1/0/1 values like strcmp().
int compareTypes( const typelib_TypeDescription * lhsType,
const typelib_TypeDescription * rhsType )