UDK 3.2.7 C/C++ API Reference

cppu/Enterable.hxx

Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /*
00003  * This file is part of the LibreOffice project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * This file incorporates work covered by the following license notice:
00010  *
00011  *   Licensed to the Apache Software Foundation (ASF) under one or more
00012  *   contributor license agreements. See the NOTICE file distributed
00013  *   with this work for additional information regarding copyright
00014  *   ownership. The ASF licenses this file to you under the Apache
00015  *   License, Version 2.0 (the "License"); you may not use this file
00016  *   except in compliance with the License. You may obtain a copy of
00017  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
00018  */
00019 
00020 #ifndef INCLUDED_cppu_Enterable_hxx
00021 #define INCLUDED_cppu_Enterable_hxx
00022 
00023 #include "uno/Enterable.h"
00024 #include "rtl/ustring.hxx"
00025 
00026 namespace cppu
00027 {
00034 class Enterable : public uno_Enterable
00035 {
00036 public:
00037     /* These methods need to be implemented in a derived class.
00038      */
00039     virtual void v_enter     (void)                                      = 0;
00040     virtual void v_leave     (void)                                      = 0;
00041     virtual void v_callInto_v(uno_EnvCallee * pCallee, va_list * pParam) = 0;
00042     virtual void v_callOut_v (uno_EnvCallee * pCallee, va_list * pParam) = 0;
00043     virtual int  v_isValid   (rtl::OUString * pReason)                   = 0;
00044 
00045     virtual ~Enterable() {}
00046 
00047 public:
00048     inline explicit Enterable(void);
00049 
00050     inline void enter(void) {m_enter(this);}
00051     inline void leave(void) {m_leave(this);}
00052 
00053     inline void callInto_v(uno_EnvCallee * pCallee, va_list * pParam) {m_callInto_v(this, pCallee, pParam);}
00054     inline void callOut_v (uno_EnvCallee * pCallee, va_list * pParam) {m_callOut_v (this, pCallee, pParam);}
00055 
00056     inline void callInto(uno_EnvCallee * pCallee, ...);
00057     inline void callOut (uno_EnvCallee * pCallee, ...);
00058 
00059     inline int  isValid (rtl::OUString * pReason) {return m_isValid(this, (rtl_uString **)pReason);}
00060 
00061 private:
00062     Enterable(Enterable const &);
00063     Enterable & operator = (Enterable const &);
00064 };
00065 
00066 extern "C" inline void Enterable_call_enter (void * context) { ((Enterable *)context)->v_enter(); }
00067 extern "C" inline void Enterable_call_leave (void * context) { ((Enterable *)context)->v_leave(); }
00068 extern "C" inline void Enterable_call_callInto_v(void * context, uno_EnvCallee * pCallee, va_list * pParam)
00069     { ((Enterable *)context)->v_callInto_v(pCallee, pParam); }
00070 extern "C" inline void Enterable_call_callOut_v (void * context, uno_EnvCallee * pCallee, va_list * pParam)
00071     { ((Enterable *)context)->v_callOut_v(pCallee, pParam); }
00072 extern "C" inline int  Enterable_call_isValid   (void * context, rtl_uString ** pReason)
00073     {return ((Enterable *)context)->v_isValid((rtl::OUString *)pReason);}
00074 
00075 
00076 Enterable::Enterable(void)
00077 {
00078     m_enter      = Enterable_call_enter;
00079     m_leave      = Enterable_call_leave;
00080     m_callInto_v = Enterable_call_callInto_v;
00081     m_callOut_v  = Enterable_call_callOut_v;
00082     m_isValid    = Enterable_call_isValid;
00083 }
00084 
00085 void Enterable::callInto(uno_EnvCallee * pCallee, ...)
00086 {
00087     va_list param;
00088 
00089     va_start(param, pCallee);
00090     callInto_v(pCallee, &param);
00091     va_end(param);
00092 }
00093 
00094 void Enterable::callOut(uno_EnvCallee * pCallee, ...)
00095 {
00096     va_list param;
00097 
00098     va_start(param, pCallee);
00099     callOut_v(pCallee, &param);
00100     va_end(param);
00101 }
00102 
00103 }
00104 
00105 
00106 #endif
00107 
00108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines