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: registry.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 ************************************************************************/
31 #ifndef _CODEMAKER_REGISTRY_HXX_
32 #define _CODEMAKER_REGISTRY_HXX_
34 #include <rtl/alloc.h>
35 #include <osl/interlck.h>
36 #include <registry/registry.hxx>
37 #include "registry/reader.hxx"
38 #include "registry/version.h"
39 #include <codemaker/options.hxx>
41 struct TypeReader_Impl
43 TypeReader_Impl(const sal_uInt8
* buffer
,
47 , m_copyData(copyData
)
48 , m_blopSize(bufferLen
)
53 m_pBlop
= (sal_uInt8
*)rtl_allocateMemory(bufferLen
);
54 rtl_copyMemory((void*)m_pBlop
, buffer
, bufferLen
);
57 m_blopSize
= bufferLen
;
61 m_pReader
= new typereg::Reader(
62 m_pBlop
, m_blopSize
, false, TYPEREG_VERSION_1
);
67 if (m_copyData
&& m_pReader
)
76 const sal_uInt8
* m_pBlop
;
77 typereg::Reader
* m_pReader
;
83 inline TypeReader(const RegistryTypeReader_Api* pApi,
84 const sal_uInt8* buffer,
93 inline TypeReader( const sal_uInt8
* buffer
,
97 m_pImpl
= new TypeReader_Impl(buffer
, bufferLen
, copyData
);
101 inline TypeReader(const TypeReader
& toCopy
)
102 : m_pImpl(toCopy
.m_pImpl
)
112 inline void acquire()
115 osl_incrementInterlockedCount(&m_pImpl
->m_refCount
);
118 inline void release()
120 if (m_pImpl
&& 0 == osl_decrementInterlockedCount(&m_pImpl
->m_refCount
))
126 inline TypeReader
& operator = ( const TypeReader
& value
)
129 m_pImpl
= value
.m_pImpl
;
134 inline sal_Bool
isValid() const
137 return m_pImpl
->m_pReader
->isValid();
142 inline RTTypeClass
getTypeClass() const
143 { return m_pImpl
->m_pReader
->getTypeClass(); }
144 inline const ::rtl::OString
getTypeName() const
145 { return inGlobalSet( m_pImpl
->m_pReader
->getTypeName() ); }
146 inline sal_uInt16
getSuperTypeCount() const
147 { return m_pImpl
->m_pReader
->getSuperTypeCount(); }
148 inline const ::rtl::OString
getSuperTypeName(sal_uInt16 index
) const
149 { return inGlobalSet( m_pImpl
->m_pReader
->getSuperTypeName(index
) ); }
150 inline const ::rtl::OString
getDoku() const
151 { return inGlobalSet( m_pImpl
->m_pReader
->getDocumentation() ); }
152 inline const ::rtl::OString
getFileName() const
153 { return inGlobalSet( m_pImpl
->m_pReader
->getFileName() ); }
154 inline sal_uInt32
getFieldCount() const
155 { return m_pImpl
->m_pReader
->getFieldCount(); }
156 inline const ::rtl::OString
getFieldName( sal_uInt16 index
) const
157 { return inGlobalSet( m_pImpl
->m_pReader
->getFieldName(index
) ); }
158 inline const ::rtl::OString
getFieldType( sal_uInt16 index
) const
159 { return inGlobalSet( m_pImpl
->m_pReader
->getFieldTypeName(index
) ); }
160 inline RTFieldAccess
getFieldAccess( sal_uInt16 index
) const
161 { return m_pImpl
->m_pReader
->getFieldFlags(index
); }
162 inline RTConstValue
getFieldConstValue( sal_uInt16 index
) const
163 { return m_pImpl
->m_pReader
->getFieldValue(index
); }
164 inline const ::rtl::OString
getFieldDoku( sal_uInt16 index
) const
165 { return inGlobalSet( m_pImpl
->m_pReader
->getFieldDocumentation(index
) ); }
166 inline const ::rtl::OString
getFieldFileName( sal_uInt16 index
) const
167 { return inGlobalSet( m_pImpl
->m_pReader
->getFieldFileName(index
) ); }
168 inline sal_uInt32
getMethodCount() const
169 { return m_pImpl
->m_pReader
->getMethodCount(); }
170 inline const ::rtl::OString
getMethodName( sal_uInt16 index
) const
171 { return inGlobalSet( m_pImpl
->m_pReader
->getMethodName(index
) ); }
172 inline sal_uInt32
getMethodParamCount( sal_uInt16 index
) const
173 { return m_pImpl
->m_pReader
->getMethodParameterCount(index
); }
174 inline const ::rtl::OString
getMethodParamType( sal_uInt16 index
, sal_uInt16 paramIndex
) const
175 { return inGlobalSet( m_pImpl
->m_pReader
->getMethodParameterTypeName(index
,paramIndex
) ); }
176 inline const ::rtl::OString
getMethodParamName( sal_uInt16 index
, sal_uInt16 paramIndex
) const
177 { return inGlobalSet( m_pImpl
->m_pReader
->getMethodParameterName(index
,paramIndex
) ); }
178 inline RTParamMode
getMethodParamMode( sal_uInt16 index
, sal_uInt16 paramIndex
) const
179 { return m_pImpl
->m_pReader
->getMethodParameterFlags(index
,paramIndex
); }
180 inline sal_uInt32
getMethodExcCount( sal_uInt16 index
) const
181 { return m_pImpl
->m_pReader
->getMethodExceptionCount(index
); }
182 inline const ::rtl::OString
getMethodExcType( sal_uInt16 index
, sal_uInt16 excIndex
) const
183 { return inGlobalSet( m_pImpl
->m_pReader
->getMethodExceptionTypeName(index
,excIndex
) ); }
184 inline const ::rtl::OString
getMethodReturnType( sal_uInt16 index
) const
185 { return inGlobalSet( m_pImpl
->m_pReader
->getMethodReturnTypeName(index
) ); }
186 inline RTMethodMode
getMethodMode( sal_uInt16 index
) const
187 { return m_pImpl
->m_pReader
->getMethodFlags(index
); }
188 inline const ::rtl::OString
getMethodDoku( sal_uInt16 index
) const
189 { return inGlobalSet( m_pImpl
->m_pReader
->getMethodDocumentation(index
) ); }
191 inline sal_uInt32
getReferenceCount() const
192 { return m_pImpl
->m_pReader
->getReferenceCount(); }
193 inline const ::rtl::OString
getReferenceName( sal_uInt16 index
) const
194 { return inGlobalSet( m_pImpl
->m_pReader
->getReferenceTypeName(index
) ); }
195 inline RTReferenceType
getReferenceType( sal_uInt16 index
) const
196 { return m_pImpl
->m_pReader
->getReferenceSort(index
); }
197 inline const ::rtl::OString
getReferenceDoku( sal_uInt16 index
) const
198 { return inGlobalSet( m_pImpl
->m_pReader
->getReferenceDocumentation(index
) ); }
200 inline sal_uInt32
getBlopSize() const
201 { return m_pImpl
->m_blopSize
; }
203 inline const sal_uInt8
* getBlop() const
204 { return m_pImpl
->m_pBlop
; }
207 TypeReader_Impl
* m_pImpl
;
211 #endif // _CODEMAKER_REGISTRY_HXX_