AlterOffice
AlterOffice 3.4 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Map.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 #ifndef INCLUDED_CPPU_MAP_HXX
5 #define INCLUDED_CPPU_MAP_HXX
6 
7 #include "uno/mapping.hxx"
8 
9 
10 namespace cppu
11 {
23  template<class T> inline T * mapOut(T * pT, css::uno::Environment const & outerEnv)
24  {
25  css::uno::Mapping curr2outer(css::uno::Environment::getCurrent(), outerEnv);
26 
27  return reinterpret_cast<T *>(curr2outer.mapInterface(pT, cppu::UnoType<T>::get()));
28  }
29 
30 
38  template<class T> inline T * mapIn(T * pT, css::uno::Environment const & outerEnv)
39  {
40  css::uno::Mapping outer2curr(outerEnv, css::uno::Environment::getCurrent());
41 
42  return reinterpret_cast<T *>(outer2curr.mapInterface(pT, cppu::UnoType<T>::get()));
43  }
44 
45 
53  // Problem: any gets assigned to something, acquire/releases may be called in wrong env.
54  inline void mapOutAny(css::uno::Any const & any, css::uno::Any * res, css::uno::Environment const & outerEnv)
55  {
56  css::uno::Mapping curr2outer(css::uno::Environment::getCurrent(), outerEnv);
57 
60  res,
61  const_cast<void *>(any.getValue()),
62  any.getValueTypeRef(),
63  curr2outer.get());
64  }
65 
66 
74  inline void mapInAny(css::uno::Any const & any, css::uno::Any * res, css::uno::Environment const & outerEnv)
75  {
76  css::uno::Mapping outer2curr(outerEnv, css::uno::Environment::getCurrent());
77 
80  res,
81  const_cast<void *>(any.getValue()),
82  any.getValueTypeRef(),
83  outer2curr.get());
84  }
85 }
86 
87 #endif
88 
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
T * mapOut(T *pT, css::uno::Environment const &outerEnv)
Helpers for mapping objects relative to the current environment.
Definition: Map.hxx:23
void cpp_release(void *pCppI)
Function to release a C++ interface.
Definition: genfunc.hxx:30
void mapOutAny(css::uno::Any const &any, css::uno::Any *res, css::uno::Environment const &outerEnv)
Maps an any from the current to an outer Environment, fills passed any.
Definition: Map.hxx:54
CPPU_DLLPUBLIC void uno_type_any_constructAndConvert(uno_Any *pDest, void *pSource, struct _typelib_TypeDescriptionReference *pType, struct _uno_Mapping *mapping) SAL_THROW_EXTERN_C()
Constructs an any with a given value and converts/ maps interfaces.
T * mapIn(T *pT, css::uno::Environment const &outerEnv)
Maps an object from an outer Environment to the current, returns mapped object.
Definition: Map.hxx:38
CPPU_DLLPUBLIC void uno_any_destruct(uno_Any *pValue, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Destructs an any.
Get the css::uno::Type instance representing a certain UNO type.
Definition: unotype.hxx:31
void mapInAny(css::uno::Any const &any, css::uno::Any *res, css::uno::Environment const &outerEnv)
Maps an any from an outer Environment to the current, fills passed any.
Definition: Map.hxx:74