LibreOffice
LibreOffice 7.1 SDK C/C++ API Reference
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 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_CPPU_ENTERABLE_HXX
21#define INCLUDED_CPPU_ENTERABLE_HXX
22
23#include "uno/Enterable.h"
24#include "rtl/ustring.hxx"
25
26namespace cppu
27{
35{
36public:
37 /* These methods need to be implemented in a derived class.
38 */
39 virtual void v_enter() = 0;
40 virtual void v_leave() = 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 bool v_isValid (rtl::OUString * pReason) = 0;
44
45 virtual ~Enterable() {}
46
47public:
48 inline explicit Enterable();
49
50 void enter() {m_enter(this);}
51 void leave() {m_leave(this);}
52
53 void callInto_v(uno_EnvCallee * pCallee, va_list * pParam) {m_callInto_v(this, pCallee, pParam);}
54 void callOut_v (uno_EnvCallee * pCallee, va_list * pParam) {m_callOut_v (this, pCallee, pParam);}
55
56 inline void callInto(uno_EnvCallee * pCallee, ...);
57 inline void callOut (uno_EnvCallee * pCallee, ...);
58
59 int isValid (rtl::OUString * pReason) {return m_isValid(this, &pReason->pData);}
60
61private:
63 Enterable & operator = (Enterable const &) SAL_DELETED_FUNCTION;
64};
65
66extern "C" inline void Enterable_call_enter (void * context) { static_cast<Enterable *>(context)->v_enter(); }
67extern "C" inline void Enterable_call_leave (void * context) { static_cast<Enterable *>(context)->v_leave(); }
68extern "C" inline void Enterable_call_callInto_v(void * context, uno_EnvCallee * pCallee, va_list * pParam)
69 { static_cast<Enterable *>(context)->v_callInto_v(pCallee, pParam); }
70extern "C" inline void Enterable_call_callOut_v (void * context, uno_EnvCallee * pCallee, va_list * pParam)
71 { static_cast<Enterable *>(context)->v_callOut_v(pCallee, pParam); }
72extern "C" inline int Enterable_call_isValid (void * context, rtl_uString ** pReason)
73 {return static_cast<Enterable *>(context)->v_isValid(reinterpret_cast<rtl::OUString *>(pReason));}
74
75
77{
83}
84
86{
87 va_list param;
88
89 va_start(param, pCallee);
90 callInto_v(pCallee, &param);
91 va_end(param);
92}
93
95{
96 va_list param;
97
98 va_start(param, pCallee);
99 callOut_v(pCallee, &param);
100 va_end(param);
101}
102
103}
104
105
106#endif
107
108/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition: types.h:374
void uno_EnvCallee(va_list *pParam)
Typedef for variable argument function.
Definition: environment.h:338
Definition: Enterable.hxx:27
void Enterable_call_enter(void *context)
Definition: Enterable.hxx:66
int Enterable_call_isValid(void *context, rtl_uString **pReason)
Definition: Enterable.hxx:72
void Enterable_call_callInto_v(void *context, uno_EnvCallee *pCallee, va_list *pParam)
Definition: Enterable.hxx:68
void Enterable_call_leave(void *context)
Definition: Enterable.hxx:67
void Enterable_call_callOut_v(void *context, uno_EnvCallee *pCallee, va_list *pParam)
Definition: Enterable.hxx:70
C++ wrapper for binary C Enterable (http://wiki.openoffice.org/wiki/Uno/Cpp/Spec/Environment_Stack)
Definition: Enterable.hxx:35
virtual void v_enter()=0
virtual bool v_isValid(rtl::OUString *pReason)=0
virtual void v_callOut_v(uno_EnvCallee *pCallee, va_list *pParam)=0
void enter()
Definition: Enterable.hxx:50
virtual void v_leave()=0
void leave()
Definition: Enterable.hxx:51
void callInto(uno_EnvCallee *pCallee,...)
Definition: Enterable.hxx:85
void callOut(uno_EnvCallee *pCallee,...)
Definition: Enterable.hxx:94
int isValid(rtl::OUString *pReason)
Definition: Enterable.hxx:59
virtual void v_callInto_v(uno_EnvCallee *pCallee, va_list *pParam)=0
void callOut_v(uno_EnvCallee *pCallee, va_list *pParam)
Definition: Enterable.hxx:54
Enterable()
Definition: Enterable.hxx:76
void callInto_v(uno_EnvCallee *pCallee, va_list *pParam)
Definition: Enterable.hxx:53
virtual ~Enterable()
Definition: Enterable.hxx:45
This String class provides base functionality for C++ like Unicode character array handling.
Definition: ustring.hxx:161
A struct pReserved needs to point to, if implementing a purpose environment.
Definition: Enterable.h:90
uno_Enterable_enter * m_enter
Definition: Enterable.h:91
uno_Enterable_isValid_v * m_isValid
Definition: Enterable.h:95
uno_Enterable_callOut_v * m_callOut_v
Definition: Enterable.h:94
uno_Enterable_callInto_v * m_callInto_v
Definition: Enterable.h:93
uno_Enterable_leave * m_leave
Definition: Enterable.h:92