summaryrefslogtreecommitdiff
path: root/salhelper
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2013-04-19 18:54:16 +0200
committerDavid Tardon <dtardon@redhat.com>2013-04-24 05:17:10 +0000
commit6c7659b584ea7ed3652ca4eb9a2297f36310c365 (patch)
treeadf631e2d3db309b0696babd9d026bce0996c215 /salhelper
parent24500d6798007d84521eb24a81c121ebe69d3bfd (diff)
move URE headers to include/
Change-Id: Ib48a12e902f2311c295b2007f08f44dee28f431d Reviewed-on: https://gerrit.libreoffice.org/3499 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'salhelper')
-rw-r--r--salhelper/CppunitTest_salhelper_checkapi.mk45
-rw-r--r--salhelper/CustomTarget_salhelper_allheaders.mk44
-rw-r--r--salhelper/Library_salhelper.mk2
-rw-r--r--salhelper/Module_salhelper.mk3
-rw-r--r--salhelper/Package_salhelper_odk_headers.mk44
-rw-r--r--salhelper/inc/salhelper/condition.hxx118
-rw-r--r--salhelper/inc/salhelper/dynload.hxx204
-rw-r--r--salhelper/inc/salhelper/linkhelper.hxx75
-rw-r--r--salhelper/inc/salhelper/refobj.hxx104
-rw-r--r--salhelper/inc/salhelper/salhelperdllapi.h34
-rw-r--r--salhelper/inc/salhelper/simplereferenceobject.hxx131
-rw-r--r--salhelper/inc/salhelper/singletonref.hxx197
-rw-r--r--salhelper/inc/salhelper/thread.hxx93
-rw-r--r--salhelper/inc/salhelper/timer.hxx230
14 files changed, 0 insertions, 1324 deletions
diff --git a/salhelper/CppunitTest_salhelper_checkapi.mk b/salhelper/CppunitTest_salhelper_checkapi.mk
deleted file mode 100644
index fed7e58a2444..000000000000
--- a/salhelper/CppunitTest_salhelper_checkapi.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*-
-#
-# Version: MPL 1.1 / GPLv3+ / LGPLv3+
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License or as specified alternatively below. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# Major Contributor(s):
-# Copyright (C) 2011 Matúš Kukan <matus.kukan@gmail.com> (initial developer)
-#
-# All Rights Reserved.
-#
-# For minor contributions see the git repository.
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-# instead of those above.
-
-$(eval $(call gb_CppunitTest_CppunitTest,salhelper_checkapi))
-
-$(eval $(call gb_CppunitTest_use_custom_headers,salhelper_checkapi,\
- salhelper/allheaders \
-))
-
-$(eval $(call gb_CppunitTest_use_external,salhelper_checkapi,boost_headers))
-
-$(eval $(call gb_CppunitTest_add_exception_objects,salhelper_checkapi,\
- salhelper/qa/checkapi/strings \
-))
-
-$(eval $(call gb_CppunitTest_use_libraries,salhelper_checkapi,\
- salhelper \
- $(gb_UWINAPI) \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/salhelper/CustomTarget_salhelper_allheaders.mk b/salhelper/CustomTarget_salhelper_allheaders.mk
deleted file mode 100644
index 0415ccfd4022..000000000000
--- a/salhelper/CustomTarget_salhelper_allheaders.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*-
-#
-# Version: MPL 1.1 / GPLv3+ / LGPLv3+
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License or as specified alternatively below. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# Major Contributor(s):
-# Copyright (C) 2011 Matúš Kukan <matus.kukan@gmail.com> (initial developer)
-#
-# All Rights Reserved.
-#
-# For minor contributions see the git repository.
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-# instead of those above.
-
-$(eval $(call gb_CustomTarget_CustomTarget,salhelper/allheaders))
-
-salhelper_allheaders_DIR := $(call gb_CustomTarget_get_workdir,salhelper/allheaders)
-
-$(call gb_CustomTarget_get_target,salhelper/allheaders) : \
- $(salhelper_allheaders_DIR)/salhelper_allheaders.hxx
-
-$(salhelper_allheaders_DIR)/salhelper_allheaders.hxx : \
- $(call gb_Package_get_target,salhelper_odk_headers) \
- | $(salhelper_allheaders_DIR)/.dir
- $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ECH,1)
- printf '// Generated list of salhelper includes\n' > $@ \
- $(foreach file,$(shell cat $<),\
- && printf '#include <%s>\n' $(subst $(INSTDIR)/$(gb_Package_SDKDIRNAME)/include/,,$(file)) >> $@ \
- )
-
-# vim: set noet sw=4 ts=4:
diff --git a/salhelper/Library_salhelper.mk b/salhelper/Library_salhelper.mk
index 26c90dcd81c6..12735dd9f0a2 100644
--- a/salhelper/Library_salhelper.mk
+++ b/salhelper/Library_salhelper.mk
@@ -27,8 +27,6 @@
$(eval $(call gb_Library_Library,salhelper))
-$(eval $(call gb_Library_use_package,salhelper,salhelper_odk_headers))
-
$(eval $(call gb_Library_add_defs,salhelper,\
-DSALHELPER_DLLIMPLEMENTATION \
))
diff --git a/salhelper/Module_salhelper.mk b/salhelper/Module_salhelper.mk
index 7ba68a90c4fa..712872a5f9ad 100644
--- a/salhelper/Module_salhelper.mk
+++ b/salhelper/Module_salhelper.mk
@@ -28,13 +28,10 @@
$(eval $(call gb_Module_Module,salhelper))
$(eval $(call gb_Module_add_targets,salhelper,\
- CustomTarget_salhelper_allheaders \
Library_salhelper \
- Package_salhelper_odk_headers \
))
$(eval $(call gb_Module_add_check_targets,salhelper,\
- CppunitTest_salhelper_checkapi \
CppunitTest_salhelper_testapi \
))
diff --git a/salhelper/Package_salhelper_odk_headers.mk b/salhelper/Package_salhelper_odk_headers.mk
deleted file mode 100644
index 89ae6148a477..000000000000
--- a/salhelper/Package_salhelper_odk_headers.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*-
-#
-# Version: MPL 1.1 / GPLv3+ / LGPLv3+
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License or as specified alternatively below. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# Major Contributor(s):
-# Copyright (C) 2011 Matúš Kukan <matus.kukan@gmail.com>
-#
-# All Rights Reserved.
-#
-# For minor contributions see the git repository.
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-# instead of those above.
-
-$(eval $(call gb_Package_Package,salhelper_odk_headers,$(SRCDIR)/salhelper/inc/salhelper))
-
-$(eval $(call gb_Package_set_outdir,salhelper_odk_headers,$(INSTDIR)))
-
-$(eval $(call gb_Package_add_files,salhelper_odk_headers,$(gb_Package_SDKDIRNAME)/include/salhelper,\
- salhelperdllapi.h \
- condition.hxx \
- dynload.hxx \
- linkhelper.hxx \
- refobj.hxx \
- simplereferenceobject.hxx \
- singletonref.hxx \
- thread.hxx \
- timer.hxx \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/salhelper/inc/salhelper/condition.hxx b/salhelper/inc/salhelper/condition.hxx
deleted file mode 100644
index 459f39d354bc..000000000000
--- a/salhelper/inc/salhelper/condition.hxx
+++ /dev/null
@@ -1,118 +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 _SALHELPER_CONDITION_HXX_
-#define _SALHELPER_CONDITION_HXX_
-
-
-#include <osl/conditn.h>
-#include <osl/mutex.hxx>
-#include "salhelperdllapi.h"
-
-namespace salhelper
-{
- class ConditionModifier;
- class ConditionWaiter;
-
-
- class SALHELPER_DLLPUBLIC Condition
- {
- friend class ConditionModifier;
- friend class ConditionWaiter;
-
- public:
-
- Condition(osl::Mutex& aMutex);
-
- virtual ~Condition();
-
-
- protected:
-
- virtual bool applies() const = 0;
-
-
- private:
- SALHELPER_DLLPRIVATE Condition(Condition &); // not defined
- SALHELPER_DLLPRIVATE void operator =(Condition &); // not defined
-
- osl::Mutex& m_aMutex;
- oslCondition m_aCondition;
- };
-
-
-
- class SALHELPER_DLLPUBLIC ConditionModifier
- {
- public:
-
- ConditionModifier(Condition& aCond);
-
- ~ConditionModifier();
-
-
- private:
- SALHELPER_DLLPRIVATE ConditionModifier(ConditionModifier &); // not defined
- SALHELPER_DLLPRIVATE void operator =(ConditionModifier &); // not defined
-
- Condition& m_aCond;
- };
-
-
-
- class SALHELPER_DLLPUBLIC ConditionWaiter
- {
- public:
-
- ConditionWaiter(Condition& aCond);
-
- struct SALHELPER_DLLPUBLIC timedout {
- timedout();
-
- timedout(timedout const &);
-
- virtual ~timedout();
-
- timedout & operator =(timedout const &);
- };
-
- ConditionWaiter(Condition& aCond,sal_uInt32 milliSec)
- throw(
- timedout
- );
-
-
- ~ConditionWaiter();
-
-
- private:
- SALHELPER_DLLPRIVATE ConditionWaiter(ConditionWaiter &); // not defined
- SALHELPER_DLLPRIVATE void operator =(ConditionWaiter &); // not defined
-
- Condition& m_aCond;
- };
-
-
-} // namespace salhelper
-
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/salhelper/inc/salhelper/dynload.hxx b/salhelper/inc/salhelper/dynload.hxx
deleted file mode 100644
index f79bb2277987..000000000000
--- a/salhelper/inc/salhelper/dynload.hxx
+++ /dev/null
@@ -1,204 +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 _SALHELPER_DYNLOAD_HXX_
-#define _SALHELPER_DYNLOAD_HXX_
-
-#include <sal/types.h>
-#include <rtl/ustring.hxx>
-#include <osl/module.h>
-#include "salhelperdllapi.h"
-
-namespace salhelper
-{
-
-/** The ORealDynamicLoader is an implementation helper class for the template loader ODynamicLoader.
- */
-class SALHELPER_DLLPUBLIC ORealDynamicLoader
-{
-public:
- /** initializes the loader, loads the library and call the initialization function.
-
- @param ppSetToZeroInDestructor points to the loader instance which must be set to NULL
- if the loader will be destroyed.
- @param strModuleName specifies the library name.
- @param strInitFunction specifies the name of the initialization function.
- */
- static ORealDynamicLoader* SAL_CALL newInstance(
- ORealDynamicLoader ** ppSetToZeroInDestructor,
- const ::rtl::OUString& strModuleName,
- const ::rtl::OUString& strInitFunction );
-
- /// increase the reference count.
- sal_uInt32 SAL_CALL acquire();
- /// decrease the reference count and delete the last instance.
- sal_uInt32 SAL_CALL release();
-
- /// returns a poiner to the initialized API function structure.
- void* SAL_CALL getApi() const;
-
-protected:
- /** Constructor.
-
- @param ppSetToZeroInDestructor points to the loader instance which must be set to NULL
- if the loader will be destroyed.
- @param strModuleName specifies the library name.
- @param strInitFunction specifies the name of the initialization function.
- @param pApi points to a structure with the initialized API function pointers.
- @param pModule points to the loaded library handle.
- */
- ORealDynamicLoader( ORealDynamicLoader ** ppSetToZeroInDestructor,
- const ::rtl::OUString& strModuleName,
- const ::rtl::OUString& strInitFunction,
- void* pApi,
- oslModule pModule );
-
- /// Destructor, try to unload the library.
- virtual ~ORealDynamicLoader();
-
- /// points to the structure with the initialzed API function pointers.
- void* m_pApi;
- /// stores the reference count.
- sal_uInt32 m_refCount;
- /// stores the library handle.
- oslModule m_pModule;
- /// stores the library name.
- ::rtl::OUString m_strModuleName;
- /// stores the name of the initialization function.
- ::rtl::OUString m_strInitFunction;
- /** stores a pointer to itself, which must be reset in the destructor to signal
- that the loader is invalid.
- */
- ORealDynamicLoader ** ppSetToZeroInDestructor;
-};
-
-
-/** The ODynmaicLoader provides a special load on call mechanism for dynamic libraries
- which support a C-API.
-
- The libraries must provide a struct with function pointers for all supported C functions.
- The loader loads the specified library and call the specified initialization function
- to initialize the function pointers with the real functions. Furthermore provides the
- loader a reference counter for the library. When the last instance of the laoder will
- be destroyed the loader will unload the library.
-
- @deprecated
- Do not use.
- */
-template<class API>
-class ODynamicLoader
-{
-public:
- /// Default constructor
- ODynamicLoader() SAL_THROW(())
- {
- m_pLoader = 0;
- }
-
- /** Constructor, loads the library if necessary otherwise the refernece count will
- be increased.
-
- @param strModuleName specifies the library name.
- @param strInitFunction specifies the name of the initialization function.
- */
- ODynamicLoader( const ::rtl::OUString& strModuleName,
- const ::rtl::OUString& strInitFunction ) SAL_THROW(())
- {
- if (!m_pStaticLoader)
- {
- m_pStaticLoader = ORealDynamicLoader::newInstance(
- &m_pStaticLoader,
- strModuleName,
- strInitFunction);
- }
- else
- {
- m_pStaticLoader->acquire();
- }
-
- m_pLoader = m_pStaticLoader;
- }
-
- /// Copy constructor
- ODynamicLoader(const ODynamicLoader<API>& toCopy) SAL_THROW(())
- {
- m_pLoader = toCopy.m_pLoader;
- if( m_pLoader )
- m_pLoader->acquire();
- }
-
- /// Destructor, decrease the reference count and unload the library if it is tha last instance.
- ~ODynamicLoader() SAL_THROW(())
- {
- if( m_pLoader )
- m_pLoader->release();
- }
-
- /// Assign operator
- ODynamicLoader<API>& SAL_CALL operator = (const ODynamicLoader<API>& toAssign) SAL_THROW(())
- {
- if( m_pLoader != toAssign.m_pLoader )
- {
- if( toAssign.m_pLoader )
- {
- toAssign.m_pLoader->acquire();
- }
- if( m_pLoader )
- {
- m_pLoader->release();
- }
- m_pLoader = toAssign.m_pLoader;
- }
-
- return (*this);
- }
-
- /// returns a poiner to the initialized API function structure.
- API* SAL_CALL getApi() const SAL_THROW(())
- {
- return (API*)m_pLoader->getApi();
- }
-
- /// cast operator, which cast to a poiner with the initialized API function structure.
- API* SAL_CALL operator->() const SAL_THROW(())
- {
- return (API*)m_pLoader->getApi();
- }
-
- /// checks if the loader works on a loaded and initialized library.
- sal_Bool SAL_CALL isLoaded() const SAL_THROW(())
- {
- return (m_pLoader != NULL);
- }
-
-protected:
- /// stores the real loader helper instance
- static ORealDynamicLoader* m_pStaticLoader;
- ORealDynamicLoader* m_pLoader;
-};
-
-
-template<class API>
-ORealDynamicLoader* ODynamicLoader<API>::m_pStaticLoader = NULL;
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/salhelper/inc/salhelper/linkhelper.hxx b/salhelper/inc/salhelper/linkhelper.hxx
deleted file mode 100644
index ef185c078908..000000000000
--- a/salhelper/inc/salhelper/linkhelper.hxx
+++ /dev/null
@@ -1,75 +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/.
- */
-
-#ifndef _SALHELPER_LINKHELPER_HXX
-#define _SALHELPER_LINKHELPER_HXX
-
-#include <rtl/ustring.hxx>
-#include <osl/file.hxx>
-
-namespace salhelper
-{
- class LinkResolver
- {
- public:
- osl::FileStatus m_aStatus;
-
- LinkResolver(sal_uInt32 nMask)
- : m_aStatus(nMask |
- osl_FileStatus_Mask_FileURL |
- osl_FileStatus_Mask_Type |
- osl_FileStatus_Mask_LinkTargetURL)
- {
- }
-
- /** Resolve a file url if its a symbolic link, to a maximum depth of
- * nDepth and fill in m_aStatus with the requested ctor flags
- *
- * @return osl::FileBase::E_None on success
- *
- * @see DirectoryItem::getFileStatus
- */
- osl::FileBase::RC fetchFileStatus(const rtl::OUString &rURL,
- int nDepth = 128)
- {
- //In an ideal world this wouldn't be inline, but I want to use this
- //in jvmfwk hence salhelper, but salhelper is .map controlled and
- //getting all the mangled names right is a misery, moving it over
- //to visibility markup would drop per-symbol versioning
- osl::FileBase::RC eReturn;
-
- osl::DirectoryItem item;
- rtl::OUString sURL(rURL);
- while ((eReturn = osl::DirectoryItem::get(sURL, item))
- == osl::File::E_None)
- {
- if (--nDepth == 0)
- {
- eReturn = osl::FileBase::E_MULTIHOP;
- break;
- }
- eReturn = item.getFileStatus(m_aStatus);
- if (eReturn != osl::File::E_None)
- break;
- if (m_aStatus.getFileType() != osl::FileStatus::Link)
- {
- eReturn = osl::FileBase::E_None;
- break;
- }
- sURL = m_aStatus.getLinkTargetURL();
- }
-
- return eReturn;
- }
- };
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/salhelper/inc/salhelper/refobj.hxx b/salhelper/inc/salhelper/refobj.hxx
deleted file mode 100644
index 5d7d322b6140..000000000000
--- a/salhelper/inc/salhelper/refobj.hxx
+++ /dev/null
@@ -1,104 +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 _SALHELPER_REFOBJ_HXX_
-#define _SALHELPER_REFOBJ_HXX_
-
-#include <sal/types.h>
-#include <rtl/alloc.h>
-#include <rtl/ref.hxx>
-#include <osl/diagnose.h>
-#include <osl/interlck.h>
-
-namespace salhelper
-{
-
-//----------------------------------------------------------------------------
-
-class ReferenceObject : public rtl::IReference
-{
- /** Representation.
- */
- oslInterlockedCount m_nReferenceCount;
-
- /** Not implemented.
- */
- ReferenceObject (const ReferenceObject&);
- ReferenceObject& operator= (const ReferenceObject&);
-
-public:
- /** Allocation.
- */
- static void* operator new (size_t n) SAL_THROW(())
- {
- return ::rtl_allocateMemory (n);
- }
- static void operator delete (void* p) SAL_THROW(())
- {
- ::rtl_freeMemory (p);
- }
- static void* operator new (size_t, void* p) SAL_THROW(())
- {
- return (p);
- }
- static void operator delete (void*, void*) SAL_THROW(())
- {}
-
-public:
- /** Construction.
- */
- inline ReferenceObject() SAL_THROW(()) : m_nReferenceCount (0)
- {}
-
-
- /** IReference.
- */
- virtual oslInterlockedCount SAL_CALL acquire() SAL_THROW(())
- {
- return ::osl_incrementInterlockedCount (&m_nReferenceCount);
- }
-
- virtual oslInterlockedCount SAL_CALL release() SAL_THROW(())
- {
- oslInterlockedCount result;
- result = ::osl_decrementInterlockedCount (&m_nReferenceCount);
- if (result == 0)
- {
- // Last reference released.
- delete this;
- }
- return (result);
- }
-
-protected:
- /** Destruction.
- */
- virtual ~ReferenceObject() SAL_THROW(())
- {
- OSL_ASSERT(m_nReferenceCount == 0);
- }
-};
-
-//----------------------------------------------------------------------------
-
-} // namespace salhelper
-
-#endif /* !_SALHELPER_REFOBJ_HXX_ */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/salhelper/inc/salhelper/salhelperdllapi.h b/salhelper/inc/salhelper/salhelperdllapi.h
deleted file mode 100644
index d80cf8b0ec56..000000000000
--- a/salhelper/inc/salhelper/salhelperdllapi.h
+++ /dev/null
@@ -1,34 +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_SALHELPERDLLAPI_H
-#define INCLUDED_SALHELPERDLLAPI_H
-
-#include "sal/types.h"
-
-#if defined(SALHELPER_DLLIMPLEMENTATION)
-#define SALHELPER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
-#else
-#define SALHELPER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
-#endif
-#define SALHELPER_DLLPRIVATE SAL_DLLPRIVATE
-
-#endif /* INCLUDED_SALHELPERDLLAPI_H */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/salhelper/inc/salhelper/simplereferenceobject.hxx b/salhelper/inc/salhelper/simplereferenceobject.hxx
deleted file mode 100644
index 12886e111128..000000000000
--- a/salhelper/inc/salhelper/simplereferenceobject.hxx
+++ /dev/null
@@ -1,131 +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 _SALHELPER_SIMPLEREFERENCEOBJECT_HXX_
-#define _SALHELPER_SIMPLEREFERENCEOBJECT_HXX_
-
-#include "osl/interlck.h"
-#include "sal/types.h"
-#include "salhelperdllapi.h"
-
-#include <cstddef>
-#include <new>
-
-namespace salhelper {
-
-/** A simple base implementation for reference-counted objects.
-
- Classes that want to implement a reference-counting mechanism based on the
- acquire()/release() interface should derive from this class.
-
- The reason to have class local operators new and delete here is technical.
- Imagine a class D derived from SimpleReferenceObject, but implemented in
- another shared library that happens to use different global operators new
- and delete from those used in this shared library (which, sadly, seems to
- be possible with shared libraries). Now, without the class local
- operators new and delete here, a code sequence like "new D" would use the
- global operator new as found in the other shared library, while the code
- sequence "delete this" in release() would use the global operator delete
- as found in this shared library---and these two operators would not be
- guaranteed to match.
-
- There are no overloaded operators new and delete for placement new here,
- because it is felt that the concept of placement new does not work well
- with the concept of reference-counted objects; so it seems best to simply
- leave those operators out.
-
- The same problem as with operators new and delete would also be there with
- operators new[] and delete[]. But since arrays of reference-counted
- objects are of no use, anyway, it seems best to simply declare and not
- define (private) operators new[] and delete[].
- */
-class SALHELPER_DLLPUBLIC SimpleReferenceObject
-{
-public:
- inline SimpleReferenceObject() SAL_THROW(()): m_nCount(0) {}
-
- /** @attention
- The results are undefined if, for any individual instance of
- SimpleReferenceObject, the total number of calls to acquire() exceeds
- the total number of calls to release() by a platform dependent amount
- (which, hopefully, is quite large).
- */
- inline void acquire() SAL_THROW(())
- { osl_atomic_increment(&m_nCount); }
-
- inline void release() SAL_THROW(())
- { if (osl_atomic_decrement(&m_nCount) == 0) delete this; }
-
- /** see general class documentation
- */
- static void * operator new(std::size_t nSize) SAL_THROW((std::bad_alloc));
-
- /** see general class documentation
- */
- static void * operator new(std::size_t nSize,
- std::nothrow_t const & rNothrow)
- SAL_THROW(());
-
- /** see general class documentation
- */
- static void operator delete(void * pPtr) SAL_THROW(());
-
- /** see general class documentation
- */
- static void operator delete(void * pPtr, std::nothrow_t const & rNothrow)
- SAL_THROW(());
-
-protected:
- virtual ~SimpleReferenceObject() SAL_THROW(());
-
-private:
- oslInterlockedCount m_nCount;
-
- /** not implemented
- */
- SALHELPER_DLLPRIVATE SimpleReferenceObject(SimpleReferenceObject &);
-
- /** not implemented
- */
- SALHELPER_DLLPRIVATE void operator =(SimpleReferenceObject);
-
- /// @cond INTERNAL
-
-#ifdef _MSC_VER
-/* We can't now have these private with MSVC2008 at least, it leads to
- compilation errors in xmloff and other places.
-*/
-protected:
-#endif
- /** not implemented (see general class documentation)
- */
- static void * operator new[](std::size_t);
-
- /** not implemented (see general class documentation)
- */
- static void operator delete[](void * pPtr);
-
- /// @endcond
-};
-
-}
-
-#endif // _SALHELPER_SIMPLEREFERENCEOBJECT_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/salhelper/inc/salhelper/singletonref.hxx b/salhelper/inc/salhelper/singletonref.hxx
deleted file mode 100644
index a602e50cc4bf..000000000000
--- a/salhelper/inc/salhelper/singletonref.hxx
+++ /dev/null
@@ -1,197 +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 _SALHELPER_SINGLETONREF_HXX_
-#define _SALHELPER_SINGLETONREF_HXX_
-
-#include <osl/mutex.hxx>
-#include "rtl/instance.hxx"
-#include "osl/diagnose.h"
-#include "osl/getglobalmutex.hxx"
-
-
-namespace salhelper{
-
-
-/** @short template for implementing singleton classes.
-
- Such classes can be instanciated everytimes they
- are needed. But the internal wrapped object will
- be created one times only. Of course its used
- resources are referenced one times only too.
- This template hold it alive till the last
- reference is gone. Further all operations
- on this reference are threadsafe. Only
- calls directly to the internal object (which modify
- its state) must be made threadsafe by the object itself
- or from outside.
-
- @attention To prevent the code against race conditions, its not
- allowed to start operations inside the ctor
- of the internal wrapped object - especialy operations
- which needs a reference to the same singleton too.
-
- The only chance to supress such strange constellations
- is a lazy-init mechanism.
-
- <ul>
- <li>a) The singleton class can provide a special init()
- method, which must be called as first after creation.</li>
- <li>b) The singleton class can call a special impl_init()
- method implicit for every called interface method.</li>
- </ul>
-
- Note further that this singleton pattern can work only, if
- all user of such singleton are located inside the same library!
- Because static values cant be exported - e.g. from windows libraries.
- */
-template< class SingletonClass >
-class SingletonRef
-{
- //-------------------------------------------
- // member
-
- private :
-
- /** @short pointer to the internal wrapped singleton. */
- static SingletonClass* m_pInstance;
-
- /** @short ref count, which regulate creation and removing of m_pInstance. */
- static sal_Int32 m_nRef;
-
- //-------------------------------------------
- // interface
-
- public :
-
- //---------------------------------------
-
- /** @short standard ctor.
-
- The internal wrapped object is created only,
- if its ref count was 0. Otherwhise this method
- does nothing ... except increasing of the internal
- ref count!
- */
- SingletonRef()
- {
- // GLOBAL SAFE ->
- ::osl::MutexGuard aLock(SingletonRef::ownStaticLock());
-
- // must be increased before(!) the check is done.
- // Otherwhise this check can fail inside the same thread ...
- ++m_nRef;
- if (m_nRef == 1)
- m_pInstance = new SingletonClass();
-
- OSL_ENSURE(m_nRef>0 && m_pInstance, "Race? Ref count of singleton >0, but instance is NULL!");
- // <- GLOBAL SAFE
- }
-
- //---------------------------------------
-
- /** @short standard dtor.
-
- The internal wrapped object is removed only,
- if its ref count wil be 0. Otherwhise this method
- does nothing ... except decreasing of the internal
- ref count!
- */
- ~SingletonRef()
- {
- // GLOBAL SAFE ->
- ::osl::MutexGuard aLock(SingletonRef::ownStaticLock());
-
- // must be decreased before(!) the check is done.
- // Otherwhise this check can fail inside the same thread ...
- --m_nRef;
- if (m_nRef == 0)
- {
- delete m_pInstance;
- m_pInstance = 0;
- }
- // <- GLOBAL SAFE
- }
-
- //---------------------------------------
-
- /** @short Allows rSingle->someBodyOp().
- */
- SingletonClass* operator->() const
- {
- // GLOBAL SAFE ->
- ::osl::MutexGuard aLock(SingletonRef::ownStaticLock());
- return m_pInstance;
- // <- GLOBAL SAFE
- }
-
- //---------------------------------------
-
- /** @short Allows (*rSingle).someBodyOp().
- */
- SingletonClass& operator*() const
- {
- // GLOBAL SAFE ->
- ::osl::MutexGuard aLock(SingletonRef::ownStaticLock());
- return *m_pInstance;
- // <- GLOBAL SAFE
- }
-
- //-------------------------------------------
- // helper
-
- private :
-
- //---------------------------------------
-
- /** @short creates an own mutex for guarding static contents.
-
- The global mutex the osl library is used one times
- only to create an own static mutex, which can be used
- next time to guard own static member operations.
- */
- struct SingletonLockInit
- {
- ::osl::Mutex* operator()()
- {
- static ::osl::Mutex aInstance;
- return &aInstance;
- }
- };
-
- ::osl::Mutex& ownStaticLock() const
- {
- return *rtl_Instance< ::osl::Mutex,
- SingletonLockInit,
- ::osl::MutexGuard,
- ::osl::GetGlobalMutex >::create(SingletonLockInit(), ::osl::GetGlobalMutex());
- }
-};
-
-template< class SingletonClass >
-SingletonClass* SingletonRef< SingletonClass >::m_pInstance = 0;
-
-template< class SingletonClass >
-sal_Int32 SingletonRef< SingletonClass >::m_nRef = 0;
-
-} // namespace salhelper
-
-#endif // _SALHELPER_SINGLETONREF_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/salhelper/inc/salhelper/thread.hxx b/salhelper/inc/salhelper/thread.hxx
deleted file mode 100644
index b160b2d1eb6a..000000000000
--- a/salhelper/inc/salhelper/thread.hxx
+++ /dev/null
@@ -1,93 +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/.
- */
-
-#ifndef INCLUDED_SALHELPER_THREAD_HXX
-#define INCLUDED_SALHELPER_THREAD_HXX
-
-#include "sal/config.h"
-
-#include <cstddef>
-
-#include "osl/thread.hxx"
-#include "sal/types.h"
-#include "salhelper/salhelperdllapi.h"
-#include "salhelper/simplereferenceobject.hxx"
-
-namespace salhelper {
-
-/**
- A safe encapsulation of ::osl::Thread.
-
- @since LibreOffice 3.6
-*/
-class SALHELPER_DLLPUBLIC Thread:
- public salhelper::SimpleReferenceObject, private osl::Thread
-{
-public:
- /**
- @param name the thread name, see ::osl_setThreadName; must be a non-null
- null terminated string
- */
- Thread(char const * name);
-
- /**
- Launch the thread.
-
- This function must be called at most once.
-
- Each call of this function should eventually be followed by a call to
- ::osl::Thread::join before exit(3), to ensure the thread is no longer
- relying on any infrastructure while that infrastructure is being shut
- down in atexit handlers.
- */
- void launch();
-
- using osl::Thread::getIdentifier;
- using osl::Thread::join;
- using osl::Thread::schedule;
- using osl::Thread::terminate;
-
- // While the below static member functions should arguably always be called
- // with qualified (osl::Thread) names, compilers would still complain that
- // they are inaccessible from within derivations of salhelper::Thread (an
- // alternative would be to force such derivations to use global names,
- // prefixed with ::osl::Thread):
- using osl::Thread::getCurrentIdentifier;
- using osl::Thread::wait;
- using osl::Thread::yield;
-
- static inline void * operator new(std::size_t size)
- { return SimpleReferenceObject::operator new(size); }
-
- static inline void operator delete(void * pointer)
- { SimpleReferenceObject::operator delete(pointer); }
-
-protected:
- virtual ~Thread();
-
- /**
- The main function executed by the thread.
-
- Any uncaught exceptions lead to std::terminate.
- */
- virtual void execute() = 0;
-
-private:
- virtual void SAL_CALL run();
-
- virtual void SAL_CALL onTerminated();
-
- char const * name_;
-};
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/salhelper/inc/salhelper/timer.hxx b/salhelper/inc/salhelper/timer.hxx
deleted file mode 100644
index 0afd593b8c2b..000000000000
--- a/salhelper/inc/salhelper/timer.hxx
+++ /dev/null
@@ -1,230 +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 _SALHELPER_TIMER_HXX_
-#define _SALHELPER_TIMER_HXX_
-
-#include <salhelper/simplereferenceobject.hxx>
-#include <osl/time.h>
-#include "salhelperdllapi.h"
-
-namespace salhelper
-{
-
-/** Helper class for easier manipulation with TimeValue.
- *
- * Times are seconds in UTC since 01.01.1970
- */
-struct TTimeValue : public TimeValue
-{
- TTimeValue()
- {
- Seconds = 0;
- Nanosec = 0;
- }
-
- TTimeValue( sal_uInt32 Secs, sal_uInt32 Nano )
- {
- Seconds = Secs;
- Nanosec = Nano;
-
- normalize();
- }
-
- TTimeValue(sal_uInt32 MilliSecs)
- {
- Seconds = MilliSecs / 1000L;
- Nanosec = (MilliSecs % 1000) * 1000000L;
-
- normalize();
- }
-
- TTimeValue( const TTimeValue& rTimeValue )
- {
- Seconds = rTimeValue.Seconds;
- Nanosec = rTimeValue.Nanosec;
-
- normalize();
- }
-
- TTimeValue( const TimeValue& rTimeValue )
- {
- Seconds = rTimeValue.Seconds;
- Nanosec = rTimeValue.Nanosec;
-
- normalize();
- }
-
- void SAL_CALL normalize()
- {
- if ( Nanosec > 1000000000 )
- {
- Seconds += Nanosec / 1000000000;
- Nanosec %= 1000000000;
- }
- }
-
- void SAL_CALL addTime( const TTimeValue& Delta )
- {
- Seconds += Delta.Seconds;
- Nanosec += Delta.Nanosec;
-
- normalize();
- }
-
- sal_Bool SAL_CALL isEmpty() const
- {
- return ( ( Seconds == 0 ) && ( Nanosec == 0 ) );
- }
-};
-
-inline sal_Bool operator<( const TTimeValue& rTimeA, const TTimeValue& rTimeB )
-{
- if ( rTimeA.Seconds < rTimeB.Seconds )
- return sal_True;
- else if ( rTimeA.Seconds > rTimeB.Seconds )
- return sal_False;
- else
- return ( rTimeA.Nanosec < rTimeB.Nanosec );
-}
-
-inline sal_Bool operator>( const TTimeValue& rTimeA, const TTimeValue& rTimeB )
-{
- if ( rTimeA.Seconds > rTimeB.Seconds )
- return sal_True;
- else if ( rTimeA.Seconds < rTimeB.Seconds )
- return sal_False;
- else
- return ( rTimeA.Nanosec > rTimeB.Nanosec );
-}
-
-inline sal_Bool operator==( const TTimeValue& rTimeA, const TTimeValue& rTimeB )
-{
- return ( ( rTimeA.Seconds == rTimeB.Seconds ) &&
- ( rTimeA.Nanosec == rTimeB.Nanosec ) );
-}
-
-class TimerManager;
-
-/** Interface for the Timer and handling the event
-*/
-class SALHELPER_DLLPUBLIC Timer : public salhelper::SimpleReferenceObject
-{
-public:
-
- /** Constructor.
- */
- Timer();
-
- /** Constructor.
- */
- Timer( const TTimeValue& Time );
-
- /** Constructor.
- */
- Timer( const TTimeValue& Time, const TTimeValue& RepeatTime );
-
- /** Start timer.
- */
- void SAL_CALL start();
-
- /** Abort timer prematurely.
- */
- void SAL_CALL stop();
-
- /** Returns sal_True if timer is running.
- */
- sal_Bool SAL_CALL isTicking() const;
-
- /** Is the timer expired?
- */
- sal_Bool SAL_CALL isExpired() const;
-
- /** Does pTimer expires before us?
- */
- sal_Bool SAL_CALL expiresBefore( const Timer* pTimer ) const;
-
- /** Set the absolute time when the timer should fire.
- */
- void SAL_CALL setAbsoluteTime( const TTimeValue& Time );
-
- /** Set the time to fire to 'now' + Remaining.
- */
- void SAL_CALL setRemainingTime( const TTimeValue& Remaining );
-
- /** Set the time to fire to 'now' + Remaining with repeat interveal
- * Repeat.
- */
- void SAL_CALL setRemainingTime( const TTimeValue& Remaining, const TTimeValue& Repeat );
-
- /** Adds Time to the 'fire time'.
- */
- void SAL_CALL addTime( const TTimeValue& Time );
-
- /** Returns the remaining time before timer expiration relative to now.
- */
- TTimeValue SAL_CALL getRemainingTime() const;
-
-protected:
-
- /** Destructor.
- */
- virtual ~Timer();
-
- /** What should be done when the 'timer fires'.
- */
- virtual void SAL_CALL onShot() = 0;
-
-protected:
-
- /** holds (initial) exparation time of this timer.
- */
- TTimeValue m_aTimeOut;
-
- /** holds the time of exparation of this timer.
- */
- TTimeValue m_aExpired;
-
- /** holds the time interveal of successive expirations.
- */
- TTimeValue m_aRepeatDelta;
-
- /** Pointer to the next timer (to fire).
- */
- Timer* m_pNext;
-
-private:
-
- /** Copy constructor disabled.
- */
- SALHELPER_DLLPRIVATE Timer( const Timer& rTimer );
-
- /** Assignment operator disabled.
- */
- SALHELPER_DLLPRIVATE void SAL_CALL operator=( const Timer& rTimer );
-
- friend class TimerManager;
-};
-
-}
-
-#endif //_SALHELPER_TIMER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */