1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_cppu_Enterable_hxx
21 #define INCLUDED_cppu_Enterable_hxx
23 #include "uno/Enterable.h"
24 #include "rtl/ustring.hxx"
28 /** C++ wrapper for binary C Enterable
29 (http://wiki.services.openoffice.org/wiki/Uno/Cpp/Spec/Environment_Stack)
34 class Enterable
: public uno_Enterable
37 /* These methods need to be implemented in a derived class.
39 virtual void v_enter (void) = 0;
40 virtual void v_leave (void) = 0;
41 virtual void v_callInto_v(uno_EnvCallee
* pCallee
, va_list * pParam
) = 0;
42 virtual void v_callOut_v (uno_EnvCallee
* pCallee
, va_list * pParam
) = 0;
43 virtual int v_isValid (rtl::OUString
* pReason
) = 0;
45 virtual ~Enterable() {}
48 inline explicit Enterable(void);
50 inline void enter(void) {m_enter(this);}
51 inline void leave(void) {m_leave(this);}
53 inline void callInto_v(uno_EnvCallee
* pCallee
, va_list * pParam
) {m_callInto_v(this, pCallee
, pParam
);}
54 inline void callOut_v (uno_EnvCallee
* pCallee
, va_list * pParam
) {m_callOut_v (this, pCallee
, pParam
);}
56 inline void callInto(uno_EnvCallee
* pCallee
, ...);
57 inline void callOut (uno_EnvCallee
* pCallee
, ...);
59 inline int isValid (rtl::OUString
* pReason
) {return m_isValid(this, (rtl_uString
**)pReason
);}
62 Enterable(Enterable
const &);
63 Enterable
& operator = (Enterable
const &);
66 extern "C" inline void Enterable_call_enter (void * context
) { ((Enterable
*)context
)->v_enter(); }
67 extern "C" inline void Enterable_call_leave (void * context
) { ((Enterable
*)context
)->v_leave(); }
68 extern "C" inline void Enterable_call_callInto_v(void * context
, uno_EnvCallee
* pCallee
, va_list * pParam
)
69 { ((Enterable
*)context
)->v_callInto_v(pCallee
, pParam
); }
70 extern "C" inline void Enterable_call_callOut_v (void * context
, uno_EnvCallee
* pCallee
, va_list * pParam
)
71 { ((Enterable
*)context
)->v_callOut_v(pCallee
, pParam
); }
72 extern "C" inline int Enterable_call_isValid (void * context
, rtl_uString
** pReason
)
73 {return ((Enterable
*)context
)->v_isValid((rtl::OUString
*)pReason
);}
76 Enterable::Enterable(void)
78 m_enter
= Enterable_call_enter
;
79 m_leave
= Enterable_call_leave
;
80 m_callInto_v
= Enterable_call_callInto_v
;
81 m_callOut_v
= Enterable_call_callOut_v
;
82 m_isValid
= Enterable_call_isValid
;
85 void Enterable::callInto(uno_EnvCallee
* pCallee
, ...)
89 va_start(param
, pCallee
);
90 callInto_v(pCallee
, ¶m
);
94 void Enterable::callOut(uno_EnvCallee
* pCallee
, ...)
98 va_start(param
, pCallee
);
99 callOut_v(pCallee
, ¶m
);
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */