update dev300-m58
[ooovba.git] / stoc / source / registry_tdprovider / tdconsts.cxx
blob5c5847c7c55f0dffae1223d1dd2a54e5a8c077b4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tdconsts.cxx,v $
10 * $Revision: 1.6 $
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 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_stoc.hxx"
33 #include <osl/diagnose.h>
34 #include <rtl/ustrbuf.hxx>
35 #include "registry/reader.hxx"
36 #include "registry/version.h"
37 #include "base.hxx"
39 namespace stoc_rdbtdp
42 //__________________________________________________________________________________________________
43 // virtual
44 ConstantsTypeDescriptionImpl::~ConstantsTypeDescriptionImpl()
46 delete _pMembers;
48 g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
51 // XTypeDescription
52 //__________________________________________________________________________________________________
53 // virtual
54 TypeClass ConstantsTypeDescriptionImpl::getTypeClass()
55 throw( RuntimeException )
57 return TypeClass_CONSTANTS;
59 //__________________________________________________________________________________________________
60 // virtual
61 OUString ConstantsTypeDescriptionImpl::getName()
62 throw( RuntimeException )
64 return _aName;
67 // XConstantsTypeDescription
68 //__________________________________________________________________________________________________
69 // virtual
70 Sequence< Reference< XConstantTypeDescription > > SAL_CALL
71 ConstantsTypeDescriptionImpl::getConstants()
72 throw ( RuntimeException )
74 if ( !_pMembers )
76 typereg::Reader aReader(
77 _aBytes.getConstArray(), _aBytes.getLength(), false,
78 TYPEREG_VERSION_1);
80 sal_uInt16 nFields = aReader.getFieldCount();
81 Sequence< Reference< XConstantTypeDescription > > * pTempConsts
82 = new Sequence< Reference< XConstantTypeDescription > >( nFields );
83 Reference< XConstantTypeDescription > * pConsts
84 = pTempConsts->getArray();
86 while ( nFields-- )
88 rtl::OUStringBuffer aName( _aName );
89 aName.appendAscii( "." );
90 aName.append( aReader.getFieldName( nFields ) );
92 Any aValue( getRTValue( aReader.getFieldValue( nFields ) ) );
94 pConsts[ nFields ]
95 = new ConstantTypeDescriptionImpl( aName.makeStringAndClear(),
96 aValue );
99 ClearableMutexGuard aGuard( getMutex() );
100 if ( _pMembers )
102 aGuard.clear();
103 delete pTempConsts;
105 else
107 _pMembers = pTempConsts;
110 return *_pMembers;