1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include "registry/reader.hxx"
23 #include "registry/version.h"
28 //__________________________________________________________________________________________________
29 EnumTypeDescriptionImpl::~EnumTypeDescriptionImpl()
36 //__________________________________________________________________________________________________
37 TypeClass
EnumTypeDescriptionImpl::getTypeClass()
38 throw(::com::sun::star::uno::RuntimeException
)
40 return TypeClass_ENUM
;
42 //__________________________________________________________________________________________________
43 OUString
EnumTypeDescriptionImpl::getName()
44 throw(::com::sun::star::uno::RuntimeException
)
49 // XEnumTypeDescription
50 //__________________________________________________________________________________________________
51 sal_Int32
EnumTypeDescriptionImpl::getDefaultEnumValue()
52 throw(::com::sun::star::uno::RuntimeException
)
54 return _nDefaultValue
;
56 //__________________________________________________________________________________________________
57 Sequence
< OUString
> EnumTypeDescriptionImpl::getEnumNames()
58 throw(::com::sun::star::uno::RuntimeException
)
62 typereg::Reader
aReader(
63 _aBytes
.getConstArray(), _aBytes
.getLength(), false,
66 sal_uInt16 nFields
= aReader
.getFieldCount();
67 Sequence
< OUString
> * pTempEnumNames
= new Sequence
< OUString
>( nFields
);
68 OUString
* pEnumNames
= pTempEnumNames
->getArray();
72 pEnumNames
[nFields
] = aReader
.getFieldName( nFields
);
75 ClearableMutexGuard
aGuard( getMutex() );
79 delete pTempEnumNames
;
83 _pEnumNames
= pTempEnumNames
;
88 //__________________________________________________________________________________________________
89 Sequence
< sal_Int32
> EnumTypeDescriptionImpl::getEnumValues()
90 throw(::com::sun::star::uno::RuntimeException
)
94 typereg::Reader
aReader(
95 _aBytes
.getConstArray(), _aBytes
.getLength(), false,
98 sal_uInt16 nFields
= aReader
.getFieldCount();
99 Sequence
< sal_Int32
> * pTempEnumValues
= new Sequence
< sal_Int32
>( nFields
);
100 sal_Int32
* pEnumValues
= pTempEnumValues
->getArray();
104 pEnumValues
[nFields
] = getRTValueAsInt32(
105 aReader
.getFieldValue( nFields
) );
108 ClearableMutexGuard
aGuard( getMutex() );
112 delete pTempEnumValues
;
116 _pEnumValues
= pTempEnumValues
;
119 return *_pEnumValues
;
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */