diff options
author | Kurt Zenker <kz@openoffice.org> | 2007-05-09 12:32:35 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2007-05-09 12:32:35 +0000 |
commit | ed22a34f57e569cad97130f39b7e37aa7be591b9 (patch) | |
tree | 1d3d7cb0c27c2bb89ff50a88f78c56cda604486a /cppu/inc | |
parent | fc9ece6244efb4f6ed22e622e03fa91bca15041b (diff) |
INTEGRATION: CWS bunoexttm (1.1.2.2.2); FILE ADDED
2007/02/28 16:51:30 kr 1.1.2.2.2.4: fixed: missing c'tor,d'tor, assign op
2007/02/14 15:57:07 kr 1.1.2.2.2.3: improved: added some documentation
2007/02/08 09:26:07 kr 1.1.2.2.2.2: fixed: linkage of helper funcs
2007/01/25 12:52:41 kr 1.1.2.2.2.1: fixed license
Diffstat (limited to 'cppu/inc')
-rw-r--r-- | cppu/inc/cppu/Enterable.hxx | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/cppu/inc/cppu/Enterable.hxx b/cppu/inc/cppu/Enterable.hxx new file mode 100644 index 000000000000..843ca5b3a21c --- /dev/null +++ b/cppu/inc/cppu/Enterable.hxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: Enterable.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: kz $ $Date: 2007-05-09 13:32:35 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_cppu_Enterable_hxx +#define INCLUDED_cppu_Enterable_hxx + +#include "uno/Enterable.h" +#include "rtl/ustring.hxx" + +namespace cppu +{ +/** C++ wrapper for binary C Enterable + (http://wiki.services.openoffice.org/wiki/Uno/Cpp/Spec/Environment_Stack) + + @see uno_Enterable + @since UDK 3.2.7 +*/ +class Enterable : public uno_Enterable +{ +public: + /* These methods need to be implemented in a derived class. + */ + virtual void v_enter (void) = 0; + virtual void v_leave (void) = 0; + virtual void v_callInto_v(uno_EnvCallee * pCallee, va_list param) = 0; + virtual void v_callOut_v (uno_EnvCallee * pCallee, va_list param) = 0; + virtual int v_isValid (rtl::OUString * pReason) = 0; + + virtual ~Enterable() {}; + +public: + inline explicit Enterable(void); + + inline void enter(void) {m_enter(this);}; + inline void leave(void) {m_leave(this);}; + + inline void callInto_v(uno_EnvCallee * pCallee, va_list param) {m_callInto_v(this, pCallee, param);}; + inline void callOut_v (uno_EnvCallee * pCallee, va_list param) {m_callOut_v (this, pCallee, param);}; + + inline void callInto(uno_EnvCallee * pCallee, ...); + inline void callOut (uno_EnvCallee * pCallee, ...); + + inline int isValid (rtl::OUString * pReason) {return m_isValid(this, (rtl_uString **)pReason);} + +private: + Enterable(Enterable const &); + Enterable & operator = (Enterable const &); +}; + +extern "C" inline void Enterable_call_enter (void * context) { ((Enterable *)context)->v_enter(); }; +extern "C" inline void Enterable_call_leave (void * context) { ((Enterable *)context)->v_leave(); }; +extern "C" inline void Enterable_call_callInto_v(void * context, uno_EnvCallee * pCallee, va_list param) + { ((Enterable *)context)->v_callInto_v(pCallee, param); }; +extern "C" inline void Enterable_call_callOut_v (void * context, uno_EnvCallee * pCallee, va_list param) + { ((Enterable *)context)->v_callOut_v(pCallee, param); }; +extern "C" inline int Enterable_call_isValid (void * context, rtl_uString ** pReason) + {return ((Enterable *)context)->v_isValid((rtl::OUString *)pReason);} + + +Enterable::Enterable(void) +{ + m_enter = Enterable_call_enter; + m_leave = Enterable_call_leave; + m_callInto_v = Enterable_call_callInto_v; + m_callOut_v = Enterable_call_callOut_v; + m_isValid = Enterable_call_isValid; +} + +void Enterable::callInto(uno_EnvCallee * pCallee, ...) +{ + va_list param; + + va_start(param, pCallee); + callInto_v(pCallee, param); + va_end(param); +} + +void Enterable::callOut(uno_EnvCallee * pCallee, ...) +{ + va_list param; + + va_start(param, pCallee); + callOut_v(pCallee, param); + va_end(param); +} + +} + + +#endif |