diff options
-rw-r--r-- | extensions/source/plugin/inc/plugin/unx/mediator.hxx | 1 | ||||
-rw-r--r-- | extensions/source/plugin/inc/plugin/unx/plugcon.hxx | 2 | ||||
-rw-r--r-- | include/svtools/svparser.hxx | 1 | ||||
-rw-r--r-- | include/tools/link.hxx | 159 | ||||
-rw-r--r-- | include/vcl/evntpost.hxx | 1 | ||||
-rw-r--r-- | rsc/inc/rscdef.hxx | 3 | ||||
-rw-r--r-- | sc/inc/refreshtimer.hxx | 3 | ||||
-rw-r--r-- | tools/Library_tl.mk | 1 | ||||
-rw-r--r-- | tools/source/generic/link.cxx | 40 |
9 files changed, 78 insertions, 133 deletions
diff --git a/extensions/source/plugin/inc/plugin/unx/mediator.hxx b/extensions/source/plugin/inc/plugin/unx/mediator.hxx index 3b287e69491e..7681831adbc6 100644 --- a/extensions/source/plugin/inc/plugin/unx/mediator.hxx +++ b/extensions/source/plugin/inc/plugin/unx/mediator.hxx @@ -30,6 +30,7 @@ #include <string.h> #include <tools/link.hxx> +#include <tools/solar.h> #include <osl/pipe.hxx> #include <osl/mutex.hxx> #include <osl/conditn.hxx> diff --git a/extensions/source/plugin/inc/plugin/unx/plugcon.hxx b/extensions/source/plugin/inc/plugin/unx/plugcon.hxx index ef98f37df8ea..ebf51036e172 100644 --- a/extensions/source/plugin/inc/plugin/unx/plugcon.hxx +++ b/extensions/source/plugin/inc/plugin/unx/plugcon.hxx @@ -93,6 +93,8 @@ extern "C" { #include <postx.h> +#include <tools/solar.h> + class ConnectorInstance { public: diff --git a/include/svtools/svparser.hxx b/include/svtools/svparser.hxx index 8a9d1609a6fd..575a51de0554 100644 --- a/include/svtools/svparser.hxx +++ b/include/svtools/svparser.hxx @@ -23,6 +23,7 @@ #include <svtools/svtdllapi.h> #include <tools/link.hxx> #include <tools/ref.hxx> +#include <tools/solar.h> #include <rtl/textenc.h> #include <rtl/ustring.hxx> #include <boost/noncopyable.hpp> diff --git a/include/tools/link.hxx b/include/tools/link.hxx index ea55a3eb2e46..2dd0100096ba 100644 --- a/include/tools/link.hxx +++ b/include/tools/link.hxx @@ -16,125 +16,100 @@ * 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_TOOLS_LINK_HXX #define INCLUDED_TOOLS_LINK_HXX -#include <tools/toolsdllapi.h> #include <sal/config.h> + #include <sal/types.h> -#include <tools/solar.h> +#include <tools/toolsdllapi.h> -typedef sal_IntPtr (*PSTUB)( void*, void* ); +#define DECL_LINK(Member, ArgType) \ + static sal_IntPtr LinkStub##Member(void *, void *); \ + sal_IntPtr Member(ArgType) -#define DECL_LINK( Method, ArgType ) \ - sal_IntPtr Method( ArgType ); \ - static sal_IntPtr LinkStub##Method( void* pThis, void* ) +#define DECL_STATIC_LINK(Class, Member, ArgType) \ + static sal_IntPtr LinkStub##Member(void *, void *); \ + static sal_IntPtr Member(Class *, ArgType) -#define DECL_STATIC_LINK( Class, Method, ArgType ) \ - static sal_IntPtr LinkStub##Method( void* pThis, void* ); \ - static sal_IntPtr Method( Class*, ArgType ) +#define DECL_DLLPRIVATE_LINK(Member, ArgType) \ + SAL_DLLPRIVATE static sal_IntPtr LinkStub##Member(void *, void *); \ + SAL_DLLPRIVATE sal_IntPtr Member(ArgType) -#define DECL_DLLPRIVATE_LINK(Method, ArgType) \ - SAL_DLLPRIVATE sal_IntPtr Method(ArgType); \ - SAL_DLLPRIVATE static sal_IntPtr LinkStub##Method(void * pThis, void *) +#define DECL_DLLPRIVATE_STATIC_LINK(Class, Member, ArgType) \ + SAL_DLLPRIVATE static sal_IntPtr LinkStub##Member(void *, void *); \ + SAL_DLLPRIVATE static sal_IntPtr Member(Class *, ArgType) -#define DECL_DLLPRIVATE_STATIC_LINK(Class, Method, ArgType) \ - SAL_DLLPRIVATE static sal_IntPtr LinkStub##Method( void* pThis, void* ); \ - SAL_DLLPRIVATE static sal_IntPtr Method(Class *, ArgType) +#define IMPL_LINK(Class, Member, ArgType, ArgName) \ + sal_IntPtr Class::LinkStub##Member(void * instance, void * data) { \ + return static_cast<Class *>(instance)->Member( \ + static_cast<ArgType>(data)); \ + } \ + sal_IntPtr Class::Member(ArgType ArgName) -#define IMPL_STUB(Class, Method, ArgType) \ - sal_IntPtr Class::LinkStub##Method( void* pThis, void* pCaller) \ - { \ - return static_cast<Class*>(pThis)->Method( static_cast<ArgType>(pCaller) ); \ - } +#define IMPL_LINK_NOARG(Class, Member) \ + sal_IntPtr Class::LinkStub##Member(void * instance, void * data) { \ + return static_cast<Class *>(instance)->Member(data); \ + } \ + sal_IntPtr Class::Member(SAL_UNUSED_PARAMETER void *) -#define IMPL_STATIC_LINK( Class, Method, ArgType, ArgName ) \ - sal_IntPtr Class::LinkStub##Method( void* pThis, void* pCaller) \ - { \ - return Method( static_cast<Class*>(pThis), static_cast<ArgType>(pCaller) ); \ +#define IMPL_STATIC_LINK(Class, Member, ArgType, ArgName) \ + sal_IntPtr Class::LinkStub##Member(void * instance, void * data) { \ + return Member( \ + static_cast<Class *>(instance), static_cast<ArgType>(data)); \ } \ - sal_IntPtr Class::Method( Class* pThis, ArgType ArgName ) + sal_IntPtr Class::Member(Class * pThis, ArgType ArgName) -#define IMPL_STATIC_LINK_NOINSTANCE( Class, Method, ArgType, ArgName ) \ - sal_IntPtr Class::LinkStub##Method( void* pThis, void* pCaller) \ - { \ - return Method( static_cast<Class*>(pThis), static_cast<ArgType>(pCaller) ); \ +#define IMPL_STATIC_LINK_NOINSTANCE(Class, Member, ArgType, ArgName) \ + sal_IntPtr Class::LinkStub##Member(void * instance, void * data) { \ + return Member( \ + static_cast<Class *>(instance), static_cast<ArgType>(data)); \ } \ - sal_IntPtr Class::Method( SAL_UNUSED_PARAMETER Class*, ArgType ArgName ) + sal_IntPtr Class::Member(SAL_UNUSED_PARAMETER Class *, ArgType ArgName) -#define IMPL_STATIC_LINK_NOINSTANCE_NOARG( Class, Method ) \ - sal_IntPtr Class::LinkStub##Method( void* pThis, void* pCaller) \ - { \ - return Method( static_cast<Class*>(pThis), pCaller ); \ +#define IMPL_STATIC_LINK_NOINSTANCE_NOARG(Class, Member) \ + sal_IntPtr Class::LinkStub##Member(void * instance, void * data) { \ + return Member(static_cast<Class *>(instance), data); \ } \ - sal_IntPtr Class::Method( SAL_UNUSED_PARAMETER Class*, SAL_UNUSED_PARAMETER void* ) + sal_IntPtr Class::Member( \ + SAL_UNUSED_PARAMETER Class *, SAL_UNUSED_PARAMETER void *) + +#define LINK(Instance, Class, Member) \ + Link(static_cast<Class *>(Instance), &Class::LinkStub##Member) -#define LINK( Inst, Class, Member ) \ - Link( static_cast<Class*>(Inst), &Class::LinkStub##Member ) +#define EMPTYARG -#define IMPL_LINK( Class, Method, ArgType, ArgName ) \ - IMPL_STUB( Class, Method, ArgType ) \ - sal_IntPtr Class::Method( ArgType ArgName ) +class TOOLS_DLLPUBLIC Link { +public: + typedef sal_IntPtr Stub(void *, void *); -#define IMPL_LINK_NOARG( Class, Method ) \ - IMPL_STUB( Class, Method, void* ) \ - sal_IntPtr Class::Method( SAL_UNUSED_PARAMETER void* ) + Link(): function_(nullptr), instance_(nullptr) {} -#define EMPTYARG + Link(void * instance, Stub * function): + function_(function), instance_(instance) {} -class TOOLS_DLLPUBLIC Link -{ - void* pInst; - PSTUB pFunc; + sal_IntPtr Call(void * data) const + { return function_ == nullptr ? 0 : (*function_)(instance_, data); } -public: - Link(); - Link( void* pLinkHdl, PSTUB pMemFunc ); + bool IsSet() const { return function_ != nullptr; } - sal_IntPtr Call( void* pCaller ) const; + bool operator !() const { return !IsSet(); } - bool IsSet() const; - bool operator !() const; + bool operator <(Link const & other) const { + return reinterpret_cast<sal_uIntPtr>(function_) + < reinterpret_cast<sal_uIntPtr>(other.function_); + }; - bool operator==( const Link& rLink ) const; - bool operator!=( const Link& rLink ) const - { return !(Link::operator==( rLink )); } - bool operator<( const Link& rLink ) const - { return reinterpret_cast<sal_uIntPtr>(rLink.pFunc) < reinterpret_cast<sal_uIntPtr>(pFunc); } -}; + bool operator ==(Link const & other) const + { return function_ == other.function_ && instance_ == other.instance_; }; + + bool operator !=(Link const & other) const { return !operator ==(other); }; -inline Link::Link() -{ - pInst = 0; - pFunc = 0; -} - -inline Link::Link( void* pLinkHdl, PSTUB pMemFunc ) -{ - pInst = pLinkHdl; - pFunc = pMemFunc; -} - -inline sal_IntPtr Link::Call(void *pCaller) const -{ - return pFunc ? (*pFunc)(pInst, pCaller) : 0; -} - -inline bool Link::IsSet() const -{ - if ( pFunc ) - return true; - else - return false; -} - -inline bool Link::operator !() const -{ - if ( !pFunc ) - return true; - else - return false; -} +private: + Stub * function_; + void * instance_; +}; #endif diff --git a/include/vcl/evntpost.hxx b/include/vcl/evntpost.hxx index 59898236c391..86b38f69253d 100644 --- a/include/vcl/evntpost.hxx +++ b/include/vcl/evntpost.hxx @@ -20,6 +20,7 @@ #define INCLUDED_VCL_EVNTPOST_HXX #include <tools/link.hxx> +#include <tools/solar.h> #include <vcl/dllapi.h> struct ImplSVEvent; diff --git a/rsc/inc/rscdef.hxx b/rsc/inc/rscdef.hxx index 069701298421..f6d378d14db6 100644 --- a/rsc/inc/rscdef.hxx +++ b/rsc/inc/rscdef.hxx @@ -19,6 +19,9 @@ #ifndef INCLUDED_RSC_INC_RSCDEF_HXX #define INCLUDED_RSC_INC_RSCDEF_HXX +#include <sal/config.h> + +#include <tools/solar.h> #include <tools/unqidx.hxx> #include <rsctree.hxx> #include <rtl/strbuf.hxx> diff --git a/sc/inc/refreshtimer.hxx b/sc/inc/refreshtimer.hxx index cbc8e5c0b228..68f2b957e3c6 100644 --- a/sc/inc/refreshtimer.hxx +++ b/sc/inc/refreshtimer.hxx @@ -20,6 +20,9 @@ #ifndef INCLUDED_SC_INC_REFRESHTIMER_HXX #define INCLUDED_SC_INC_REFRESHTIMER_HXX +#include <sal/config.h> + +#include <tools/solar.h> #include <vcl/timer.hxx> #include <osl/mutex.hxx> #include "scdllapi.h" diff --git a/tools/Library_tl.mk b/tools/Library_tl.mk index d399548cd874..2d105cdabf97 100644 --- a/tools/Library_tl.mk +++ b/tools/Library_tl.mk @@ -58,7 +58,6 @@ $(eval $(call gb_Library_add_exception_objects,tl,\ tools/source/generic/fract \ tools/source/generic/gen \ tools/source/generic/line \ - tools/source/generic/link \ tools/source/generic/point \ tools/source/generic/poly \ tools/source/generic/poly2 \ diff --git a/tools/source/generic/link.cxx b/tools/source/generic/link.cxx deleted file mode 100644 index b1726104cf44..000000000000 --- a/tools/source/generic/link.cxx +++ /dev/null @@ -1,40 +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 . - */ - -#include <tools/link.hxx> - -bool Link::operator==( const Link& rLink ) const -{ - if ( pFunc == rLink.pFunc ) - { - if ( pFunc ) - { - if ( pInst == rLink.pInst ) - return true; - else - return false; - } - else - return true; - } - else - return false; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |