00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef INCLUDED_cppu_Map_hxx
00021 #define INCLUDED_cppu_Map_hxx
00022
00023 #include <uno/mapping.hxx>
00024
00025
00026 namespace cssu = com::sun::star::uno;
00027
00028 namespace cppu
00029 {
00041 template<class T> inline T * mapOut(T * pT, cssu::Environment const & outerEnv)
00042 {
00043 cssu::Mapping curr2outer(cssu::Environment::getCurrent(), outerEnv);
00044
00045 return reinterpret_cast<T *>(curr2outer.mapInterface(pT, getCppuType((cssu::Reference<T> *)NULL)));
00046 }
00047
00048
00056 template<class T> inline T * mapIn(T * pT, cssu::Environment const & outerEnv)
00057 {
00058 cssu::Mapping outer2curr(outerEnv, cssu::Environment::getCurrent());
00059
00060 return reinterpret_cast<T *>(outer2curr.mapInterface(pT, getCppuType((cssu::Reference<T> *)NULL)));
00061 }
00062
00063
00071
00072 inline void mapOutAny(cssu::Any const & any, cssu::Any * res, cssu::Environment const & outerEnv)
00073 {
00074 cssu::Mapping curr2outer(cssu::Environment::getCurrent(), outerEnv);
00075
00076 uno_any_destruct(res, (uno_ReleaseFunc)cssu::cpp_release);
00077 uno_type_any_constructAndConvert(
00078 res,
00079 const_cast<void *>(any.getValue()),
00080 any.getValueTypeRef(),
00081 curr2outer.get());
00082 }
00083
00084
00092 inline void mapInAny(cssu::Any const & any, cssu::Any * res, cssu::Environment const & outerEnv)
00093 {
00094 cssu::Mapping outer2curr(outerEnv, cssu::Environment::getCurrent());
00095
00096 uno_any_destruct(res, (uno_ReleaseFunc)cssu::cpp_release);
00097 uno_type_any_constructAndConvert(
00098 res,
00099 const_cast<void *>(any.getValue()),
00100 any.getValueTypeRef(),
00101 outer2curr.get());
00102 }
00103 }
00104
00105 #endif
00106
00107