diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-01-28 20:57:40 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-01-28 20:57:40 +0100 |
commit | 2716f7dce26f16a2b677c178aa7d01cea096ae47 (patch) | |
tree | 9e9f67205cd5b72f1031721273e1534a3a1e5b0f /rdbmaker/source/codemaker | |
parent | 10ac9e750447fd57e3cef7993b0ad6c6538d6269 (diff) |
replace obsolete "master" branch with README that points at new repoHEADmaster-deletedmaster
Diffstat (limited to 'rdbmaker/source/codemaker')
-rw-r--r-- | rdbmaker/source/codemaker/dependency.cxx | 303 | ||||
-rw-r--r-- | rdbmaker/source/codemaker/global.cxx | 171 | ||||
-rw-r--r-- | rdbmaker/source/codemaker/makefile.mk | 55 | ||||
-rw-r--r-- | rdbmaker/source/codemaker/options.cxx | 69 | ||||
-rw-r--r-- | rdbmaker/source/codemaker/typemanager.cxx | 277 |
5 files changed, 0 insertions, 875 deletions
diff --git a/rdbmaker/source/codemaker/dependency.cxx b/rdbmaker/source/codemaker/dependency.cxx deleted file mode 100644 index b1c6032b0..000000000 --- a/rdbmaker/source/codemaker/dependency.cxx +++ /dev/null @@ -1,303 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <osl/interlck.h> -#include <rtl/alloc.h> -#include <codemaker/dependency.hxx> - -using ::rtl::OString; -using ::rtl::OStringBuffer; -TypeDependency::TypeDependency() -{ - m_pImpl = new TypeDependencyImpl(); - acquire(); -} - -TypeDependency::~TypeDependency() -{ - release(); -} - -void TypeDependency::acquire() -{ - osl_incrementInterlockedCount(&m_pImpl->m_refCount); -} - -void TypeDependency::release() -{ - if (0 == osl_decrementInterlockedCount(&m_pImpl->m_refCount)) - { - delete m_pImpl; - } -} - -sal_Bool TypeDependency::insert(const OString& type, const OString& depend, sal_uInt16 use) -{ - sal_Bool ret = sal_False; - - if (type.getLength() > 0 && depend.getLength() > 0) - { - if (m_pImpl->m_dependencies.count(type) > 0) - { - TypeUsing typeUsing(depend, use); - TypeUsingSet::iterator iter; - if ((iter = m_pImpl->m_dependencies[type].find(typeUsing)) != m_pImpl->m_dependencies[type].end()) - { - (((TypeUsing *) &(*iter))->m_use) = (*iter).m_use | use; - } else - { - m_pImpl->m_dependencies[type].insert(typeUsing); - } - } else - { - TypeUsing typeUsing(depend, use); - TypeUsingSet tmpSet; - tmpSet.insert(typeUsing); - m_pImpl->m_dependencies[type]=tmpSet; - } - } - - return ret; -} - -TypeUsingSet TypeDependency::getDependencies(const OString& type) -{ - if (type.getLength() > 0) - { - if (m_pImpl->m_dependencies.count(type) > 0) - { - return m_pImpl->m_dependencies[type]; - } - } - - return TypeUsingSet(); -} - -sal_Bool TypeDependency::hasDependencies(const OString& type) -{ - if (type.getLength() > 0) - { - if (m_pImpl->m_dependencies.count(type) > 0) - { - return sal_True; - } - } - - return sal_False; -} - -void TypeDependency::setGenerated(const OString& type, sal_uInt16 genFlag) -{ -// m_pImpl->m_generatedTypes.insert(type); - if (m_pImpl->m_generatedTypes.count(type) > 0) - m_pImpl->m_generatedTypes[type]= m_pImpl->m_generatedTypes[type] | genFlag; - else - m_pImpl->m_generatedTypes[type]=genFlag; -} - -sal_Bool TypeDependency::isGenerated(const OString& type, sal_uInt16 genFlag) -{ -/* - if (m_pImpl->m_generatedTypes.count(type) > 0) - return sal_True; - - return sal_False; -*/ - if (m_pImpl->m_generatedTypes.count(type) > 0 && - m_pImpl->m_generatedTypes[type] & genFlag) - { - return sal_True; - } - - return sal_False; -} - -static sal_Bool checkFieldDependencies(TypeManager& typeMgr, TypeDependency& dependencies, - TypeReader& reader, const OString& type) -{ - sal_uInt32 count = reader.getFieldCount(); - - if (count == 0 || reader.getTypeClass() == RT_TYPE_ENUM) - return sal_True; - - OString fieldType; - for (sal_uInt16 i=0; i < count; i++) - { - fieldType = reader.getFieldType(i); - - if (fieldType.getLength() > 0) - { - dependencies.insert(type, fieldType, TYPEUSE_MEMBER); - checkTypeDependencies(typeMgr, dependencies, fieldType); - } - } - - return sal_True; -} - -static sal_Bool checkMethodDependencies(TypeManager& typeMgr, TypeDependency& dependencies, - TypeReader& reader, const OString& type) -{ - sal_uInt32 count = reader.getMethodCount(); - - if (count == 0) - return sal_True; - - OString returnType, paramType, excType; - sal_uInt32 paramCount = 0; - sal_uInt32 excCount = 0; - RTParamMode paramMode = RT_PARAM_INVALID; - for (sal_uInt16 i=0; i < count; i++) - { - returnType = reader.getMethodReturnType(i); - - dependencies.insert(type, returnType, TYPEUSE_RETURN); - checkTypeDependencies(typeMgr, dependencies, returnType); - - paramCount = reader.getMethodParamCount(i); - excCount = reader.getMethodExcCount(i); - - sal_uInt16 j; - for (j=0; j < paramCount; j++) - { - paramType = reader.getMethodParamType(i, j); - paramMode = reader.getMethodParamMode(i, j); - - switch (paramMode) - { - case RT_PARAM_IN: - dependencies.insert(type, paramType, TYPEUSE_INPARAM); - break; - case RT_PARAM_OUT: - dependencies.insert(type, paramType, TYPEUSE_OUTPARAM); - break; - case RT_PARAM_INOUT: - dependencies.insert(type, paramType, TYPEUSE_INOUTPARAM); - break; - default: - break; - } - - checkTypeDependencies(typeMgr, dependencies, paramType); - } - - for (j=0; j < excCount; j++) - { - excType = reader.getMethodExcType(i, j); - dependencies.insert(type, excType, TYPEUSE_EXCEPTION); - checkTypeDependencies(typeMgr, dependencies, excType); - } - - } - - return sal_True; -} - -static sal_Bool checkReferenceDependencies(TypeManager& typeMgr, TypeDependency& dependencies, - TypeReader& reader, const OString& type) -{ - sal_uInt32 count = reader.getReferenceCount(); - - if (count == 0) - return sal_True; - - OString referenceName; - for (sal_uInt16 i=0; i < count; i++) - { - referenceName = reader.getReferenceName(i); - - dependencies.insert(type, referenceName, TYPEUSE_NORMAL); - checkTypeDependencies(typeMgr, dependencies, referenceName); - } - - return sal_True; -} - -sal_Bool checkTypeDependencies(TypeManager& typeMgr, TypeDependency& dependencies, const OString& type, sal_Bool bDepend) -{ - if (!typeMgr.isValidType(type)) - return sal_False; - - if (dependencies.hasDependencies(type)) - return sal_True; - - TypeReader reader = typeMgr.getTypeReader(type); - - if ( !reader.isValid() ) - { - if (type.equals("/")) - return sal_True; - else - return sal_False; - } - - if ( bDepend && reader.getTypeClass() == RT_TYPE_MODULE) - { - checkFieldDependencies(typeMgr, dependencies, reader, type); - return sal_True; - } - - for (sal_uInt16 i = 0; i < reader.getSuperTypeCount(); ++i) { - OString superType(reader.getSuperTypeName(i)); - dependencies.insert(type, superType, TYPEUSE_SUPER); - checkTypeDependencies(typeMgr, dependencies, superType); - } - - if (reader.getTypeClass() == RT_TYPE_INTERFACE) - { - dependencies.insert(type, "com/sun/star/uno/RuntimeException", TYPEUSE_EXCEPTION); - dependencies.insert(type, "com/sun/star/uno/TypeClass", TYPEUSE_NORMAL); - checkTypeDependencies(typeMgr, dependencies, "com/sun/star/uno/RuntimeException", bDepend); - } - - checkFieldDependencies(typeMgr, dependencies, reader, type); - checkMethodDependencies(typeMgr, dependencies, reader, type); - checkReferenceDependencies(typeMgr, dependencies, reader, type); - - // make the scope modules as dependencies - sal_Int32 nPos = type.lastIndexOf( '/' ); - - if ( nPos >= 0 ) - { - OString aScope( type.copy( 0, nPos ) ); - OStringBuffer tmpBuf(aScope.getLength()); - - nPos = 0; - do - { - tmpBuf.append(aScope.getToken(0, '/', nPos)); - dependencies.insert(type, tmpBuf.getStr(), TYPEUSE_SCOPE); - tmpBuf.append('/'); - } while( nPos != -1 ); - } - - return sal_True; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rdbmaker/source/codemaker/global.cxx b/rdbmaker/source/codemaker/global.cxx deleted file mode 100644 index ae56562f2..000000000 --- a/rdbmaker/source/codemaker/global.cxx +++ /dev/null @@ -1,171 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include <osl/process.h> -#include <rtl/strbuf.hxx> -#include <rtl/ustring.hxx> -#include <osl/thread.h> -#include <osl/file.hxx> - -#include <stdlib.h> -#include <stdio.h> -#if defined(SAL_W32) -#include <io.h> -#include <direct.h> -#include <errno.h> -#endif - -#ifdef UNX -#include <sys/stat.h> -#include <errno.h> -#include <unistd.h> -#endif -#include <codemaker/global.hxx> - -#ifdef SAL_UNX -#define SEPARATOR '/' -#else -#define SEPARATOR '\\' -#endif - -using namespace ::rtl; -using namespace ::osl; - -const OString inGlobalSet(const OUString & rValue) -{ - OString sValue( OUStringToOString(rValue, RTL_TEXTENCODING_UTF8) ); - static StringSet aGlobalMap; - StringSet::iterator iter = aGlobalMap.find( sValue ); - if( iter != aGlobalMap.end() ) - return *iter; - return *(aGlobalMap.insert( sValue ).first); -} - -static sal_Bool isFileUrl(const OString& fileName) -{ - if (fileName.indexOf("file://") == 0 ) - return sal_True; - return sal_False; -} - -OUString convertToFileUrl(const OString& fileName) -{ - if ( isFileUrl(fileName) ) - { - return OStringToOUString(fileName, osl_getThreadTextEncoding()); - } - - OUString uUrlFileName; - OUString uFileName(fileName.getStr(), fileName.getLength(), osl_getThreadTextEncoding()); - if ( fileName.indexOf('.') == 0 || fileName.indexOf(SEPARATOR) < 0 ) - { - OUString uWorkingDir; - if (osl_getProcessWorkingDir(&uWorkingDir.pData) != osl_Process_E_None) { - OSL_ASSERT(false); - } - if (FileBase::getAbsoluteFileURL(uWorkingDir, uFileName, uUrlFileName) - != FileBase::E_None) - { - OSL_ASSERT(false); - } - } else - { - if (FileBase::getFileURLFromSystemPath(uFileName, uUrlFileName) - != FileBase::E_None) - { - OSL_ASSERT(false); - } - } - - return uUrlFileName; -} - -//************************************************************************* -// FileStream -//************************************************************************* -FileStream::FileStream() -{ -} - -FileStream::~FileStream() -{ - if ( isValid() ) - { - fflush(m_pFile); - fclose(m_pFile); - } -} - -sal_Bool FileStream::isValid() -{ - if ( m_pFile ) - return sal_True; - - return sal_False; -} - -void FileStream::open(const OString& name, FileAccessMode mode) -{ - if ( name.getLength() > 0 ) - { - m_name = name; - m_pFile = fopen(m_name.getStr(), checkAccessMode(mode)); - } -} - -void FileStream::close() -{ - if ( isValid() ) - { - fflush(m_pFile); - fclose(m_pFile); - m_pFile = NULL; - m_name = OString(); - } -} - -const sal_Char* FileStream::checkAccessMode(FileAccessMode mode) -{ - switch( mode ) - { - case FAM_READ: - return "r"; - case FAM_WRITE: - return "w"; - case FAM_APPEND: - return "a"; - case FAM_READWRITE_EXIST: - return "r+"; - case FAM_READWRITE: - return "w+"; - case FAM_READAPPEND: - return "a+"; - } - return "w+"; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rdbmaker/source/codemaker/makefile.mk b/rdbmaker/source/codemaker/makefile.mk deleted file mode 100644 index 626b71ec0..000000000 --- a/rdbmaker/source/codemaker/makefile.mk +++ /dev/null @@ -1,55 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. - -PRJNAME=codemaker -TARGET=$(PRJNAME) - - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- -.INCLUDE : settings.mk - -# ------------------------------------------------------------------ - -CXXFILES= \ - global.cxx \ - options.cxx \ - typemanager.cxx \ - dependency.cxx - -OBJFILES= \ - $(OBJ)$/global.obj \ - $(OBJ)$/options.obj \ - $(OBJ)$/typemanager.obj \ - $(OBJ)$/dependency.obj - -# ------------------------------------------------------------------ - -.INCLUDE : target.mk - diff --git a/rdbmaker/source/codemaker/options.cxx b/rdbmaker/source/codemaker/options.cxx deleted file mode 100644 index c302f2795..000000000 --- a/rdbmaker/source/codemaker/options.cxx +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <codemaker/options.hxx> - -using ::rtl::OString; -Options::Options() -{ -} - -Options::~Options() -{ - -} - -const OString& Options::getProgramName() const -{ - return m_program; -} - -sal_Bool Options::isValid(const OString& option) -{ - return (m_options.count(option) > 0); -} - -const OString Options::getOption(const OString& option) - throw( IllegalArgument ) -{ - if (m_options.count(option) > 0) - { - return m_options[option]; - } else - { - throw IllegalArgument("Option is not valid or currently not set."); - } -} - -const StringVector& Options::getInputFiles() -{ - return m_inputFiles; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rdbmaker/source/codemaker/typemanager.cxx b/rdbmaker/source/codemaker/typemanager.cxx deleted file mode 100644 index 1c4c51191..000000000 --- a/rdbmaker/source/codemaker/typemanager.cxx +++ /dev/null @@ -1,277 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <rtl/alloc.h> -#include <osl/file.hxx> -#include <codemaker/typemanager.hxx> - -using ::rtl::OUString; -using ::rtl::OString; -using ::rtl::OStringToOUString; -TypeManager::TypeManager() -{ - m_pImpl = new TypeManagerImpl(); - acquire(); -} - -TypeManager::~TypeManager() -{ - release(); -} - -sal_Int32 TypeManager::acquire() -{ - return osl_incrementInterlockedCount(&m_pImpl->m_refCount); -} - -sal_Int32 TypeManager::release() -{ - sal_Int32 refCount = 0; - if (0 == (refCount = osl_decrementInterlockedCount(&m_pImpl->m_refCount)) ) - { - delete m_pImpl; - } - return refCount;; -} - -RegistryTypeManager::RegistryTypeManager() -{ - m_pImpl = new RegistryTypeManagerImpl(); - acquire(); -} - -RegistryTypeManager::~RegistryTypeManager() -{ - release(); -} - -void RegistryTypeManager::acquire() -{ - TypeManager::acquire(); -} - -void RegistryTypeManager::release() -{ - if (0 == TypeManager::release()) - { - if (m_pImpl->m_pMergedRegistry) - { - if (m_pImpl->m_pMergedRegistry->isValid()) - { - m_pImpl->m_pMergedRegistry->destroy(OUString()); - } - - delete m_pImpl->m_pMergedRegistry; - } - - if (m_pImpl->m_registries.size() > 0) - { - freeRegistries(); - } - - delete m_pImpl; - } -} - -sal_Bool RegistryTypeManager::init(sal_Bool bMerged, const StringVector& regFiles) -{ - m_pImpl->m_isMerged = bMerged && (regFiles.size() > 1); - - if (regFiles.empty()) - return sal_False; - - StringVector::const_iterator iter = regFiles.begin(); - - Registry tmpReg; - while (iter != regFiles.end()) - { - if (!tmpReg.open( convertToFileUrl(*iter), REG_READONLY)) - m_pImpl->m_registries.push_back(new Registry(tmpReg)); - else - { - freeRegistries(); - return sal_False; - } - ++iter; - } - - if (m_pImpl->m_isMerged) - { - Registry *pTmpReg = new Registry; - OUString tmpName; - osl::FileBase::createTempFile(0, 0, &tmpName); - if (!pTmpReg->create(tmpName)) - { - RegistryKey rootKey; - RegError ret = REG_NO_ERROR; - OUString aRoot( RTL_CONSTASCII_USTRINGPARAM("/") ); - iter = regFiles.begin(); - pTmpReg->openRootKey(rootKey); - - while (iter != regFiles.end()) - { - if ( (ret = pTmpReg->mergeKey(rootKey, aRoot, convertToFileUrl( *iter ))) ) - { - if (ret != REG_MERGE_CONFLICT) - { - freeRegistries(); - rootKey.closeKey(); - pTmpReg->destroy( OUString() ); - delete pTmpReg; - return sal_False; - } - } - ++iter; - } - - m_pImpl->m_pMergedRegistry = pTmpReg; - freeRegistries(); - } else - { - delete pTmpReg; - freeRegistries(); - return sal_False; - } - } - - return sal_True; -} - -TypeReader RegistryTypeManager::getTypeReader(const OString& name) -{ - TypeReader reader; - RegistryKey key(searchTypeKey(name)); - - if (key.isValid()) - { - RegValueType valueType; - sal_uInt32 valueSize; - - if (!key.getValueInfo(OUString(), &valueType, &valueSize)) - { - sal_uInt8* pBuffer = (sal_uInt8*)rtl_allocateMemory(valueSize); - if (!key.getValue(OUString(), pBuffer)) - { - reader = TypeReader(pBuffer, valueSize, sal_True); - } - rtl_freeMemory(pBuffer); - } - } - return reader; -} - -RTTypeClass RegistryTypeManager::getTypeClass(const OString& name) -{ - if (m_pImpl->m_t2TypeClass.count(name) > 0) - { - return m_pImpl->m_t2TypeClass[name]; - } else - { - RegistryKey key(searchTypeKey(name)); - - if (key.isValid()) - { - RegValueType valueType; - sal_uInt32 valueSize; - - if (!key.getValueInfo(OUString(), &valueType, &valueSize)) - { - sal_uInt8* pBuffer = (sal_uInt8*)rtl_allocateMemory(valueSize); - if (!key.getValue(OUString(), pBuffer)) - { - TypeReader reader(pBuffer, valueSize, sal_False); - - RTTypeClass ret = reader.getTypeClass(); - - rtl_freeMemory(pBuffer); - - m_pImpl->m_t2TypeClass[name] = ret; - return ret; - } - rtl_freeMemory(pBuffer); - } - } - } - - return RT_TYPE_INVALID; -} - -void RegistryTypeManager::setBase(const OString& base) -{ - m_pImpl->m_base = base; - - if (base.lastIndexOf('/') != (base.getLength() - 1)) - { - m_pImpl->m_base += "/"; - } -} - -void RegistryTypeManager::freeRegistries() -{ - RegistryList::const_iterator iter = m_pImpl->m_registries.begin(); - - while (iter != m_pImpl->m_registries.end()) - { - delete *iter; - - ++iter; - } - -} - -RegistryKey RegistryTypeManager::searchTypeKey(const OString& name) -{ - RegistryKey key, rootKey; - - if (m_pImpl->m_isMerged) - { - if (!m_pImpl->m_pMergedRegistry->openRootKey(rootKey)) - { - rootKey.openKey(OStringToOUString(m_pImpl->m_base + name, RTL_TEXTENCODING_UTF8), key); - } - } else - { - RegistryList::const_iterator iter = m_pImpl->m_registries.begin(); - - while (iter != m_pImpl->m_registries.end()) - { - if (!(*iter)->openRootKey(rootKey)) - { - if (!rootKey.openKey(OStringToOUString(m_pImpl->m_base + name, RTL_TEXTENCODING_UTF8), key)) - break; - } - - ++iter; - } - } - - return key; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |