This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch compilers-101 in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit eb379c74ea5657e495878a3b8177fc90a3ca8a91 Author: Pedro Giffuni <[email protected]> AuthorDate: Sun Nov 1 18:23:19 2026 -0500 C++11/Java 8 modernization: skeletonmaker, segmenttree, l10ntools, hash_map/unary_function cleanup --- main/crashrep/source/unx/main.cxx | 2 +- main/crashrep/source/win32/soreport.cpp | 2 +- main/extensions/source/ole/oleobjw.hxx | 2 +- .../source/ole/unoconversionutilities.hxx | 2 +- main/extensions/source/ole/unoobjw.cxx | 2 +- .../extensions/source/propctrlr/browserlistbox.hxx | 4 +- main/extensions/source/propctrlr/eventhandler.cxx | 2 +- main/extensions/source/propctrlr/eventhandler.hxx | 2 +- .../extensions/source/propctrlr/pcrcommontypes.hxx | 4 +- .../extensions/source/propctrlr/propcontroller.hxx | 8 +-- main/l10ntools/source/filter/merge/Merger.java | 12 ++--- .../source/filter/utils/ConfigHelper.java | 24 ++++----- main/l10ntools/source/filter/utils/XMLHelper.java | 27 +++++----- main/sc/inc/segmenttree.hxx | 3 ++ main/sc/source/core/data/segmenttree.cxx | 21 ++++++++ main/sfx2/inc/sfx2/sidebar/Theme.hxx | 4 +- main/sfx2/source/appl/imagemgr.cxx | 4 +- main/sfx2/source/appl/newhelp.cxx | 4 +- main/sfx2/source/appl/workwin.cxx | 4 +- main/sfx2/source/control/bindings.cxx | 4 +- main/sfx2/source/dialog/filtergrouping.cxx | 2 +- main/sfx2/source/doc/Metadatable.cxx | 14 +++--- main/sfx2/source/toolbox/imgmgr.cxx | 4 +- main/sfx2/source/view/sfxbasecontroller.cxx | 4 +- main/ucbhelper/source/provider/contenthelper.cxx | 4 +- main/ucbhelper/source/provider/providerhelper.cxx | 4 +- .../source/skeletonmaker/cpptypemaker.cxx | 6 +-- .../source/skeletonmaker/javacompskeleton.cxx | 58 +++++++--------------- .../source/skeletonmaker/javatypemaker.cxx | 10 ++-- .../source/skeletonmaker/skeletoncommon.cxx | 29 +++-------- .../source/skeletonmaker/skeletoncommon.hxx | 4 +- .../source/skeletonmaker/skeletonmaker.cxx | 20 +++----- main/xmlscript/source/xml_helper/xml_impctx.cxx | 8 +-- 33 files changed, 141 insertions(+), 163 deletions(-) diff --git a/main/crashrep/source/unx/main.cxx b/main/crashrep/source/unx/main.cxx index cc409e5644..ace17ddc55 100644 --- a/main/crashrep/source/unx/main.cxx +++ b/main/crashrep/source/unx/main.cxx @@ -36,7 +36,7 @@ #include <pthread.h> #include <limits.h> -#include <hash_map> +#include <unordered_map> #include <vector> #include <string> diff --git a/main/crashrep/source/win32/soreport.cpp b/main/crashrep/source/win32/soreport.cpp index 7443c1a1b3..d1b99c54e9 100644 --- a/main/crashrep/source/win32/soreport.cpp +++ b/main/crashrep/source/win32/soreport.cpp @@ -65,7 +65,7 @@ #include <io.h> #include <fcntl.h> #include <string> -#include <hash_map> +#include <unordered_map> #include <winsock.h> #include <malloc.h> #include <process.h> diff --git a/main/extensions/source/ole/oleobjw.hxx b/main/extensions/source/ole/oleobjw.hxx index 2b9e311126..fe4d211911 100644 --- a/main/extensions/source/ole/oleobjw.hxx +++ b/main/extensions/source/ole/oleobjw.hxx @@ -38,7 +38,7 @@ #endif #include <atlbase.h> #include <vector> -#include <hash_map> +#include <unordered_map> #include <tools/postsys.h> #ifdef _MSC_VER diff --git a/main/extensions/source/ole/unoconversionutilities.hxx b/main/extensions/source/ole/unoconversionutilities.hxx index 0c944c629e..1ecd842cbe 100644 --- a/main/extensions/source/ole/unoconversionutilities.hxx +++ b/main/extensions/source/ole/unoconversionutilities.hxx @@ -36,7 +36,7 @@ #include "ole2uno.hxx" #include "unotypewrapper.hxx" -#include <hash_map> +#include <unordered_map> // for some reason DECIMAL_NEG (wtypes.h) which contains BYTE is not resolved. typedef unsigned char BYTE; diff --git a/main/extensions/source/ole/unoobjw.cxx b/main/extensions/source/ole/unoobjw.cxx index 26504694e4..d0afde11c6 100644 --- a/main/extensions/source/ole/unoobjw.cxx +++ b/main/extensions/source/ole/unoobjw.cxx @@ -30,7 +30,7 @@ #include <olectl.h> #include <vector> #include <list> -#include <hash_map> +#include <unordered_map> #include "comifaces.hxx" #include <tools/postsys.h> diff --git a/main/extensions/source/propctrlr/browserlistbox.hxx b/main/extensions/source/propctrlr/browserlistbox.hxx index 3d652de352..1ae8f72cc6 100644 --- a/main/extensions/source/propctrlr/browserlistbox.hxx +++ b/main/extensions/source/propctrlr/browserlistbox.hxx @@ -44,7 +44,7 @@ #include <set> #include <vector> -#include <hash_map> +#include <unordered_map> #include <boost/shared_ptr.hpp> //............................................................................ @@ -75,7 +75,7 @@ namespace pcr { } }; - typedef ::std::hash_map< ::rtl::OUString, ListBoxLine, ::rtl::OUStringHash > ListBoxLines; + typedef ::std::unordered_map< ::rtl::OUString, ListBoxLine, ::rtl::OUStringHash > ListBoxLines; typedef ::std::vector< ListBoxLines::iterator > OrderedListBoxLines; //======================================================================== diff --git a/main/extensions/source/propctrlr/eventhandler.cxx b/main/extensions/source/propctrlr/eventhandler.cxx index fde873f2b4..7ee795efd3 100644 --- a/main/extensions/source/propctrlr/eventhandler.cxx +++ b/main/extensions/source/propctrlr/eventhandler.cxx @@ -351,7 +351,7 @@ namespace pcr class EventHolder : public EventHolder_Base { private: - typedef ::std::hash_map< ::rtl::OUString, ScriptEventDescriptor, ::rtl::OUStringHash > EventMap; + typedef ::std::unordered_map< ::rtl::OUString, ScriptEventDescriptor, ::rtl::OUStringHash > EventMap; typedef ::std::map< EventId, EventMap::iterator > EventMapIndexAccess; EventMap m_aEventNameAccess; diff --git a/main/extensions/source/propctrlr/eventhandler.hxx b/main/extensions/source/propctrlr/eventhandler.hxx index b592831ffc..2e5c606da2 100644 --- a/main/extensions/source/propctrlr/eventhandler.hxx +++ b/main/extensions/source/propctrlr/eventhandler.hxx @@ -72,7 +72,7 @@ namespace pcr const rtl::OString& _sUniqueBrowseId ); }; - typedef ::std::hash_map< ::rtl::OUString, EventDescription, ::rtl::OUStringHash > EventMap; + typedef ::std::unordered_map< ::rtl::OUString, EventDescription, ::rtl::OUStringHash > EventMap; //==================================================================== //= EventHandler diff --git a/main/extensions/source/propctrlr/pcrcommontypes.hxx b/main/extensions/source/propctrlr/pcrcommontypes.hxx index 2a29d9fb89..fd36490cf9 100644 --- a/main/extensions/source/propctrlr/pcrcommontypes.hxx +++ b/main/extensions/source/propctrlr/pcrcommontypes.hxx @@ -29,14 +29,14 @@ /** === end UNO includes === **/ #include <rtl/ustring.hxx> -#include <hash_map> +#include <unordered_map> //........................................................................ namespace pcr { //........................................................................ - typedef ::std::hash_map< ::rtl::OUString, ::com::sun::star::beans::Property, ::rtl::OUStringHash > + typedef ::std::unordered_map< ::rtl::OUString, ::com::sun::star::beans::Property, ::rtl::OUStringHash > PropertyMap; //........................................................................ diff --git a/main/extensions/source/propctrlr/propcontroller.hxx b/main/extensions/source/propctrlr/propcontroller.hxx index f455bf2245..bea96831cf 100644 --- a/main/extensions/source/propctrlr/propcontroller.hxx +++ b/main/extensions/source/propctrlr/propcontroller.hxx @@ -66,7 +66,7 @@ #include <comphelper/broadcasthelper.hxx> #include <map> -#include <hash_map> +#include <unordered_map> #include <vector> #include <memory> @@ -135,9 +135,9 @@ namespace pcr typedef ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > PropertyHandlerRef; typedef ::std::vector< PropertyHandlerRef > PropertyHandlerArray; - typedef ::std::hash_map< ::rtl::OUString, PropertyHandlerRef, ::rtl::OUStringHash > + typedef ::std::unordered_map< ::rtl::OUString, PropertyHandlerRef, ::rtl::OUStringHash > PropertyHandlerRepository; - typedef ::std::hash_multimap< ::rtl::OUString, PropertyHandlerRef, ::rtl::OUStringHash > + typedef ::std::unordered_multimap< ::rtl::OUString, PropertyHandlerRef, ::rtl::OUStringHash > PropertyHandlerMultiRepository; PropertyHandlerRepository m_aPropertyHandlers; PropertyHandlerMultiRepository m_aDependencyHandlers; @@ -155,7 +155,7 @@ namespace pcr /// the property we're just committing ::rtl::OUString m_sCommittingProperty; - typedef ::std::hash_map< ::rtl::OUString, sal_uInt16, ::rtl::OUStringHash > HashString2Int16; + typedef ::std::unordered_map< ::rtl::OUString, sal_uInt16, ::rtl::OUStringHash > HashString2Int16; HashString2Int16 m_aPageIds; bool m_bContainerFocusListening; diff --git a/main/l10ntools/source/filter/merge/Merger.java b/main/l10ntools/source/filter/merge/Merger.java index e2d1e0bec1..c154a4d771 100644 --- a/main/l10ntools/source/filter/merge/Merger.java +++ b/main/l10ntools/source/filter/merge/Merger.java @@ -101,10 +101,10 @@ public class Merger //------------------------------------------- /** TODO */ - private java.util.Vector m_lTypes; - private java.util.Vector m_lFilters; - private java.util.Vector m_lLoaders; - private java.util.Vector m_lHandlers; + private java.util.Vector<String> m_lTypes; + private java.util.Vector<String> m_lFilters; + private java.util.Vector<String> m_lLoaders; + private java.util.Vector<String> m_lHandlers; //___________________________________________ // interface @@ -208,7 +208,7 @@ public class Merger { java.lang.String sSetName = null; java.lang.String sSubDir = null; - java.util.Vector lFragments = null; + java.util.Vector<String> lFragments = null; try { @@ -286,7 +286,7 @@ public class Merger /** TODO */ private void getFragments(java.io.File aDir , java.lang.String sSetName , - java.util.Vector lFragments , + java.util.Vector<String> lFragments , int nPrettyTabs, java.lang.StringBuilder sBuffer ) throws java.lang.Exception diff --git a/main/l10ntools/source/filter/utils/ConfigHelper.java b/main/l10ntools/source/filter/utils/ConfigHelper.java index 855eb52ff8..ec918eaf15 100644 --- a/main/l10ntools/source/filter/utils/ConfigHelper.java +++ b/main/l10ntools/source/filter/utils/ConfigHelper.java @@ -165,12 +165,12 @@ public class ConfigHelper extends java.util.Properties * if the requested property does not exists. */ public synchronized boolean getBoolean(java.lang.String sProp) - throws java.util.NoSuchElementException + throws java.lang.Exception { - java.lang.String sValue = getProperty(sProp); + java.lang.String sValue = (java.lang.String)getProperty(sProp); if (sValue == null) - throw new java.util.NoSuchElementException("The requested config value \""+sProp+"\" does not exists!"); - return new java.lang.Boolean(sValue).booleanValue(); + throw new java.lang.Exception("missing property: \"" + sProp + "\""); + return java.lang.Boolean.valueOf(sValue).booleanValue(); } public synchronized boolean getBoolean(java.lang.String sProp , @@ -178,7 +178,7 @@ public class ConfigHelper extends java.util.Properties { java.lang.String sDefault = java.lang.String.valueOf(bDefault); java.lang.String sValue = getProperty(sProp, sDefault); - return new java.lang.Boolean(sValue).booleanValue(); + return java.lang.Boolean.valueOf(sValue).booleanValue(); } //------------------------------------------- @@ -193,12 +193,12 @@ public class ConfigHelper extends java.util.Properties * if the requested property does not exists. */ public synchronized int getInt(java.lang.String sProp) - throws java.util.NoSuchElementException + throws java.lang.Exception { - java.lang.String sValue = getProperty(sProp); + java.lang.String sValue = (java.lang.String)getProperty(sProp); if (sValue == null) - throw new java.util.NoSuchElementException("The requested config value \""+sProp+"\" does not exists!"); - return new java.lang.Integer(sValue).intValue(); + throw new java.lang.Exception("missing property: \"" + sProp + "\""); + return java.lang.Integer.parseInt(sValue); } public synchronized int getInt(java.lang.String sProp , @@ -206,7 +206,7 @@ public class ConfigHelper extends java.util.Properties { java.lang.String sDefault = java.lang.String.valueOf(nDefault); java.lang.String sValue = getProperty(sProp, sDefault); - return new java.lang.Integer(sValue).intValue(); + return java.lang.Integer.parseInt(sValue); } //------------------------------------------- @@ -256,7 +256,7 @@ public class ConfigHelper extends java.util.Properties * @throw [NoSuchElementException] * if the requested property does not exists. */ - public synchronized java.util.Vector getStringList(java.lang.String sProp , + public synchronized java.util.Vector<String> getStringList(java.lang.String sProp , java.lang.String sDelimiter, boolean bTrim , boolean bDecode ) @@ -266,7 +266,7 @@ public class ConfigHelper extends java.util.Properties if (sValue == null) throw new java.util.NoSuchElementException("The requested config value \""+sProp+"\" does not exists!"); - java.util.Vector lValue = new java.util.Vector(); + java.util.Vector<String> lValue = new java.util.Vector<String>(); try { java.util.StringTokenizer lTokens = new java.util.StringTokenizer(sValue, sDelimiter); diff --git a/main/l10ntools/source/filter/utils/XMLHelper.java b/main/l10ntools/source/filter/utils/XMLHelper.java index 615def6982..9226419794 100644 --- a/main/l10ntools/source/filter/utils/XMLHelper.java +++ b/main/l10ntools/source/filter/utils/XMLHelper.java @@ -118,17 +118,15 @@ public class XMLHelper * @return [java.util.HashMap] * contains every node name as key and its string(!) as value. */ - public static java.util.HashMap convertNodeToPropSet(org.w3c.dom.Node aNode) + public static java.util.HashMap<String, Object> convertNodeToPropSet(org.w3c.dom.Node aNode) throws java.lang.Exception { - java.util.HashMap aPropSet = new java.util.HashMap(); + java.util.HashMap<String, Object> aPropSet = new java.util.HashMap<String, Object>(); // get all child nodes, which seems to be properties - java.util.Vector lChildNodes = XMLHelper.extractChildNodesByTagName(aNode, XMLTAG_PROP); - java.util.Enumeration en1 = lChildNodes.elements(); - while(en1.hasMoreElements()) - { - org.w3c.dom.Node aChildNode = (org.w3c.dom.Node)en1.nextElement(); + java.util.Vector<org.w3c.dom.Node> lChildNodes = XMLHelper.extractChildNodesByTagName(aNode, XMLTAG_PROP); + for (int i = 0; i < lChildNodes.size(); ++i) { + org.w3c.dom.Node aChildNode = lChildNodes.get(i); // read its name java.lang.String sChildName = XMLHelper.extractNodeAttribByName(aChildNode, XMLATTRIB_OOR_NAME); @@ -149,13 +147,12 @@ public class XMLHelper } // read its value(s?) - java.util.Vector lChildValues = XMLHelper.extractChildNodesByTagName(aChildNode, XMLTAG_VALUE); - java.util.Enumeration en2 = lChildValues.elements(); + java.util.Vector<org.w3c.dom.Node> lChildValues = XMLHelper.extractChildNodesByTagName(aChildNode, XMLTAG_VALUE); int nValue = 0; java.lang.Object aValue = null; - while(en2.hasMoreElements()) + for (int vi = 0; vi < lChildValues.size(); ++vi) { - org.w3c.dom.Node aValueNode = (org.w3c.dom.Node)en2.nextElement(); + org.w3c.dom.Node aValueNode = lChildValues.get(vi); java.lang.String sChildLocale = XMLHelper.extractNodeAttribByName(aValueNode, XMLATTRIB_XML_LANG); boolean bLocalized = (sChildLocale != null); @@ -184,12 +181,12 @@ public class XMLHelper java.lang.String sData = ((org.w3c.dom.CharacterData)aValueNode.getFirstChild()).getData(); - java.util.HashMap lLocalized = null; + java.util.HashMap<String, String> lLocalized = null; if (bLocalized) { if (aValue == null) - aValue = new java.util.HashMap(); - lLocalized = (java.util.HashMap)aValue; + aValue = new java.util.HashMap<String, String>(); + lLocalized = (java.util.HashMap<String, String>)aValue; lLocalized.put(sChildLocale, sData); } else @@ -209,7 +206,7 @@ public class XMLHelper sData = sData.replace('\t', ' '); sData = sData.replace('\n', ' '); java.util.StringTokenizer aTokenizer = new java.util.StringTokenizer(sData, sSeparator); - java.util.Vector lList = new java.util.Vector(); + java.util.ArrayList<String> lList = new java.util.ArrayList<String>(); while(aTokenizer.hasMoreTokens()) { java.lang.String sToken = (java.lang.String)aTokenizer.nextToken(); diff --git a/main/sc/inc/segmenttree.hxx b/main/sc/inc/segmenttree.hxx index 4e3179fb3f..d4c1ee55f9 100644 --- a/main/sc/inc/segmenttree.hxx +++ b/main/sc/inc/segmenttree.hxx @@ -68,6 +68,7 @@ public: ScFlatBoolRowSegments(); ScFlatBoolRowSegments(const ScFlatBoolRowSegments& r); + ScFlatBoolRowSegments& operator=(const ScFlatBoolRowSegments& r); ~ScFlatBoolRowSegments(); void setTrue(SCROW nRow1, SCROW nRow2); @@ -99,6 +100,7 @@ public: }; ScFlatBoolColSegments(); ScFlatBoolColSegments(const ScFlatBoolColSegments& r); + ScFlatBoolColSegments& operator=(const ScFlatBoolColSegments& r); ~ScFlatBoolColSegments(); void setTrue(SCCOL nCol1, SCCOL nCol2); @@ -147,6 +149,7 @@ public: ScFlatUInt16RowSegments(sal_uInt16 nDefault); ScFlatUInt16RowSegments(const ScFlatUInt16RowSegments& r); + ScFlatUInt16RowSegments& operator=(const ScFlatUInt16RowSegments& r); ~ScFlatUInt16RowSegments(); void setValue(SCROW nRow1, SCROW nRow2, sal_uInt16 nValue); diff --git a/main/sc/source/core/data/segmenttree.cxx b/main/sc/source/core/data/segmenttree.cxx index 1149d7ec9f..371807191c 100644 --- a/main/sc/source/core/data/segmenttree.cxx +++ b/main/sc/source/core/data/segmenttree.cxx @@ -353,6 +353,13 @@ ScFlatBoolRowSegments::ScFlatBoolRowSegments(const ScFlatBoolRowSegments& r) : { } +ScFlatBoolRowSegments& ScFlatBoolRowSegments::operator=(const ScFlatBoolRowSegments& r) +{ + if (this != &r) + mpImpl.reset(new ScFlatBoolSegmentsImpl(*r.mpImpl)); + return *this; +} + ScFlatBoolRowSegments::~ScFlatBoolRowSegments() { } @@ -421,6 +428,13 @@ ScFlatBoolColSegments::ScFlatBoolColSegments(const ScFlatBoolColSegments& r) : { } +ScFlatBoolColSegments& ScFlatBoolColSegments::operator=(const ScFlatBoolColSegments& r) +{ + if (this != &r) + mpImpl.reset(new ScFlatBoolSegmentsImpl(*r.mpImpl)); + return *this; +} + ScFlatBoolColSegments::~ScFlatBoolColSegments() { } @@ -520,6 +534,13 @@ ScFlatUInt16RowSegments::ScFlatUInt16RowSegments(const ScFlatUInt16RowSegments& { } +ScFlatUInt16RowSegments& ScFlatUInt16RowSegments::operator=(const ScFlatUInt16RowSegments& r) +{ + if (this != &r) + mpImpl.reset(new ScFlatUInt16SegmentsImpl(*r.mpImpl)); + return *this; +} + ScFlatUInt16RowSegments::~ScFlatUInt16RowSegments() { } diff --git a/main/sfx2/inc/sfx2/sidebar/Theme.hxx b/main/sfx2/inc/sfx2/sidebar/Theme.hxx index 34d2b2b76d..e3b8460d34 100644 --- a/main/sfx2/inc/sfx2/sidebar/Theme.hxx +++ b/main/sfx2/inc/sfx2/sidebar/Theme.hxx @@ -34,7 +34,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> -#include <hash_map> +#include <unordered_map> #include <map> #include <boost/optional.hpp> @@ -203,7 +203,7 @@ private: bool mbIsHighContrastMode; bool mbIsHighContrastModeSetManually; - typedef ::std::hash_map<rtl::OUString,ThemeItem, rtl::OUStringHash> PropertyNameToIdMap; + typedef ::std::unordered_map<rtl::OUString,ThemeItem, rtl::OUStringHash> PropertyNameToIdMap; PropertyNameToIdMap maPropertyNameToIdMap; typedef ::std::vector<rtl::OUString> PropertyIdToNameMap; PropertyIdToNameMap maPropertyIdToNameMap; diff --git a/main/sfx2/source/appl/imagemgr.cxx b/main/sfx2/source/appl/imagemgr.cxx index 0968a86840..2ca27b625a 100644 --- a/main/sfx2/source/appl/imagemgr.cxx +++ b/main/sfx2/source/appl/imagemgr.cxx @@ -48,7 +48,7 @@ #include <sfx2/objsh.hxx> #include <sfx2/docfac.hxx> -#include <hash_map> +#include <unordered_map> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; @@ -57,7 +57,7 @@ using namespace ::com::sun::star::util; using namespace ::com::sun::star::ui; using namespace ::com::sun::star::frame; -typedef std::hash_map< ::rtl::OUString, +typedef std::unordered_map< ::rtl::OUString, WeakReference< XImageManager >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleIdToImagegMgr; diff --git a/main/sfx2/source/appl/newhelp.cxx b/main/sfx2/source/appl/newhelp.cxx index 7e1beb59d5..db57a794c7 100644 --- a/main/sfx2/source/appl/newhelp.cxx +++ b/main/sfx2/source/appl/newhelp.cxx @@ -41,7 +41,7 @@ #include "newhelp.hrc" #include "helpid.hrc" -#include <hash_map> +#include <unordered_map> #include <rtl/ustrbuf.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/configurationhelper.hxx> @@ -609,7 +609,7 @@ namespace sfx2 { } }; - typedef ::std::hash_map< ::rtl::OUString, int, hashOUString, equalOUString > KeywordInfo; + typedef ::std::unordered_map< ::rtl::OUString, int, hashOUString, equalOUString > KeywordInfo; } #define UNIFY_AND_INSERT_TOKEN( aToken ) \ diff --git a/main/sfx2/source/appl/workwin.cxx b/main/sfx2/source/appl/workwin.cxx index db6ee56ac9..b57fa1a78f 100644 --- a/main/sfx2/source/appl/workwin.cxx +++ b/main/sfx2/source/appl/workwin.cxx @@ -28,7 +28,7 @@ #endif #include <stdio.h> -#include <hash_map> +#include <unordered_map> #include <sfx2/docfile.hxx> #include <sfx2/objsh.hxx> @@ -319,7 +319,7 @@ void SAL_CALL LayoutManagerListener::layoutEvent( //==================================================================== -typedef std::hash_map< sal_Int32, rtl::OUString > ToolBarResIdToResourceURLMap; +typedef std::unordered_map< sal_Int32, rtl::OUString > ToolBarResIdToResourceURLMap; static sal_Bool bMapInitialized = sal_False; static ToolBarResIdToResourceURLMap aResIdToResourceURLMap; diff --git a/main/sfx2/source/control/bindings.cxx b/main/sfx2/source/control/bindings.cxx index b7ddc7bc34..b1540b872c 100644 --- a/main/sfx2/source/control/bindings.cxx +++ b/main/sfx2/source/control/bindings.cxx @@ -24,7 +24,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#include <hash_map> +#include <unordered_map> #include <svl/itempool.hxx> #include <svl/itemiter.hxx> #include <svl/eitem.hxx> @@ -96,7 +96,7 @@ static sal_uInt16 nTimeOut = 300; static sal_uInt32 nCache1 = 0; static sal_uInt32 nCache2 = 0; -typedef std::hash_map< sal_uInt16, bool > InvalidateSlotMap; +typedef std::unordered_map< sal_uInt16, bool > InvalidateSlotMap; //==================================================================== diff --git a/main/sfx2/source/dialog/filtergrouping.cxx b/main/sfx2/source/dialog/filtergrouping.cxx index e677f6a723..795b4bdf4b 100644 --- a/main/sfx2/source/dialog/filtergrouping.cxx +++ b/main/sfx2/source/dialog/filtergrouping.cxx @@ -42,7 +42,7 @@ #include <list> #include <vector> #include <map> -#include <algorithm> +#include <functional> //........................................................................ namespace sfx2 diff --git a/main/sfx2/source/doc/Metadatable.cxx b/main/sfx2/source/doc/Metadatable.cxx index 071e31cdab..39df8b8a91 100644 --- a/main/sfx2/source/doc/Metadatable.cxx +++ b/main/sfx2/source/doc/Metadatable.cxx @@ -34,7 +34,7 @@ #include <boost/bind.hpp> #include <memory> -#include <hash_map> +#include <unordered_map> #include <list> #include <algorithm> #if OSL_DEBUG_LEVEL > 0 @@ -397,11 +397,11 @@ XmlIdRegistry::GetXmlIdForElement(const Metadatable& i_rObject) const /// generate unique xml:id template< typename T > /*static*/ ::rtl::OUString create_id(const - ::std::hash_map< ::rtl::OUString, T, ::rtl::OUStringHash > & i_rXmlIdMap) + ::std::unordered_map< ::rtl::OUString, T, ::rtl::OUStringHash > & i_rXmlIdMap) { static rtlRandomPool s_Pool( rtl_random_createPool() ); const ::rtl::OUString prefix( ::rtl::OUString::createFromAscii(s_prefix) ); - typename ::std::hash_map< ::rtl::OUString, T, ::rtl::OUStringHash > + typename ::std::unordered_map< ::rtl::OUString, T, ::rtl::OUStringHash > ::const_iterator iter; ::rtl::OUString id; do @@ -422,7 +422,7 @@ template< typename T > typedef ::std::list< Metadatable* > XmlIdList_t; /// Idref -> (content.xml element list, styles.xml element list) -typedef ::std::hash_map< ::rtl::OUString, +typedef ::std::unordered_map< ::rtl::OUString, ::std::pair< XmlIdList_t, XmlIdList_t >, ::rtl::OUStringHash > XmlIdMap_t; /// pointer hash template @@ -435,7 +435,7 @@ template<typename T> struct PtrHash }; /// element -> (stream name, idref) -typedef ::std::hash_map< const Metadatable*, +typedef ::std::unordered_map< const Metadatable*, ::std::pair< ::rtl::OUString, ::rtl::OUString>, PtrHash<Metadatable> > XmlIdReverseMap_t; @@ -918,13 +918,13 @@ struct RMapEntry }; /// element -> (stream name, idref, source) -typedef ::std::hash_map< const Metadatable*, +typedef ::std::unordered_map< const Metadatable*, struct RMapEntry, PtrHash<Metadatable> > ClipboardXmlIdReverseMap_t; /// Idref -> (content.xml element, styles.xml element) -typedef ::std::hash_map< ::rtl::OUString, +typedef ::std::unordered_map< ::rtl::OUString, ::std::pair< Metadatable*, Metadatable* >, ::rtl::OUStringHash > ClipboardXmlIdMap_t; diff --git a/main/sfx2/source/toolbox/imgmgr.cxx b/main/sfx2/source/toolbox/imgmgr.cxx index d9db942f1f..c2bc2a2075 100644 --- a/main/sfx2/source/toolbox/imgmgr.cxx +++ b/main/sfx2/source/toolbox/imgmgr.cxx @@ -25,7 +25,7 @@ #include "precompiled_sfx2.hxx" #include <stdio.h> -#include <hash_map> +#include <unordered_map> #include "sfx2/imgmgr.hxx" #include <sfx2/sfx.hrc> @@ -78,7 +78,7 @@ public: ~SfxImageManager_Impl(); }; -typedef std::hash_map< sal_Int64, sal_Int64 > SfxImageManagerMap; +typedef std::unordered_map< sal_Int64, sal_Int64 > SfxImageManagerMap; // global image lists static SfxImageManager_Impl* pGlobalImageManager = 0; diff --git a/main/sfx2/source/view/sfxbasecontroller.cxx b/main/sfx2/source/view/sfxbasecontroller.cxx index 65539939dd..82861f673d 100644 --- a/main/sfx2/source/view/sfxbasecontroller.cxx +++ b/main/sfx2/source/view/sfxbasecontroller.cxx @@ -86,7 +86,7 @@ #include <comphelper/processfactory.hxx> #include <tools/diagnose_ex.h> -#include <hash_map> +#include <unordered_map> #include <sfx2/event.hxx> #include "sfx2/viewfac.hxx" @@ -173,7 +173,7 @@ static GroupIDToCommandGroup GroupIDCommandGroupMap[] = { 0 , 0 } }; -typedef std::hash_map< sal_Int16, sal_Int16 > GroupHashMap; +typedef std::unordered_map< sal_Int16, sal_Int16 > GroupHashMap; sal_Int16 MapGroupIDToCommandGroup( sal_Int16 nGroupID ) diff --git a/main/ucbhelper/source/provider/contenthelper.cxx b/main/ucbhelper/source/provider/contenthelper.cxx index 1998d42b47..df6fd1ed83 100644 --- a/main/ucbhelper/source/provider/contenthelper.cxx +++ b/main/ucbhelper/source/provider/contenthelper.cxx @@ -29,7 +29,7 @@ *************************************************************************/ -#include <hash_map> +#include <unordered_map> #include <com/sun/star/ucb/ContentAction.hpp> #include <com/sun/star/ucb/CommandInfoChange.hpp> #include <com/sun/star/ucb/XPersistentPropertySet.hpp> @@ -97,7 +97,7 @@ struct hashPtr } }; -typedef std::hash_map +typedef std::unordered_map < XPropertiesChangeListenerPtr, PropertyEventSequence*, diff --git a/main/ucbhelper/source/provider/providerhelper.cxx b/main/ucbhelper/source/provider/providerhelper.cxx index 1826460c9c..cd8d011d78 100644 --- a/main/ucbhelper/source/provider/providerhelper.cxx +++ b/main/ucbhelper/source/provider/providerhelper.cxx @@ -30,7 +30,7 @@ *************************************************************************/ -#include <hash_map> +#include <unordered_map> #include <com/sun/star/beans/XPropertyAccess.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNamed.hpp> @@ -72,7 +72,7 @@ struct hashString } }; -typedef std::hash_map +typedef std::unordered_map < rtl::OUString, uno::WeakReference< ucb::XContent >, diff --git a/main/unodevtools/source/skeletonmaker/cpptypemaker.cxx b/main/unodevtools/source/skeletonmaker/cpptypemaker.cxx index e74045db91..3eb2ebf2c5 100644 --- a/main/unodevtools/source/skeletonmaker/cpptypemaker.cxx +++ b/main/unodevtools/source/skeletonmaker/cpptypemaker.cxx @@ -693,7 +693,7 @@ void printMapsToCppType(std::ostream & o, OString const & name, sal_Int32 rank, std::vector< OString > const & arguments, const char * cppTypeSort) { - o << "maps to C++ "; + o << "maps to C++11 "; if (cppTypeSort != 0) o << cppTypeSort << ' '; @@ -857,11 +857,11 @@ void generateDocumentation(std::ostream & o, } else if (arguments.empty()) { printMapsToCppType(o, options, manager, sort, typeClass, name, rank, arguments, - options.java5 ? "generic class" : "class"); + "generic class"); } else { printMapsToCppType(o, options, manager, sort, typeClass, name, rank, arguments, - options.java5 ? "generic class instantiation" : "class"); + "generic class instantiation"); } o << "; full constructor:\n"; printConstructor(o, options, manager, reader, arguments); diff --git a/main/unodevtools/source/skeletonmaker/javacompskeleton.cxx b/main/unodevtools/source/skeletonmaker/javacompskeleton.cxx index a8fb87ada3..92162a346d 100644 --- a/main/unodevtools/source/skeletonmaker/javacompskeleton.cxx +++ b/main/unodevtools/source/skeletonmaker/javacompskeleton.cxx @@ -338,37 +338,21 @@ void generateXAddInBodies(std::ostream& o, ProgramOptions const & options) // getDisplayArgumentName o << " public String getDisplayArgumentName(String " - "aProgrammaticFunctionName, int nArgument)\n {\n"; - if (options.java5) { - o << " return getAddinProperty(aProgrammaticFunctionName,\n" - " m_functionMap.get(\n" - " aProgrammaticFunctionName).get(" - "nArgument),\n" - " sDISPLAYNAME);\n }\n\n"; - } else { - o << " return getAddinProperty(aProgrammaticFunctionName, (String)\n" - " ((java.util.Hashtable)m_functionMap." - "get(\n aProgrammaticFunctionName))." - "get(\n new Integer(nArgument))" - ", sDISPLAYNAME);\n }\n\n"; - } + "aProgrammaticFunctionName, int nArgument)\n {\n" + " return getAddinProperty(aProgrammaticFunctionName,\n" + " ((java.util.Hashtable<Integer, String>)m_functionMap.get(\n" + " aProgrammaticFunctionName)).get(\n" + " Integer.valueOf(nArgument)),\n" + " sDISPLAYNAME);\n }\n\n"; // getArgumentDescription o << " public String getArgumentDescription(String " - "aProgrammaticFunctionName, int nArgument)\n {\n"; - if (options.java5) { - o << " return getAddinProperty(aProgrammaticFunctionName,\n" - " m_functionMap.get(\n" - " aProgrammaticFunctionName).get(" - "nArgument),\n" - " sDESCRIPTION);\n }\n\n"; - } else { - o << " return getAddinProperty(aProgrammaticFunctionName, (String)\n" - " ((java.util.Hashtable)m_functionMap." - "get(\n aProgrammaticFunctionName))." - "get(\n new Integer(nArgument))" - ", sDESCRIPTION);\n }\n\n"; - } + "aProgrammaticFunctionName, int nArgument)\n {\n" + " return getAddinProperty(aProgrammaticFunctionName,\n" + " ((java.util.Hashtable<Integer, String>)m_functionMap.get(\n" + " aProgrammaticFunctionName)).get(\n" + " Integer.valueOf(nArgument)),\n" + " sDESCRIPTION);\n }\n\n"; // getProgrammaticCategoryName o << " public String getProgrammaticCategoryName(String " "aProgrammaticFunctionName)\n {\n" @@ -628,24 +612,16 @@ void generateAddinConstructorAndHelper(std::ostream& o, "m_xHAccess = null;\n" " private com.sun.star.container.XHierarchicalNameAccess " "m_xCompAccess = null;\n"; - if (options.java5) { - o << " private java.util.Hashtable<\n String, " - "java.util.Hashtable< Integer, String> > m_functionMap = null;\n\n"; - } else { - o << " private java.util.Hashtable m_functionMap = null;\n\n"; - } + o << " private java.util.Hashtable<\n String, " + "java.util.Hashtable<Integer, String> > m_functionMap = null;\n\n"; // Constructor o << "\n public " << classname << "( XComponentContext context )\n {\n" " m_xContext = context;\n\n" " try {\n"; - if (options.java5) { - o << " m_functionMap = new java.util.Hashtable<\n" - " String, java.util.Hashtable< Integer, " - "String > >();\n\n"; - } else { - o << " m_functionMap = new java.util.Hashtable();\n\n"; - } + o << " m_functionMap = new java.util.Hashtable<\n" + " String, java.util.Hashtable<Integer, " + "String> >();\n\n"; generateFunctionParameterMap(o, options, manager, interfaces); diff --git a/main/unodevtools/source/skeletonmaker/javatypemaker.cxx b/main/unodevtools/source/skeletonmaker/javatypemaker.cxx index ee1626295d..50da97d143 100644 --- a/main/unodevtools/source/skeletonmaker/javatypemaker.cxx +++ b/main/unodevtools/source/skeletonmaker/javatypemaker.cxx @@ -90,7 +90,7 @@ void printType(std::ostream & o, if ( sType.indexOf("java.lang.") == 0 ) sType = sType.copy(10); o << sType.getStr(); - if ( !arguments.empty() && options.java5 ) { + if ( !arguments.empty() ) { o << '<'; for ( std::vector< OString >::const_iterator i(arguments.begin()); i != arguments.end(); ++i ) @@ -217,7 +217,7 @@ void printMethodParameters(std::ostream & o, } else if ( (reader.getMethodParameterFlags(method, i) & RT_PARAM_REST ) != 0) { - o << (options.java5 ? "..." : "[]"); + o << "..."; } o << ' '; } @@ -636,7 +636,7 @@ void printMapsToJavaType(std::ostream & o, OString const & name, sal_Int32 rank, std::vector< OString > const & arguments, const char * javaTypeSort) { - o << "maps to Java " << (options.java5 ? "1.5" : "1.4") << " "; + o << "maps to Java " << (options.java8 ? "1.8" : "1.4") << " "; if ( javaTypeSort != 0 ) { o << javaTypeSort << ' '; } @@ -795,11 +795,11 @@ void generateDocumentation(std::ostream & o, } else if ( arguments.empty() ) { printMapsToJavaType(o, options, manager, sort, typeClass, name, rank, arguments, - options.java5 ? "generic class" : "class"); + "generic class"); } else { printMapsToJavaType(o, options, manager, sort, typeClass, name, rank, arguments, - options.java5 ? "generic class instantiation" : "class"); + "generic class instantiation"); } o << "; full constructor:\n"; printConstructor(o, options, manager, reader, arguments); diff --git a/main/unodevtools/source/skeletonmaker/skeletoncommon.cxx b/main/unodevtools/source/skeletonmaker/skeletoncommon.cxx index 9047916e4c..c0a9a377d8 100644 --- a/main/unodevtools/source/skeletonmaker/skeletoncommon.cxx +++ b/main/unodevtools/source/skeletonmaker/skeletoncommon.cxx @@ -635,12 +635,8 @@ void generateFunctionParamterMap(std::ostream& o, o << " ParamMap fpm;\n"; } else { - if ( options.java5 ) - o << " java.util.Hashtable< Integer, String > fpm = " - "new java.util.Hashtable< Integer, String >();\n"; - else - o << " java.util.Hashtable fpm = " - "new java.util.Hashtable();\n"; + o << " java.util.Hashtable<Integer, String> fpm = " + "new java.util.Hashtable<Integer, String>();\n"; } bFirst = false; } else @@ -648,11 +644,8 @@ void generateFunctionParamterMap(std::ostream& o, o << " fpm = ParamMap();\n"; } else { - if ( options.java5 ) - o << " fpm = new java.util.Hashtable< " - "Integer, String >();\n"; - else - o << " fpm = new java.util.Hashtable();\n"; + o << " fpm = new java.util.Hashtable< " + "Integer, String>();\n"; } for ( sal_uInt16 p = 0; p < reader.getMethodParameterCount(m); ++p ) { @@ -663,16 +656,10 @@ void generateFunctionParamterMap(std::ostream& o, << "\");\n"; } else { - if ( options.java5 ) - o << " fpm.put(" << p << ", \"" - << codemaker::convertString( - reader.getMethodParameterName(m, p)) - << "\");\n"; - else - o << " fpm.put(new Integer(" << p << "), \"" - << codemaker::convertString( - reader.getMethodParameterName(m, p)) - << "\");\n"; + o << " fpm.put(" << p << ", \"" + << codemaker::convertString( + reader.getMethodParameterName(m, p)) + << "\");\n"; } } diff --git a/main/unodevtools/source/skeletonmaker/skeletoncommon.hxx b/main/unodevtools/source/skeletonmaker/skeletoncommon.hxx index 5684a21db9..c9f197a277 100644 --- a/main/unodevtools/source/skeletonmaker/skeletoncommon.hxx +++ b/main/unodevtools/source/skeletonmaker/skeletoncommon.hxx @@ -44,11 +44,11 @@ typedef ::std::vector< ::std::pair< rtl::OString, struct ProgramOptions { - ProgramOptions(): java5(true), all(false), dump(false), license(false), + ProgramOptions(): java8(true), all(false), dump(false), license(false), shortnames(false), supportpropertysetmixin(false), backwardcompatible(false), language(1), componenttype(1) {} - bool java5; + bool java8; bool all; bool dump; bool license; diff --git a/main/unodevtools/source/skeletonmaker/skeletonmaker.cxx b/main/unodevtools/source/skeletonmaker/skeletonmaker.cxx index c39aed7479..e02777250c 100644 --- a/main/unodevtools/source/skeletonmaker/skeletonmaker.cxx +++ b/main/unodevtools/source/skeletonmaker/skeletonmaker.cxx @@ -61,11 +61,10 @@ static const char usageText[] = " a space separated list of urls.\n" " -a, --all list all interface methods, not only the direct\n" " ones\n" -" --(java4|java5|cpp) select the target language\n" -" --java4 generate output for Java 1.4 or earlier\n" -" --java5 generate output for Java 1.5 or later (is \n" -" currently the default)\n" -" --cpp generate output for C++\n" + " --(java8|cpp) select the target language\n" + " --java8 generate output for Java 1.8 or later (is \n" + " currently the default)\n" + " --cpp generate output for C++\n" " -sn, --shortnames using namespace abbreviation 'css:': for\n" " '::com::sun::star::', only valid for sub-command\n" " 'dump' and target language 'cpp'. It is default for the\n" @@ -200,18 +199,13 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, /*argv*/) options.all = true; continue; } - if ( readOption( &bOption, "java4", &nPos, arg) ) { - options.java5 = false; - options.language = 1; - continue; - } - if ( readOption( &bOption, "java5", &nPos, arg) ) { - options.java5 = true; + if ( readOption( &bOption, "java4", &nPos, arg) || readOption( &bOption, "java5", &nPos, arg) || readOption( &bOption, "java8", &nPos, arg) ) { + options.java8 = true; options.language = 1; continue; } if ( readOption( &bOption, "cpp", &nPos, arg) ) { - options.java5 = false; + options.java8 = false; options.language = 2; continue; } diff --git a/main/xmlscript/source/xml_helper/xml_impctx.cxx b/main/xmlscript/source/xml_helper/xml_impctx.cxx index 2055cae8e3..f8eabefd6e 100644 --- a/main/xmlscript/source/xml_helper/xml_impctx.cxx +++ b/main/xmlscript/source/xml_helper/xml_impctx.cxx @@ -38,7 +38,7 @@ #include "com/sun/star/uno/XComponentContext.hpp" #include <vector> -#include <hash_map> +#include <unordered_map> #include <memory> @@ -66,8 +66,8 @@ OUString getImplementationName_DocumentHandlerImpl() "com.sun.star.comp.xml.input.SaxDocumentHandler") ); } -typedef ::std::hash_map< OUString, sal_Int32, OUStringHash > t_OUString2LongMap; -typedef ::std::hash_map< sal_Int32, OUString > t_Long2OUStringMap; +typedef ::std::unordered_map< OUString, sal_Int32, OUStringHash > t_OUString2LongMap; +typedef ::std::unordered_map< sal_Int32, OUString > t_Long2OUStringMap; struct PrefixEntry { @@ -77,7 +77,7 @@ struct PrefixEntry { m_Uids.reserve( 4 ); } }; -typedef ::std::hash_map< +typedef ::std::unordered_map< OUString, PrefixEntry *, OUStringHash > t_OUString2PrefixMap; struct ElementEntry
