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 .
21 #include <cppu/EnvDcp.hxx>
23 #include <cppu/helper/purpenv/Environment.hxx>
24 #include <cppu/helper/purpenv/Mapping.hxx>
28 #define LOG_LIFECYCLE_TestEnv
29 #ifdef LOG_LIFECYCLE_TestEnv
31 # define LOG_LIFECYCLE_TestEnv_emit(x) x
34 # define LOG_LIFECYCLE_TestEnv_emit(x)
39 class TestEnv
: public cppu::Enterable
49 virtual void v_enter();
50 virtual void v_leave();
52 virtual void v_callInto_v(uno_EnvCallee
* pCallee
, va_list * pParam
);
53 virtual void v_callOut_v (uno_EnvCallee
* pCallee
, va_list * pParam
);
55 virtual bool v_isValid (rtl::OUString
* pReason
);
61 LOG_LIFECYCLE_TestEnv_emit(fprintf(stderr
, "LIFE: %s -> %p\n", "TestEnv::TestEnv(...)", this));
66 LOG_LIFECYCLE_TestEnv_emit(fprintf(stderr
, "LIFE: %s -> %p\n", "TestEnv::~TestEnv()", this));
70 void TestEnv::v_callInto_v(uno_EnvCallee
* pCallee
, va_list * pParam
)
77 void TestEnv::v_callOut_v(uno_EnvCallee
* pCallee
, va_list * pParam
)
84 void TestEnv::v_enter()
89 void TestEnv::v_leave()
94 bool TestEnv::v_isValid(rtl::OUString
* pReason
)
96 bool result
= m_inCount
& 1;
99 *pReason
= rtl::OUString("OK");
102 *pReason
= rtl::OUString("not entered/invoked");
107 extern "C" void SAL_CALL
uno_initEnvironment(uno_Environment
* pEnv
) SAL_THROW_EXTERN_C()
109 cppu::helper::purpenv::Environment_initWithEnterable(pEnv
, new TestEnv());
112 extern "C" void uno_ext_getMapping(uno_Mapping
** ppMapping
,
113 uno_Environment
* pFrom
,
114 uno_Environment
* pTo
)
116 cppu::helper::purpenv::createMapping(ppMapping
, pFrom
, pTo
);
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */