19#ifndef INCLUDED_COMPHELPER_EXTRACT_HXX
20#define INCLUDED_COMPHELPER_EXTRACT_HXX
26#include <com/sun/star/lang/IllegalArgumentException.hpp>
27#include <com/sun/star/uno/TypeClass.hpp>
28#include <com/sun/star/uno/Type.h>
29#include <com/sun/star/uno/Any.hxx>
40inline css::uno::Any
int2enum(sal_Int32 nEnum,
const css::uno::Type& rType)
42 assert(rType.getTypeClass() == css::uno::TypeClass_ENUM);
43 return css::uno::Any(&nEnum, rType);
54inline bool enum2int(sal_Int32& rnEnum,
const css::uno::Any& rAny)
56 if (rAny.getValueTypeClass() == css::uno::TypeClass_ENUM)
58 rnEnum = *
static_cast<const sal_Int32*
>(rAny.getValue());
62 return rAny >>= rnEnum;
73template <
typename E>
inline void any2enum(E& eRet,
const css::uno::Any& rAny)
81 throw css::lang::IllegalArgumentException();
105 throw css::lang::IllegalArgumentException();
bool enum2int(sal_Int32 &rnEnum, const css::uno::Any &rAny)
Sets int32 from enum or int in any.
css::uno::Any int2enum(sal_Int32 nEnum, const css::uno::Type &rType)
Sets enum from int32 value.
bool any2bool(const css::uno::Any &rAny)
Extracts a boolean either as a bool or an integer from an any.
void any2enum(E &eRet, const css::uno::Any &rAny)
Sets int32 from enum or int in any with additional typecheck.