1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: typeconverter.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef CONFIGMGR_TYPECONVERTER_HXX
31 #define CONFIGMGR_TYPECONVERTER_HXX
33 #include "utility.hxx"
34 #include <com/sun/star/script/XTypeConverter.hpp>
35 #include <rtl/ustring.hxx>
36 #include <com/sun/star/uno/Sequence.hxx>
40 namespace uno
= ::com::sun::star::uno
;
41 namespace script
= ::com::sun::star::script
;
44 uno::Type
getSequenceElementType(uno::Type
const& rSequenceType
);
46 uno::Type
getBasicType(uno::Type
const& rType
, bool& bSequence
);
48 uno::Type
getBasicType(uno::Type
const& rType
)
49 { bool dummy
; return getBasicType(rType
,dummy
); }
51 // Any Conversion - uses TypeConverter
52 uno::Any
toAny( const uno::Reference
< script::XTypeConverter
>& xTypeConverter
,
53 const ::rtl::OUString
& _rValue
,
54 const uno::TypeClass
& _rTypeClass
)
55 SAL_THROW((script::CannotConvertException
, com::sun::star::uno::RuntimeException
));
57 rtl::OUString
toString(const uno::Reference
< script::XTypeConverter
>& xTypeConverter
, const uno::Any
& rValue
)
58 SAL_THROW((script::CannotConvertException
, com::sun::star::uno::RuntimeException
));
61 ::rtl::OUString
toTypeName(const uno::TypeClass
& _rTypeClass
);
63 uno::Type
toType(const ::rtl::OUString
& _rsType
);
64 uno::Type
toListType(const ::rtl::OUString
& _rsElementType
);
65 ::rtl::OUString
toTypeName(const uno::Type
& _rType
);
68 uno::Type
toType(const ::rtl::OUString
& _rsSimpleType
, bool isList
)
70 return isList
? toListType(_rsSimpleType
) : toType(_rsSimpleType
);
74 ::rtl::OUString
toTemplateName(const uno::Type
& _rType
);
75 ::rtl::OUString
toTemplateName(const uno::TypeClass
& _rBasicType
, bool bList
= false);
76 ::rtl::OUString
toTemplateName(const ::rtl::OUString
& _rBasicTypeName
, bool bList
= false);
78 uno::Type
parseTemplateName(::rtl::OUString
const& sTypeName
);
79 bool parseTemplateName(::rtl::OUString
const& sTypeName
, ::rtl::OUString
& _rBasicName
, bool& bList
);
81 } // namespace configmgr
83 #endif /* CONFIGMGR_TYPECONVERTER_HXX */