My Project
UDK 3.2.7 C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Enterable.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * Copyright 2000, 2010 Oracle and/or its affiliates.
7  *
8  * OpenOffice.org - a multi-platform office productivity suite
9  *
10  * This file is part of OpenOffice.org.
11  *
12  * OpenOffice.org is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License version 3
14  * only, as published by the Free Software Foundation.
15  *
16  * OpenOffice.org is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License version 3 for more details
20  * (a copy is included in the LICENSE file that accompanied this code).
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * version 3 along with OpenOffice.org. If not, see
24  * <http://www.openoffice.org/license.html>
25  * for a copy of the LGPLv3 License.
26  *
27  ************************************************************************/
28 
29 #ifndef INCLUDED_cppu_Enterable_hxx
30 #define INCLUDED_cppu_Enterable_hxx
31 
32 #include "uno/Enterable.h"
33 #include "rtl/ustring.hxx"
34 
35 namespace cppu
36 {
43 class Enterable : public uno_Enterable
44 {
45 public:
46  /* These methods need to be implemented in a derived class.
47  */
48  virtual void v_enter (void) = 0;
49  virtual void v_leave (void) = 0;
50  virtual void v_callInto_v(uno_EnvCallee * pCallee, va_list * pParam) = 0;
51  virtual void v_callOut_v (uno_EnvCallee * pCallee, va_list * pParam) = 0;
52  virtual int v_isValid (rtl::OUString * pReason) = 0;
53 
54  virtual ~Enterable() {}
55 
56 public:
57  inline explicit Enterable(void);
58 
59  inline void enter(void) {m_enter(this);}
60  inline void leave(void) {m_leave(this);}
61 
62  inline void callInto_v(uno_EnvCallee * pCallee, va_list * pParam) {m_callInto_v(this, pCallee, pParam);}
63  inline void callOut_v (uno_EnvCallee * pCallee, va_list * pParam) {m_callOut_v (this, pCallee, pParam);}
64 
65  inline void callInto(uno_EnvCallee * pCallee, ...);
66  inline void callOut (uno_EnvCallee * pCallee, ...);
67 
68  inline int isValid (rtl::OUString * pReason) {return m_isValid(this, (rtl_uString **)pReason);}
69 
70 private:
71  Enterable(Enterable const &);
72  Enterable & operator = (Enterable const &);
73 };
74 
75 extern "C" inline void Enterable_call_enter (void * context) { ((Enterable *)context)->v_enter(); }
76 extern "C" inline void Enterable_call_leave (void * context) { ((Enterable *)context)->v_leave(); }
77 extern "C" inline void Enterable_call_callInto_v(void * context, uno_EnvCallee * pCallee, va_list * pParam)
78  { ((Enterable *)context)->v_callInto_v(pCallee, pParam); }
79 extern "C" inline void Enterable_call_callOut_v (void * context, uno_EnvCallee * pCallee, va_list * pParam)
80  { ((Enterable *)context)->v_callOut_v(pCallee, pParam); }
81 extern "C" inline int Enterable_call_isValid (void * context, rtl_uString ** pReason)
82  {return ((Enterable *)context)->v_isValid((rtl::OUString *)pReason);}
83 
84 
86 {
92 }
93 
94 void Enterable::callInto(uno_EnvCallee * pCallee, ...)
95 {
96  va_list param;
97 
98  va_start(param, pCallee);
99  callInto_v(pCallee, &param);
100  va_end(param);
101 }
102 
103 void Enterable::callOut(uno_EnvCallee * pCallee, ...)
104 {
105  va_list param;
106 
107  va_start(param, pCallee);
108  callOut_v(pCallee, &param);
109  va_end(param);
110 }
111 
112 }
113 
114 
115 #endif
116 
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */