/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
/* * This file is part of LibreOffice published API.
*/ #ifndef INCLUDED_UNO_ENVIRONMENT_HXX #define INCLUDED_UNO_ENVIRONMENT_HXX
namespace com
{ namespace sun
{ namespace star
{ namespace uno
{
/** C++ wrapper for binary C uno_Environment.
@see uno_Environment
*/ class Environment
{ /** binary C uno_Environment
*/
uno_Environment * _pEnv;
public: /** Returns the current Environment.
@param typeName the optional type of the Environment, falls back to "uno" in case being empty, respectively to current C++ Environment. @since UDK 3.2.7
*/ inlinestatic Environment getCurrent(rtl::OUString const & typeName = rtl::OUString(CPPU_CURRENT_LANGUAGE_BINDING_NAME));
/// @cond INTERNAL // these are here to force memory de/allocation to sal lib. staticvoid * SAL_CALL operatornew ( size_t nSize )
{ return ::rtl_allocateMemory( nSize ); } staticvoid SAL_CALL operatordelete ( void * pMem )
{ ::rtl_freeMemory( pMem ); } staticvoid * SAL_CALL operatornew ( size_t, void * pMem )
{ return pMem; } staticvoid SAL_CALL operatordelete ( void *, void * )
{} /// @endcond
/** Destructor: releases a set environment.
*/ inline ~Environment();
/** Sets a given environment, i.e. acquires given one and releases a set one.
@param pEnv another environment @return this environment
*/ inline Environment & SAL_CALL operator = ( uno_Environment * pEnv ); /** Sets a given environment, i.e. acquires given one and releases a set one.
/** Provides UNacquired pointer to the set C environment.
@return UNacquired pointer to the C environment struct
*/
uno_Environment * SAL_CALL get() const
{ return _pEnv; }
/** Gets type name of set environment.
@return type name of set environment
*/
::rtl::OUString SAL_CALL getTypeName() const
{ return _pEnv->pTypeName; }
/** Gets free context pointer of set environment.
@return free context pointer of set environment
*/ void * SAL_CALL getContext() const
{ return _pEnv->pContext; }
/** Tests if an environment is set.
@return true, if an environment is set, false otherwise
*/ bool SAL_CALL is() const
{ return (_pEnv != NULL); }
/** Releases a set environment.
*/ inlinevoid SAL_CALL clear();
/** Invoke the passed function in this environment.
@param pCallee the function to call @param pParam the parameter pointer to be passed to the function @since UDK 3.2.7
*/ inlinevoid SAL_CALL invoke_v(uno_EnvCallee * pCallee, va_list * pParam) const;
/** Invoke the passed function in this environment.
@param pCallee the function to call @param ... the parameters to be passed to the function @since UDK 3.2.7
*/ inlinevoid SAL_CALL invoke(uno_EnvCallee * pCallee, ...) const;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.