UDK 3.2.7 C/C++ API Reference
|
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 00002 /************************************************************************* 00003 * 00004 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 00005 * 00006 * Copyright 2000, 2010 Oracle and/or its affiliates. 00007 * 00008 * OpenOffice.org - a multi-platform office productivity suite 00009 * 00010 * This file is part of OpenOffice.org. 00011 * 00012 * OpenOffice.org is free software: you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 3 00014 * only, as published by the Free Software Foundation. 00015 * 00016 * OpenOffice.org is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License version 3 for more details 00020 * (a copy is included in the LICENSE file that accompanied this code). 00021 * 00022 * You should have received a copy of the GNU Lesser General Public License 00023 * version 3 along with OpenOffice.org. If not, see 00024 * <http://www.openoffice.org/license.html> 00025 * for a copy of the LGPLv3 License. 00026 * 00027 ************************************************************************/ 00028 00029 #ifndef INCLUDED_cppu_Enterable_hxx 00030 #define INCLUDED_cppu_Enterable_hxx 00031 00032 #include "uno/Enterable.h" 00033 #include "rtl/ustring.hxx" 00034 00035 namespace cppu 00036 { 00043 class Enterable : public uno_Enterable 00044 { 00045 public: 00046 /* These methods need to be implemented in a derived class. 00047 */ 00048 virtual void v_enter (void) = 0; 00049 virtual void v_leave (void) = 0; 00050 virtual void v_callInto_v(uno_EnvCallee * pCallee, va_list * pParam) = 0; 00051 virtual void v_callOut_v (uno_EnvCallee * pCallee, va_list * pParam) = 0; 00052 virtual int v_isValid (rtl::OUString * pReason) = 0; 00053 00054 virtual ~Enterable() {} 00055 00056 public: 00057 inline explicit Enterable(void); 00058 00059 inline void enter(void) {m_enter(this);} 00060 inline void leave(void) {m_leave(this);} 00061 00062 inline void callInto_v(uno_EnvCallee * pCallee, va_list * pParam) {m_callInto_v(this, pCallee, pParam);} 00063 inline void callOut_v (uno_EnvCallee * pCallee, va_list * pParam) {m_callOut_v (this, pCallee, pParam);} 00064 00065 inline void callInto(uno_EnvCallee * pCallee, ...); 00066 inline void callOut (uno_EnvCallee * pCallee, ...); 00067 00068 inline int isValid (rtl::OUString * pReason) {return m_isValid(this, (rtl_uString **)pReason);} 00069 00070 private: 00071 Enterable(Enterable const &); 00072 Enterable & operator = (Enterable const &); 00073 }; 00074 00075 extern "C" inline void Enterable_call_enter (void * context) { ((Enterable *)context)->v_enter(); } 00076 extern "C" inline void Enterable_call_leave (void * context) { ((Enterable *)context)->v_leave(); } 00077 extern "C" inline void Enterable_call_callInto_v(void * context, uno_EnvCallee * pCallee, va_list * pParam) 00078 { ((Enterable *)context)->v_callInto_v(pCallee, pParam); } 00079 extern "C" inline void Enterable_call_callOut_v (void * context, uno_EnvCallee * pCallee, va_list * pParam) 00080 { ((Enterable *)context)->v_callOut_v(pCallee, pParam); } 00081 extern "C" inline int Enterable_call_isValid (void * context, rtl_uString ** pReason) 00082 {return ((Enterable *)context)->v_isValid((rtl::OUString *)pReason);} 00083 00084 00085 Enterable::Enterable(void) 00086 { 00087 m_enter = Enterable_call_enter; 00088 m_leave = Enterable_call_leave; 00089 m_callInto_v = Enterable_call_callInto_v; 00090 m_callOut_v = Enterable_call_callOut_v; 00091 m_isValid = Enterable_call_isValid; 00092 } 00093 00094 void Enterable::callInto(uno_EnvCallee * pCallee, ...) 00095 { 00096 va_list param; 00097 00098 va_start(param, pCallee); 00099 callInto_v(pCallee, ¶m); 00100 va_end(param); 00101 } 00102 00103 void Enterable::callOut(uno_EnvCallee * pCallee, ...) 00104 { 00105 va_list param; 00106 00107 va_start(param, pCallee); 00108 callOut_v(pCallee, ¶m); 00109 va_end(param); 00110 } 00111 00112 } 00113 00114 00115 #endif 00116 00117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */