summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-03-07 23:39:25 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-03-10 08:59:23 +0100
commitdb5c67e1006664916b7b4c8881d21cf096333ee7 (patch)
tree02b11f8c940bbdd6071f2994ace7352255d500f2 /include
parentf351fd1e8eb75a25e7844ac632e5837851b2aeed (diff)
Keying on XTypeProvider::getImplementationId is unnecessary here
...given that cases where "every instance of getPropertySetInfo returns a new object [...] must not be cached" anyway, so just key on the XPropertySetInfo instances. Change-Id: I11f0a1fe030226d1d26d6b6e6a2654f4511fdce8
Diffstat (limited to 'include')
-rw-r--r--include/xmloff/PropertySetInfoHash.hxx59
-rw-r--r--include/xmloff/PropertySetInfoKey.hxx61
-rw-r--r--include/xmloff/SinglePropertySetInfoCache.hxx21
3 files changed, 9 insertions, 132 deletions
diff --git a/include/xmloff/PropertySetInfoHash.hxx b/include/xmloff/PropertySetInfoHash.hxx
deleted file mode 100644
index 4f987ca8e424..000000000000
--- a/include/xmloff/PropertySetInfoHash.hxx
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_XMLOFF_PROPERTYSETINFOHASH_HXX
-#define INCLUDED_XMLOFF_PROPERTYSETINFOHASH_HXX
-
-#include <xmloff/PropertySetInfoKey.hxx>
-
-#include <string.h>
-#include <memory>
-
-struct PropertySetInfoHash
-{
- inline size_t operator()( const PropertySetInfoKey& r ) const;
- inline bool operator()( const PropertySetInfoKey& r1,
- const PropertySetInfoKey& r2 ) const;
-};
-
-inline size_t PropertySetInfoHash::operator()(
- const PropertySetInfoKey& r ) const
-{
- const sal_Int32* pBytesAsInt32Array =
- (const sal_Int32*)r.aImplementationId.getConstArray();
- sal_Int32 nId32 = pBytesAsInt32Array[0] ^
- pBytesAsInt32Array[1] ^
- pBytesAsInt32Array[2] ^
- pBytesAsInt32Array[3];
- return (size_t)nId32 ^ (size_t)r.xPropInfo.get();
-}
-
-inline bool PropertySetInfoHash::operator()(
- const PropertySetInfoKey& r1,
- const PropertySetInfoKey& r2 ) const
-{
- if( r1.xPropInfo != r2.xPropInfo )
- return false;
-
- const sal_Int8* pId1 = r1.aImplementationId.getConstArray();
- const sal_Int8* pId2 = r2.aImplementationId.getConstArray();
- return memcmp( pId1, pId2, 16 * sizeof( sal_Int8 ) ) == 0;
-}
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/PropertySetInfoKey.hxx b/include/xmloff/PropertySetInfoKey.hxx
deleted file mode 100644
index ab55c74d6b61..000000000000
--- a/include/xmloff/PropertySetInfoKey.hxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_XMLOFF_PROPERTYSETINFOKEY_HXX
-#define INCLUDED_XMLOFF_PROPERTYSETINFOKEY_HXX
-
-#include <osl/diagnose.h>
-#include <com/sun/star/uno/Sequence.hxx>
-
-namespace com { namespace sun { namespace star {
- namespace beans { class XPropertySetInfo; }
-} } }
-
-
-struct PropertySetInfoKey
-{
- ::com::sun::star::uno::Reference <
- ::com::sun::star::beans::XPropertySetInfo > xPropInfo;
- ::com::sun::star::uno::Sequence < sal_Int8 > aImplementationId;
-
- inline PropertySetInfoKey();
- inline PropertySetInfoKey(
- const ::com::sun::star::uno::Reference <
- ::com::sun::star::beans::XPropertySetInfo >& rPropInfo,
- const ::com::sun::star::uno::Sequence < sal_Int8 >& rImplId );
-};
-
-inline PropertySetInfoKey::PropertySetInfoKey()
-{
- OSL_ENSURE( aImplementationId.getLength()==16, "illegal constructor call" );
-}
-
-inline PropertySetInfoKey::PropertySetInfoKey(
- const ::com::sun::star::uno::Reference <
- ::com::sun::star::beans::XPropertySetInfo >& rPropInfo,
- const ::com::sun::star::uno::Sequence < sal_Int8 >& rImplId ) :
- xPropInfo( rPropInfo ),
- aImplementationId( rImplId )
-{
- OSL_ENSURE( rPropInfo.is(), "prop info missing" );
- OSL_ENSURE( aImplementationId.getLength()==16, "invalid implementation id" );
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/SinglePropertySetInfoCache.hxx b/include/xmloff/SinglePropertySetInfoCache.hxx
index 55c37aaa8f9d..85ff232be964 100644
--- a/include/xmloff/SinglePropertySetInfoCache.hxx
+++ b/include/xmloff/SinglePropertySetInfoCache.hxx
@@ -20,23 +20,19 @@
#ifndef INCLUDED_XMLOFF_SINGLEPROPERTYSETINFOCACHE_HXX
#define INCLUDED_XMLOFF_SINGLEPROPERTYSETINFOCACHE_HXX
-#include <com/sun/star/beans/XPropertySet.hpp>
+#include <sal/config.h>
-#include <boost/unordered_map.hpp>
-#include <xmloff/PropertySetInfoHash.hxx>
+#include <map>
-typedef boost::unordered_map
-<
- PropertySetInfoKey,
- sal_Bool,
- PropertySetInfoHash,
- PropertySetInfoHash
->
-SinglePropertySetInfoMap_Impl;
+#include <com/sun/star/beans/XPropertySet.hpp>
-class SinglePropertySetInfoCache : private SinglePropertySetInfoMap_Impl
+class SinglePropertySetInfoCache
{
+ typedef std::map<css::uno::Reference<css::beans::XPropertySetInfo>, bool>
+ Map;
+
OUString sName;
+ Map map_;
public:
@@ -48,6 +44,7 @@ public:
::com::sun::star::beans::XPropertySet >& rPropSet,
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySetInfo >& rPropSetInfo );
+
inline sal_Bool hasProperty(
const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet>& rPropSet );