summaryrefslogtreecommitdiff
path: root/rdbmaker
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@gmail.com>2012-10-21 21:03:06 +0200
committerMatúš Kukan <matus.kukan@gmail.com>2012-10-22 22:52:14 +0200
commit8c6276a312a3dd88d7469be3187bf8d9d077f0d8 (patch)
tree20fd98ff3ea3931acd6ce7a1cb8b44dd70ebab39 /rdbmaker
parent0397c4b02d894259cd86280185f52ec84a67b16a (diff)
drop rdbmaker completely
Change-Id: I313afb391562adae4f91c55480a036c228e0b540
Diffstat (limited to 'rdbmaker')
-rw-r--r--rdbmaker/Executable_rdbmaker.mk58
-rw-r--r--rdbmaker/Makefile13
-rw-r--r--rdbmaker/Module_rdbmaker.mk37
-rw-r--r--rdbmaker/README4
-rw-r--r--rdbmaker/inc/codemaker/dependency.hxx141
-rw-r--r--rdbmaker/inc/codemaker/global.hxx131
-rw-r--r--rdbmaker/inc/codemaker/options.hxx80
-rw-r--r--rdbmaker/inc/codemaker/registry.hxx198
-rw-r--r--rdbmaker/inc/codemaker/typemanager.hxx147
-rw-r--r--rdbmaker/prj/build.lst2
-rw-r--r--rdbmaker/prj/d.lst1
-rw-r--r--rdbmaker/source/codemaker/dependency.cxx290
-rw-r--r--rdbmaker/source/codemaker/global.cxx162
-rw-r--r--rdbmaker/source/codemaker/options.cxx60
-rw-r--r--rdbmaker/source/codemaker/typemanager.cxx268
-rw-r--r--rdbmaker/source/rdbmaker/rdbmaker.cxx500
-rw-r--r--rdbmaker/source/rdbmaker/rdboptions.cxx372
-rw-r--r--rdbmaker/source/rdbmaker/rdboptions.hxx51
-rw-r--r--rdbmaker/source/rdbmaker/rdbtype.cxx159
-rw-r--r--rdbmaker/source/rdbmaker/rdbtype.hxx45
-rw-r--r--rdbmaker/source/rdbmaker/specialtypemanager.cxx94
-rw-r--r--rdbmaker/source/rdbmaker/specialtypemanager.hxx65
-rw-r--r--rdbmaker/source/rdbmaker/typeblop.cxx514
23 files changed, 0 insertions, 3392 deletions
diff --git a/rdbmaker/Executable_rdbmaker.mk b/rdbmaker/Executable_rdbmaker.mk
deleted file mode 100644
index 6e46d387d408..000000000000
--- a/rdbmaker/Executable_rdbmaker.mk
+++ /dev/null
@@ -1,58 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-# Version: MPL 1.1 / GPLv3+ / LGPLv3+
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License or as specified alternatively below. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# Major Contributor(s):
-# Copyright (C) 2012 David Ostrovsky <d.ostrovsky@gmx.de> (initial developer)
-#
-# All Rights Reserved.
-#
-# For minor contributions see the git repository.
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-# instead of those above.
-
-$(eval $(call gb_Executable_Executable,rdbmaker))
-
-$(eval $(call gb_Executable_use_api,rdbmaker,\
- udkapi \
-))
-
-$(eval $(call gb_Executable_set_include,rdbmaker,\
- -I$(SRCDIR)/rdbmaker/inc \
- $$(INCLUDE) \
-))
-
-$(eval $(call gb_Executable_use_libraries,rdbmaker,\
- sal \
- salhelper \
- reg \
- cppu \
- cppuhelper \
-))
-
-$(eval $(call gb_Executable_add_exception_objects,rdbmaker,\
- rdbmaker/source/rdbmaker/rdbmaker \
- rdbmaker/source/rdbmaker/rdbtype \
- rdbmaker/source/rdbmaker/rdboptions \
- rdbmaker/source/rdbmaker/typeblop \
- rdbmaker/source/rdbmaker/specialtypemanager \
- rdbmaker/source/codemaker/global \
- rdbmaker/source/codemaker/options \
- rdbmaker/source/codemaker/typemanager \
- rdbmaker/source/codemaker/dependency \
-))
-
-# vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/rdbmaker/Makefile b/rdbmaker/Makefile
deleted file mode 100644
index 99bd36fdc1f9..000000000000
--- a/rdbmaker/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
-
-include $(module_directory)/../solenv/gbuild/partial_build.mk
-
-# vim: set noet sw=4 ts=4:
diff --git a/rdbmaker/Module_rdbmaker.mk b/rdbmaker/Module_rdbmaker.mk
deleted file mode 100644
index c5683e089715..000000000000
--- a/rdbmaker/Module_rdbmaker.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-# Version: MPL 1.1 / GPLv3+ / LGPLv3+
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License or as specified alternatively below. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# Major Contributor(s):
-# Copyright (C) 2012 David Ostrovsky <d.ostrovsky@gmx.de> (initial developer)
-#
-# All Rights Reserved.
-#
-# For minor contributions see the git repository.
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-# instead of those above.
-
-$(eval $(call gb_Module_Module,rdbmaker))
-
-ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
-
-$(eval $(call gb_Module_add_targets,rdbmaker,\
- Executable_rdbmaker \
-))
-
-endif
-
-# vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/rdbmaker/README b/rdbmaker/README
deleted file mode 100644
index 56f48a8683b2..000000000000
--- a/rdbmaker/README
+++ /dev/null
@@ -1,4 +0,0 @@
-Makes registries for openoffice for storing type data
-
-See also:
-[http://wiki.services.openoffice.org/wiki/Uno/Binary/Modules/rdbmaker]
diff --git a/rdbmaker/inc/codemaker/dependency.hxx b/rdbmaker/inc/codemaker/dependency.hxx
deleted file mode 100644
index 3ccfb722a230..000000000000
--- a/rdbmaker/inc/codemaker/dependency.hxx
+++ /dev/null
@@ -1,141 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _CODEMAKER_DEPENDENCY_HXX_
-#define _CODEMAKER_DEPENDENCY_HXX_
-
-#include <boost/unordered_map.hpp>
-#include <registry/registry.hxx>
-#include <registry/reflread.hxx>
-#include <codemaker/typemanager.hxx>
-#include <codemaker/global.hxx>
-#include <osl/diagnose.h>
-
-#define TYPEUSE_NORMAL 0x0001
-#define TYPEUSE_SUPER 0x0002
-#define TYPEUSE_MEMBER 0x0004
-#define TYPEUSE_INPARAM 0x0008
-#define TYPEUSE_OUTPARAM 0x0010
-#define TYPEUSE_INOUTPARAM 0x0020
-#define TYPEUSE_RETURN 0x0040
-#define TYPEUSE_EXCEPTION 0x0080
-#define TYPEUSE_SCOPE 0x0100
-
-/**
- * Flag shows the state of the code generation. If the Flag is set
- * the code for this type is generated.
- */
-#define CODEGEN_DEFAULT 0x0001
-
-struct TypeUsing
-{
- TypeUsing(const ::rtl::OString& type, sal_uInt16 use)
- : m_type(type)
- , m_use(use)
- {}
-
- ::rtl::OString m_type;
- sal_uInt16 m_use;
-
- sal_Bool operator == (const TypeUsing & typeUsing) const
- {
- OSL_ASSERT(0);
- return m_type == typeUsing.m_type && m_use == typeUsing.m_use;
- }
-};
-
-struct LessTypeUsing
-{
- sal_Bool operator()(const TypeUsing& tuse1, const TypeUsing& tuse2) const
- {
- return (tuse1.m_type < tuse2.m_type);
- }
-};
-
-typedef ::std::set< TypeUsing, LessTypeUsing > TypeUsingSet;
-
-
-typedef ::boost::unordered_map
-<
- ::rtl::OString,
- TypeUsingSet,
- HashString,
- EqualString
-> DependencyMap;
-
-typedef ::boost::unordered_map
-<
- ::rtl::OString,
- sal_uInt16,
- HashString,
- EqualString
-> GenerationMap;
-
-struct TypeDependencyImpl
-{
- TypeDependencyImpl()
- : m_refCount(0)
- {}
-
- sal_Int32 m_refCount;
- DependencyMap m_dependencies;
- GenerationMap m_generatedTypes;
-};
-
-class TypeDependency
-{
-public:
- TypeDependency();
- ~TypeDependency();
-
- TypeDependency( const TypeDependency& value )
- : m_pImpl( value.m_pImpl )
- {
- acquire();
- }
-
- TypeDependency& operator = ( const TypeDependency& value )
- {
- release();
- m_pImpl = value.m_pImpl;
- acquire();
- return *this;
- }
-
- sal_Bool insert(const ::rtl::OString& type, const ::rtl::OString& depend, sal_uInt16);
- TypeUsingSet getDependencies(const ::rtl::OString& type);
- sal_Bool hasDependencies(const ::rtl::OString& type);
-
- void setGenerated(const ::rtl::OString& type, sal_uInt16 genFlag=CODEGEN_DEFAULT);
- sal_Bool isGenerated(const ::rtl::OString& type, sal_uInt16 genFlag=CODEGEN_DEFAULT);
-
- sal_Int32 getSize() { return m_pImpl->m_generatedTypes.size(); }
-protected:
- void acquire();
- void release();
-
-protected:
- TypeDependencyImpl* m_pImpl;
-};
-
-sal_Bool checkTypeDependencies(TypeManager& typeMgr, TypeDependency& dependencies, const ::rtl::OString& type, sal_Bool bDepend = sal_False);
-
-#endif // _CODEMAKER_DEPENDENCY_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/rdbmaker/inc/codemaker/global.hxx b/rdbmaker/inc/codemaker/global.hxx
deleted file mode 100644
index 7cc8e338bd08..000000000000
--- a/rdbmaker/inc/codemaker/global.hxx
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _CODEMAKER_GLOBAL_HXX_
-#define _CODEMAKER_GLOBAL_HXX_
-
-#include <list>
-#include <vector>
-#include <set>
-
-#include <stdio.h>
-#include <rtl/ustring.hxx>
-#include <rtl/strbuf.hxx>
-
-struct EqualString
-{
- sal_Bool operator()(const ::rtl::OString& str1, const ::rtl::OString& str2) const
- {
- return (str1 == str2);
- }
-};
-
-struct HashString
-{
- size_t operator()(const ::rtl::OString& str) const
- {
- return str.hashCode();
- }
-};
-
-struct LessString
-{
- sal_Bool operator()(const ::rtl::OString& str1, const ::rtl::OString& str2) const
- {
- return (str1 < str2);
- }
-};
-
-#if defined(_MSC_VER) && _MSC_VER < 1200
-typedef ::std::new_alloc NewAlloc;
-#endif
-
-
-typedef ::std::list< ::rtl::OString > StringList;
-typedef ::std::vector< ::rtl::OString > StringVector;
-typedef ::std::set< ::rtl::OString, LessString > StringSet;
-
-::rtl::OString makeTempName();
-
-const ::rtl::OString inGlobalSet(const ::rtl::OUString & r);
-
-::rtl::OUString convertToFileUrl(const ::rtl::OString& fileName);
-
-//*************************************************************************
-// FileStream
-//*************************************************************************
-enum FileAccessMode
-{
- FAM_READ, // "r"
- FAM_WRITE, // "w"
- FAM_APPEND, // "a"
- FAM_READWRITE_EXIST, // "r+"
- FAM_READWRITE, // "w+"
- FAM_READAPPEND // "a+"
-};
-
-class FileStream //: public ofstream
-{
-public:
- FileStream();
- virtual ~FileStream();
-
- sal_Bool isValid();
-
- void open(const ::rtl::OString& name, FileAccessMode nMode = FAM_READWRITE);
- void close();
-
- ::rtl::OString getName() { return m_name; }
-
- // friend functions
- friend FileStream &operator<<(FileStream& o, sal_uInt32 i)
- { fprintf(o.m_pFile, "%lu", sal::static_int_cast< unsigned long >(i));
- return o;
- }
- friend FileStream &operator<<(FileStream& o, char const * s)
- { fprintf(o.m_pFile, "%s", s);
- return o;
- }
- friend FileStream &operator<<(FileStream& o, ::rtl::OString* s)
- { fprintf(o.m_pFile, "%s", s->getStr());
- return o;
- }
- friend FileStream &operator<<(FileStream& o, const ::rtl::OString& s)
- { fprintf(o.m_pFile, "%s", s.getStr());
- return o;
- }
- friend FileStream &operator<<(FileStream& o, ::rtl::OStringBuffer* s)
- { fprintf(o.m_pFile, "%s", s->getStr());
- return o;
- }
- friend FileStream &operator<<(FileStream& o, const ::rtl::OStringBuffer& s)
- { fprintf(o.m_pFile, "%s", s.getStr());
- return o;
- }
-
-protected:
- const sal_Char* checkAccessMode(FileAccessMode mode);
-
- FILE* m_pFile;
- ::rtl::OString m_name;
-};
-
-#endif // _CODEMAKER_GLOBAL_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/rdbmaker/inc/codemaker/options.hxx b/rdbmaker/inc/codemaker/options.hxx
deleted file mode 100644
index f8e6233d1ea6..000000000000
--- a/rdbmaker/inc/codemaker/options.hxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _CODEMAKER_OPTIONS_HXX_
-#define _CODEMAKER_OPTIONS_HXX_
-
-#include <boost/unordered_map.hpp>
-#include <codemaker/global.hxx>
-
-typedef ::boost::unordered_map
-<
- ::rtl::OString,
- ::rtl::OString,
- HashString,
- EqualString
-> OptionMap;
-
-class CannotDumpException
-{
-public:
- CannotDumpException(const ::rtl::OString& msg)
- : m_message(msg) {}
-
- ::rtl::OString m_message;
-};
-
-
-class IllegalArgument
-{
-public:
- IllegalArgument(const ::rtl::OString& msg)
- : m_message(msg) {}
-
- ::rtl::OString m_message;
-};
-
-
-class Options
-{
-public:
- Options();
- virtual ~Options();
-
- virtual sal_Bool initOptions(int ac, char* av[], sal_Bool bCmdFile=sal_False)
- throw( IllegalArgument ) = 0;
-
- virtual ::rtl::OString prepareHelp() = 0;
-
- const ::rtl::OString& getProgramName() const;
- sal_Bool isValid(const ::rtl::OString& option);
- const ::rtl::OString getOption(const ::rtl::OString& option)
- throw( IllegalArgument );
-
- const StringVector& getInputFiles();
-
-protected:
- ::rtl::OString m_program;
- StringVector m_inputFiles;
- OptionMap m_options;
-};
-
-#endif // _CODEMAKER_OPTIONS_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/rdbmaker/inc/codemaker/registry.hxx b/rdbmaker/inc/codemaker/registry.hxx
deleted file mode 100644
index 67eae3818838..000000000000
--- a/rdbmaker/inc/codemaker/registry.hxx
+++ /dev/null
@@ -1,198 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _CODEMAKER_REGISTRY_HXX_
-#define _CODEMAKER_REGISTRY_HXX_
-
-#include <string.h>
-
-#include <rtl/alloc.h>
-#include <osl/interlck.h>
-#include <registry/registry.hxx>
-#include "registry/reader.hxx"
-#include "registry/version.h"
-#include <codemaker/options.hxx>
-
-struct TypeReader_Impl
-{
- TypeReader_Impl(const sal_uInt8* buffer,
- sal_uInt32 bufferLen,
- bool copyData)
- : m_refCount(0)
- , m_copyData(copyData)
- , m_blopSize(bufferLen)
- , m_pBlop(buffer)
- {
- if (copyData)
- {
- m_pBlop = (sal_uInt8*)rtl_allocateMemory(bufferLen);
- memcpy(const_cast<sal_uInt8*>(m_pBlop), buffer, bufferLen);
- } else
- {
- m_blopSize = bufferLen;
- m_pBlop = buffer;
- }
-
- m_pReader = new typereg::Reader(
- m_pBlop, m_blopSize, false, TYPEREG_VERSION_1);
- }
-
- ~TypeReader_Impl()
- {
- if (m_copyData && m_pReader)
- {
- delete m_pReader;
- }
- }
-
- sal_Int32 m_refCount;
- bool m_copyData;
- sal_Int32 m_blopSize;
- const sal_uInt8* m_pBlop;
- typereg::Reader* m_pReader;
-};
-
-class TypeReader
-{
-public:
- inline TypeReader()
- : m_pImpl(NULL)
- {}
-
- inline TypeReader( const sal_uInt8* buffer,
- sal_uInt32 bufferLen,
- bool copyData)
- {
- m_pImpl = new TypeReader_Impl(buffer, bufferLen, copyData);
- acquire();
- }
-
- inline TypeReader(const TypeReader& toCopy)
- : m_pImpl(toCopy.m_pImpl)
- {
- acquire();
- }
-
- inline ~TypeReader()
- {
- release();
- }
-
- inline void acquire()
- {
- if (m_pImpl)
- osl_atomic_increment(&m_pImpl->m_refCount);
- }
-
- inline void release()
- {
- if (m_pImpl && 0 == osl_atomic_decrement(&m_pImpl->m_refCount))
- {
- delete m_pImpl;
- }
- }
-
- inline TypeReader& operator = ( const TypeReader& value )
- {
- release();
- m_pImpl = value.m_pImpl;
- acquire();
- return *this;
- }
-
- inline sal_Bool isValid() const
- {
- if (m_pImpl)
- return m_pImpl->m_pReader->isValid();
- else
- return sal_False;
- }
-
- inline RTTypeClass getTypeClass() const
- { return m_pImpl->m_pReader->getTypeClass(); }
- inline const ::rtl::OString getTypeName() const
- { return inGlobalSet( m_pImpl->m_pReader->getTypeName() ); }
- inline sal_uInt16 getSuperTypeCount() const
- { return m_pImpl->m_pReader->getSuperTypeCount(); }
- inline const ::rtl::OString getSuperTypeName(sal_uInt16 index) const
- { return inGlobalSet( m_pImpl->m_pReader->getSuperTypeName(index) ); }
- inline const ::rtl::OString getDoku() const
- { return inGlobalSet( m_pImpl->m_pReader->getDocumentation() ); }
- inline const ::rtl::OString getFileName() const
- { return inGlobalSet( m_pImpl->m_pReader->getFileName() ); }
- inline sal_uInt32 getFieldCount() const
- { return m_pImpl->m_pReader->getFieldCount(); }
- inline const ::rtl::OString getFieldName( sal_uInt16 index ) const
- { return inGlobalSet( m_pImpl->m_pReader->getFieldName(index) ); }
- inline const ::rtl::OString getFieldType( sal_uInt16 index ) const
- { return inGlobalSet( m_pImpl->m_pReader->getFieldTypeName(index) ); }
- inline RTFieldAccess getFieldAccess( sal_uInt16 index ) const
- { return m_pImpl->m_pReader->getFieldFlags(index); }
- inline RTConstValue getFieldConstValue( sal_uInt16 index ) const
- { return m_pImpl->m_pReader->getFieldValue(index); }
- inline const ::rtl::OString getFieldDoku( sal_uInt16 index ) const
- { return inGlobalSet( m_pImpl->m_pReader->getFieldDocumentation(index) ); }
- inline const ::rtl::OString getFieldFileName( sal_uInt16 index ) const
- { return inGlobalSet( m_pImpl->m_pReader->getFieldFileName(index) ); }
- inline sal_uInt32 getMethodCount() const
- { return m_pImpl->m_pReader->getMethodCount(); }
- inline const ::rtl::OString getMethodName( sal_uInt16 index ) const
- { return inGlobalSet( m_pImpl->m_pReader->getMethodName(index) ); }
- inline sal_uInt32 getMethodParamCount( sal_uInt16 index ) const
- { return m_pImpl->m_pReader->getMethodParameterCount(index); }
- inline const ::rtl::OString getMethodParamType( sal_uInt16 index, sal_uInt16 paramIndex ) const
- { return inGlobalSet( m_pImpl->m_pReader->getMethodParameterTypeName(index,paramIndex) ); }
- inline const ::rtl::OString getMethodParamName( sal_uInt16 index, sal_uInt16 paramIndex ) const
- { return inGlobalSet( m_pImpl->m_pReader->getMethodParameterName(index,paramIndex) ); }
- inline RTParamMode getMethodParamMode( sal_uInt16 index, sal_uInt16 paramIndex ) const
- { return m_pImpl->m_pReader->getMethodParameterFlags(index,paramIndex); }
- inline sal_uInt32 getMethodExcCount( sal_uInt16 index ) const
- { return m_pImpl->m_pReader->getMethodExceptionCount(index); }
- inline const ::rtl::OString getMethodExcType( sal_uInt16 index, sal_uInt16 excIndex ) const
- { return inGlobalSet( m_pImpl->m_pReader->getMethodExceptionTypeName(index,excIndex) ); }
- inline const ::rtl::OString getMethodReturnType( sal_uInt16 index ) const
- { return inGlobalSet( m_pImpl->m_pReader->getMethodReturnTypeName(index) ); }
- inline RTMethodMode getMethodMode( sal_uInt16 index ) const
- { return m_pImpl->m_pReader->getMethodFlags(index); }
- inline const ::rtl::OString getMethodDoku( sal_uInt16 index ) const
- { return inGlobalSet( m_pImpl->m_pReader->getMethodDocumentation(index) ); }
-
- inline sal_uInt32 getReferenceCount() const
- { return m_pImpl->m_pReader->getReferenceCount(); }
- inline const ::rtl::OString getReferenceName( sal_uInt16 index ) const
- { return inGlobalSet( m_pImpl->m_pReader->getReferenceTypeName(index) ); }
- inline RTReferenceType getReferenceType( sal_uInt16 index ) const
- { return m_pImpl->m_pReader->getReferenceSort(index); }
- inline const ::rtl::OString getReferenceDoku( sal_uInt16 index ) const
- { return inGlobalSet( m_pImpl->m_pReader->getReferenceDocumentation(index) ); }
-
- inline sal_uInt32 getBlopSize() const
- { return m_pImpl->m_blopSize; }
-
- inline const sal_uInt8* getBlop() const
- { return m_pImpl->m_pBlop; }
-
-private:
- TypeReader_Impl* m_pImpl;
-};
-
-
-#endif // _CODEMAKER_REGISTRY_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/rdbmaker/inc/codemaker/typemanager.hxx b/rdbmaker/inc/codemaker/typemanager.hxx
deleted file mode 100644
index a6da27d29db0..000000000000
--- a/rdbmaker/inc/codemaker/typemanager.hxx
+++ /dev/null
@@ -1,147 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#include <boost/unordered_map.hpp>
-
-#ifndef _CODEMAKER_TYPEMANAGER_HXX_
-#define _CODEMAKER_TYPEMANAGER_HXX_
-#include <codemaker/registry.hxx>
-
-typedef ::std::list< Registry* > RegistryList;
-
-typedef ::boost::unordered_map
-<
- ::rtl::OString, // Typename
- RTTypeClass, // TypeClass
- HashString,
- EqualString
-> T2TypeClassMap;
-
-struct TypeManagerImpl
-{
- TypeManagerImpl()
- : m_refCount(0)
- {}
-
- sal_Int32 m_refCount;
-};
-
-class TypeManager
-{
-public:
- TypeManager();
- virtual ~TypeManager();
-
- TypeManager( const TypeManager& value )
- : m_pImpl( value.m_pImpl )
- {
- acquire();
- }
-
- TypeManager& operator = ( const TypeManager& value )
- {
- release();
- m_pImpl = value.m_pImpl;
- acquire();
- return *this;
- }
-
- virtual sal_Bool init(sal_Bool /*bMerge*/, const StringVector& /*regFiles*/)
- { return sal_False; }
- virtual sal_Bool init(const ::rtl::OString& /*registryName*/)
- { return sal_False; }
-
- virtual sal_Bool isValidType(const ::rtl::OString& /*name*/)
- { return sal_False; }
-
- virtual RegistryKey getTypeKey(const ::rtl::OString& /*name*/)
- { return RegistryKey(); }
- virtual TypeReader getTypeReader(const ::rtl::OString& /*name*/)
- { return TypeReader(); }
- virtual RTTypeClass getTypeClass(const ::rtl::OString& /*name*/)
- { return RT_TYPE_INVALID; }
-
- virtual void setBase(const ::rtl::OString& /*base*/) {}
- virtual ::rtl::OString getBase() { return ::rtl::OString(); }
-
- virtual sal_Int32 getSize() { return 0; }
-
-protected:
- sal_Int32 acquire();
- sal_Int32 release();
-
-protected:
- TypeManagerImpl* m_pImpl;
-};
-
-struct RegistryTypeManagerImpl
-{
- RegistryTypeManagerImpl()
- : m_pMergedRegistry(NULL)
- , m_base("/")
- , m_isMerged(false)
- {}
-
- T2TypeClassMap m_t2TypeClass;
- RegistryList m_registries;
- Registry* m_pMergedRegistry;
- ::rtl::OString m_base;
- bool m_isMerged;
-};
-
-class RegistryTypeManager : public TypeManager
-{
-public:
- RegistryTypeManager();
- virtual ~RegistryTypeManager();
-
- RegistryTypeManager( const RegistryTypeManager& value )
- : TypeManager(value)
- , m_pImpl( value.m_pImpl )
- {
- acquire();
- }
-
- using TypeManager::init;
- sal_Bool init(sal_Bool bMerge, const StringVector& regFiles);
-
- sal_Bool isValidType(const ::rtl::OString& name)
- { return searchTypeKey(name).isValid(); }
- RegistryKey getTypeKey(const ::rtl::OString& name)
- { return searchTypeKey(name); }
- TypeReader getTypeReader(const ::rtl::OString& name);
- RTTypeClass getTypeClass(const ::rtl::OString& name);
-
- void setBase(const ::rtl::OString& base);
- ::rtl::OString getBase() { return m_pImpl->m_base; }
-
- sal_Int32 getSize() { return m_pImpl->m_t2TypeClass.size(); }
-protected:
- RegistryKey searchTypeKey(const ::rtl::OString& name);
- void freeRegistries();
-
- void acquire();
- void release();
-
-protected:
- RegistryTypeManagerImpl* m_pImpl;
-};
-
-#endif // _CODEMAKER_TYPEMANAGER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/rdbmaker/prj/build.lst b/rdbmaker/prj/build.lst
deleted file mode 100644
index 43b8f84a7d81..000000000000
--- a/rdbmaker/prj/build.lst
+++ /dev/null
@@ -1,2 +0,0 @@
-rm rdbmaker : cppuhelper NULL
-rm rdbmaker\prj nmake - all rm_prj NULL
diff --git a/rdbmaker/prj/d.lst b/rdbmaker/prj/d.lst
deleted file mode 100644
index 8b137891791f..000000000000
--- a/rdbmaker/prj/d.lst
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/rdbmaker/source/codemaker/dependency.cxx b/rdbmaker/source/codemaker/dependency.cxx
deleted file mode 100644
index cd1a5f2449eb..000000000000
--- a/rdbmaker/source/codemaker/dependency.cxx
+++ /dev/null
@@ -1,290 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#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_atomic_increment(&m_pImpl->m_refCount);
-}
-
-void TypeDependency::release()
-{
- if (0 == osl_atomic_decrement(&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.isEmpty() && !depend.isEmpty())
- {
- 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.isEmpty())
- {
- 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.isEmpty())
- {
- if (m_pImpl->m_dependencies.count(type) > 0)
- {
- return sal_True;
- }
- }
-
- return sal_False;
-}
-
-void TypeDependency::setGenerated(const OString& type, sal_uInt16 genFlag)
-{
- 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 &&
- 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;
-
- for (sal_uInt16 i=0; i < count; i++)
- {
- const OString fieldType = reader.getFieldType(i);
- const bool bIsTypeParam(reader.getFieldAccess(i) & RT_ACCESS_PARAMETERIZED_TYPE);
-
- if (!fieldType.isEmpty() && !bIsTypeParam)
- {
- 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);
-
- if (reader.getReferenceType(i) != RT_REF_TYPE_PARAMETER)
- {
- 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 bb6e18030f1d..000000000000
--- a/rdbmaker/source/codemaker/global.cxx
+++ /dev/null
@@ -1,162 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#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.isEmpty() )
- {
- 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/options.cxx b/rdbmaker/source/codemaker/options.cxx
deleted file mode 100644
index 19fcc33e3fd0..000000000000
--- a/rdbmaker/source/codemaker/options.cxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#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 1348a1e94b70..000000000000
--- a/rdbmaker/source/codemaker/typemanager.cxx
+++ /dev/null
@@ -1,268 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#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_atomic_increment(&m_pImpl->m_refCount);
-}
-
-sal_Int32 TypeManager::release()
-{
- sal_Int32 refCount = 0;
- if (0 == (refCount = osl_atomic_decrement(&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, 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, 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: */
diff --git a/rdbmaker/source/rdbmaker/rdbmaker.cxx b/rdbmaker/source/rdbmaker/rdbmaker.cxx
deleted file mode 100644
index 746dca23e047..000000000000
--- a/rdbmaker/source/rdbmaker/rdbmaker.cxx
+++ /dev/null
@@ -1,500 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <stdio.h>
-#include <osl/file.hxx>
-#include <osl/process.h>
-#include <codemaker/typemanager.hxx>
-#include <codemaker/dependency.hxx>
-
-#include <rtl/strbuf.hxx>
-
-#if defined(SAL_W32)
-#include <io.h>
-#include <direct.h>
-#include <errno.h>
-#endif
-
-#ifdef UNX
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <unistd.h>
-#endif
-
-#include "specialtypemanager.hxx"
-#include "rdboptions.hxx"
-#include "rdbtype.hxx"
-
-#define PATH_DELEMITTER '/'
-
-using namespace osl;
-
-using ::rtl::OUString;
-using ::rtl::OString;
-using ::rtl::OStringBuffer;
-using ::rtl::OUStringToOString;
-using ::rtl::OStringToOUString;
-
-FileStream listFile;
-RegistryKey rootKey;
-Registry regFile;
-sal_Bool useSpecial;
-TypeManager* pTypeMgr = NULL;
-StringList dirEntries;
-StringSet filterTypes;
-
-OString getFullNameOfApplicatRdb()
-{
- OUString bootReg;
- OUString uTmpStr;
- if( osl_getExecutableFile(&uTmpStr.pData) == osl_Process_E_None )
- {
- sal_uInt32 lastIndex = uTmpStr.lastIndexOf(PATH_DELEMITTER);
- OUString tmpReg;
-
- if ( lastIndex > 0 )
- {
- tmpReg =uTmpStr.copy(0, lastIndex + 1);
- }
-
- tmpReg += OUString( RTL_CONSTASCII_USTRINGPARAM("applicat.rdb") );
-
- FileBase::getSystemPathFromFileURL(tmpReg, bootReg);
- }
-
- return OUStringToOString(bootReg, RTL_TEXTENCODING_ASCII_US);
-}
-
-void initFilterTypes(RdbOptions* pOptions)
-{
- if (pOptions->isValid("-FT"))
- {
- OString fOption(pOptions->getOption("-FT"));
- sal_Int32 nIndex = 0;
- do
- {
- filterTypes.insert( fOption.getToken( 0, ';', nIndex ).replace('.', '/') );
- }
- while ( nIndex >= 0 );
- }
- if (pOptions->isValid("-F"))
- {
- FILE *f = fopen(pOptions->getOption("-F").getStr(), "r");
-
- if (f)
- {
- sal_Char buffer[1024+1];
- sal_Char *pBuf = fgets(buffer, 1024, f);
- sal_Char *s = NULL;
- sal_Char *p = NULL;
- while ( pBuf && !feof(f))
- {
- p = pBuf;
- if (*p != '\n' && *p != '\r')
- {
- while (*p == ' ' && *p =='\t')
- p++;
-
- s = p;
- while (*p != '\n' && *p != '\r' && *p != ' ' && *p != '\t')
- p++;
-
- *p = '\0';
- filterTypes.insert( OString(s).replace('.', '/') );
- }
-
- pBuf = fgets(buffer, 1024, f);
- }
-
- fclose(f);
- }
- }
-}
-
-sal_Bool checkFilterTypes(const OString& type)
-{
- StringSet::iterator iter = filterTypes.begin();
- while ( iter != filterTypes.end() )
- {
- if ( type.indexOf( *iter ) == 0 )
- {
- return sal_True;
- }
-
- ++iter;
- }
-
- return sal_False;
-}
-
-void cleanUp( sal_Bool bError)
-{
- if ( pTypeMgr )
- {
- delete pTypeMgr;
- }
- if (useSpecial)
- {
- pTypeMgr = new SpecialTypeManager();
- }else
- {
- pTypeMgr = new RegistryTypeManager();
- }
-
- if ( rootKey.isValid() )
- {
- rootKey.closeKey();
- }
- if ( regFile.isValid() )
- {
- if ( bError )
- {
- regFile.destroy(OUString());
- } else
- {
- regFile.close();
- }
- }
- if ( listFile.isValid() )
- {
- listFile.close();
- unlink(listFile.getName().getStr());
- }
-
- StringList::reverse_iterator iter = dirEntries.rbegin();
- while ( iter != dirEntries.rend() )
- {
- if (rmdir((char*)(*iter).getStr()) == -1)
- {
- break;
- }
-
- ++iter;
- }
-}
-
-OString createFileName(const OString& path)
-{
- OString fileName(path);
-
- sal_Char token;
-#ifdef SAL_UNX
- fileName = fileName.replace('\\', '/');
- token = '/';
-#else
- fileName = fileName.replace('/', '\\');
- token = '\\';
-#endif
-
- OStringBuffer nameBuffer( path.getLength() );
-
- sal_Int32 nIndex = 0;
- do
- {
- nameBuffer.append(fileName.getToken( 0, token, nIndex ).getStr());
- if ( nIndex == -1 ) break;
-
- if (nameBuffer.getLength() == 0 || OString(".") == nameBuffer.getStr())
- {
- nameBuffer.append(token);
- continue;
- }
-
-#if defined(SAL_UNX)
- if (mkdir((char*)nameBuffer.getStr(), 0777) == -1)
-#else
- if (mkdir((char*)nameBuffer.getStr()) == -1)
-#endif
- {
- if ( errno == ENOENT )
- return OString();
- } else
- {
- dirEntries.push_back(nameBuffer.getStr());
- }
-
- nameBuffer.append(token);
- }
- while ( nIndex >= 0 );
-
- return fileName;
-}
-
-sal_Bool produceAllTypes(const OString& typeName,
- TypeManager& typeMgr,
- TypeDependency& typeDependencies,
- RdbOptions* pOptions,
- sal_Bool bFullScope,
- FileStream& o,
- RegistryKey& regKey,
- StringSet& filterTypes2)
- throw( CannotDumpException )
-{
- if (!produceType(typeName, typeMgr, typeDependencies, pOptions, o, regKey, filterTypes2))
- {
- fprintf(stderr, "%s ERROR: %s\n",
- pOptions->getProgramName().getStr(),
- OString("cannot dump Type '" + typeName + "'").getStr());
- cleanUp(sal_True);
- exit(99);
- }
-
- RegistryKey typeKey = typeMgr.getTypeKey(typeName);
- RegistryKeyNames subKeys;
-
- if (typeKey.getKeyNames(OUString(), subKeys))
- return sal_False;
-
- OString tmpName;
- for (sal_uInt32 i=0; i < subKeys.getLength(); i++)
- {
- tmpName = OUStringToOString(subKeys.getElement(i), RTL_TEXTENCODING_UTF8);
-
- if (pOptions->isValid("-B"))
- tmpName = tmpName.copy(tmpName.indexOf('/', 1) + 1);
- else
- tmpName = tmpName.copy(1);
-
- if (bFullScope)
- {
- if (!produceAllTypes(tmpName, typeMgr, typeDependencies, pOptions, sal_True,
- o, regKey, filterTypes2))
- return sal_False;
- } else
- {
- if (!produceType(tmpName, typeMgr, typeDependencies, pOptions, o, regKey, filterTypes2))
- return sal_False;
- }
- }
-
- return sal_True;
-}
-
-
-#if (defined UNX)
-int main( int argc, char * argv[] )
-#else
-int __cdecl main( int argc, char * argv[] )
-#endif
-{
- RdbOptions options;
-
- try
- {
- if (!options.initOptions(argc, argv))
- {
- cleanUp(sal_True);
- exit(1);
- }
- }
- catch(const IllegalArgument& e)
- {
- fprintf(stderr, "Illegal option: %s\n", e.m_message.getStr());
- cleanUp(sal_True);
- exit(99);
- }
-
- TypeDependency typeDependencies;
-
- OString bootReg;
-
- if ( options.isValid("-R") )
- {
- bootReg = options.getOption("-R");
- } else
- {
- if (options.getInputFiles().empty())
- {
- bootReg = getFullNameOfApplicatRdb();
- }
- }
-
- if ( !bootReg.isEmpty() )
- {
- pTypeMgr = new SpecialTypeManager();
- useSpecial = sal_True;
- } else
- {
- pTypeMgr = new RegistryTypeManager();
- useSpecial = sal_False;
- }
-
- TypeManager& typeMgr = *pTypeMgr;
-
- if ( useSpecial && !typeMgr.init( bootReg ) )
- {
- fprintf(stderr, "%s : init typemanager failed, check your environment for bootstrapping uno.\n", options.getProgramName().getStr());
- cleanUp(sal_True);
- exit(99);
- }
- if ( !useSpecial && !typeMgr.init(!options.isValid("-T"), options.getInputFiles()))
- {
- fprintf(stderr, "%s : init registries failed, check your registry files.\n", options.getProgramName().getStr());
- cleanUp(sal_True);
- exit(99);
- }
-
- initFilterTypes(&options);
-
- if (options.isValid("-B"))
- {
- typeMgr.setBase(options.getOption("-B"));
- }
-
- if ( !options.isValid("-O") )
- {
- fprintf(stderr, "%s ERROR: %s\n",
- options.getProgramName().getStr(),
- "no output file is specified.");
- cleanUp(sal_True);
- exit(99);
- }
-
- if ( options.generateTypeList() )
- {
- OString fileName = createFileName( options.getOption("-O") );
- listFile.open(fileName);
-
- if ( !listFile.isValid() )
- {
- fprintf(stderr, "%s ERROR: %s\n",
- options.getProgramName().getStr(),
- "could not open output file.");
- cleanUp(sal_True);
- exit(99);
- }
- } else
- {
- OUString fileName( OStringToOUString(createFileName( options.getOption("-O") ), RTL_TEXTENCODING_UTF8) );
- if ( regFile.create(fileName) )
- {
- fprintf(stderr, "%s ERROR: %s\n",
- options.getProgramName().getStr(),
- "could not create registry output file.");
- cleanUp(sal_True);
- exit(99);
- }
-
-
- if (options.isValid("-b"))
- {
- RegistryKey tmpKey;
- regFile.openRootKey(tmpKey);
-
- tmpKey.createKey( OStringToOUString(options.getOption("-b"), RTL_TEXTENCODING_UTF8), rootKey);
- } else
- {
- regFile.openRootKey(rootKey);
- }
- }
-
- try
- {
- if (options.isValid("-T"))
- {
- OString tOption(options.getOption("-T"));
- OString typeName, tmpName;
- sal_Bool ret = sal_False;
- sal_Int32 nIndex = 0;
- do
- {
- typeName = tOption.getToken( 0, ';', nIndex);
- sal_Int32 lastIndex = typeName.lastIndexOf('.');
- tmpName = typeName.copy( lastIndex+1 );
- if (tmpName == "*")
- {
- if (!bootReg.isEmpty())
- {
- fprintf(stderr, "%s ERROR: %s\n",
- options.getProgramName().getStr(),
- "dumping all types of a scope is not possible if -R option is used.");
- exit(99);
- }
- // produce this type and his scope, but the scope is not recursively generated.
- if (typeName.equals("*"))
- {
- tmpName = "/";
- } else
- {
- tmpName = typeName.copy(0, typeName.lastIndexOf('.')).replace('.', '/');
- if (tmpName.isEmpty())
- tmpName = "/";
- else
- tmpName.replace('.', '/');
- }
- ret = produceAllTypes(tmpName, typeMgr, typeDependencies, &options, sal_False,
- listFile, rootKey, filterTypes);
- } else
- {
- // produce only this type
- ret = produceType(typeName.replace('.', '/'), typeMgr, typeDependencies,
- &options, listFile, rootKey, filterTypes);
- }
-
- if (!ret)
- {
- fprintf(stderr, "%s ERROR: %s\n",
- options.getProgramName().getStr(),
- OString("cannot dump Type '" + typeName + "'").getStr());
- cleanUp(sal_True);
- exit(99);
- }
- }
- while ( nIndex >= 0 );
- } else
- if (options.isValid("-X"))
- {
- } else
- {
- if (bootReg.isEmpty())
- {
- // produce all types
- if (!produceAllTypes("/", typeMgr, typeDependencies, &options, sal_True,
- listFile, rootKey, filterTypes))
- {
- fprintf(stderr, "%s ERROR: %s\n",
- options.getProgramName().getStr(),
- "an error occurs while dumping all types.");
- exit(99);
- }
- } else
- {
- fprintf(stderr, "%s ERROR: %s\n",
- options.getProgramName().getStr(),
- "dumping all types is not possible if -R option is used.");
- exit(99);
- }
- }
- }
- catch(const CannotDumpException& e)
- {
- fprintf(stderr, "%s ERROR: %s\n",
- options.getProgramName().getStr(),
- e.m_message.getStr());
- cleanUp(sal_True);
- exit(99);
- }
-
- cleanUp(sal_False);
- return 0;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/rdbmaker/source/rdbmaker/rdboptions.cxx b/rdbmaker/source/rdbmaker/rdboptions.cxx
deleted file mode 100644
index 54d92eb1921c..000000000000
--- a/rdbmaker/source/rdbmaker/rdboptions.cxx
+++ /dev/null
@@ -1,372 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#include <stdio.h>
-#include <string.h>
-
-#include "rdboptions.hxx"
-
-using ::rtl::OString;
-sal_Bool RdbOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile)
- throw( IllegalArgument )
-{
- sal_Bool ret = sal_True;
- sal_uInt16 i=0;
-
- if (!bCmdFile)
- {
- bCmdFile = sal_True;
-
- m_program = av[0];
-
- if (ac < 2)
- {
- fprintf(stderr, "%s", prepareHelp().getStr());
- ret = sal_False;
- }
-
- i = 1;
- } else
- {
- i = 0;
- }
-
- char *s=NULL;
- for (; i < ac; i++)
- {
- if (av[i][0] == '-')
- {
- switch (av[i][1])
- {
- case 'O':
- if (av[i][2] == '\0')
- {
- if (i < ac - 1 && av[i+1][0] != '-')
- {
- i++;
- s = av[i];
- } else
- {
- OString tmp("'-O', please check");
- if (i <= ac - 1)
- {
- tmp += " your input '" + OString(av[i+1]) + "'";
- }
-
- throw IllegalArgument(tmp);
- }
- } else
- {
- s = av[i] + 2;
- }
-
- m_options["-O"] = OString(s);
- break;
- case 'X':
- if (av[i][2] == '\0')
- {
- if (i < ac - 1 && av[i+1][0] != '-')
- {
- i++;
- s = av[i];
- } else
- {
- OString tmp("'-X', please check");
- if (i <= ac - 1)
- {
- tmp += " your input '" + OString(av[i+1]) + "'";
- }
-
- throw IllegalArgument(tmp);
- }
- } else
- {
- s = av[i] + 2;
- }
-
- m_options["-X"] = OString(s);
- break;
- case 'R':
- if (av[i][2] == '\0')
- {
- if (i < ac - 1 && av[i+1][0] != '-')
- {
- i++;
- s = av[i];
- } else
- {
- OString tmp("'-R', please check");
- if (i <= ac - 1)
- {
- tmp += " your input '" + OString(av[i+1]) + "'";
- }
-
- throw IllegalArgument(tmp);
- }
- } else
- {
- s = av[i] + 2;
- }
-
- m_options["-R"] = OString(s);
- break;
- case 'B':
- if (av[i][2] == '\0')
- {
- if (i < ac - 1 && av[i+1][0] != '-')
- {
- i++;
- s = av[i];
- } else
- {
- OString tmp("'-B', please check");
- if (i <= ac - 1)
- {
- tmp += " your input '" + OString(av[i+1]) + "'";
- }
-
- throw IllegalArgument(tmp);
- }
- } else
- {
- s = av[i] + 2;
- }
-
- m_options["-B"] = OString(s);
- break;
- case 'b':
- if (av[i][2] == '\0')
- {
- if (i < ac - 1 && av[i+1][0] != '-')
- {
- i++;
- s = av[i];
- } else
- {
- OString tmp("'-b', please check");
- if (i <= ac - 1)
- {
- tmp += " your input '" + OString(av[i+1]) + "'";
- }
-
- throw IllegalArgument(tmp);
- }
- } else
- {
- s = av[i] + 2;
- }
-
- m_options["-b"] = OString(s);
- break;
- case 'T':
- if (av[i][2] == '\0')
- {
- if (i < ac - 1 && av[i+1][0] != '-')
- {
- i++;
- s = av[i];
- } else
- {
- OString tmp("'-T', please check");
- if (i <= ac - 1)
- {
- tmp += " your input '" + OString(av[i+1]) + "'";
- }
-
- throw IllegalArgument(tmp);
- }
- } else
- {
- s = av[i] + 2;
- }
-
- if (m_options.count("-T") > 0)
- {
- OString tmp(m_options["-T"]);
- tmp = tmp + ";" + s;
- m_options["-T"] = tmp;
- } else
- {
- m_options["-T"] = OString(s);
- }
- break;
- case 'F':
- if (av[i][2] == 'T')
- {
- if (av[i][3] == '\0')
- {
- if (i < ac - 1 && av[i+1][0] != '-')
- {
- i++;
- s = av[i];
- } else
- {
- OString tmp("'-FT', please check");
- if (i <= ac - 1)
- {
- tmp += " your input '" + OString(av[i+1]) + "'";
- }
-
- throw IllegalArgument(tmp);
- }
- } else
- {
- s = av[i] + 3;
- }
-
- if (m_options.count("-FT") > 0)
- {
- OString tmp(m_options["-FT"]);
- tmp = tmp + ";" + s;
- m_options["-FT"] = tmp;
- } else
- {
- m_options["-FT"] = OString(s);
- }
- } else
- {
- if (av[i][2] == '\0')
- {
- if (i < ac - 1 && av[i+1][0] != '-')
- {
- i++;
- s = av[i];
- } else
- {
- OString tmp("'-F', please check");
- if (i <= ac - 1)
- {
- tmp += " your input '" + OString(av[i+1]) + "'";
- }
-
- throw IllegalArgument(tmp);
- }
- } else
- {
- s = av[i] + 2;
- }
-
- m_options["-F"] = OString(s);
- }
- break;
- case 'L':
- if (av[i][2] != '\0')
- {
- OString tmp("'-L', please check");
- if (i <= ac - 1)
- {
- tmp += " your input '" + OString(av[i+1]) + "'";
- }
-
- throw IllegalArgument(tmp);
- }
-
- m_options["-L"] = OString();
- m_generateTypeList = true;
- break;
- default:
- throw IllegalArgument("the option is unknown" + OString(av[i]));
- }
- } else
- {
- if (av[i][0] == '@')
- {
- FILE* cmdFile = fopen(av[i]+1, "r");
- if( cmdFile == NULL )
- {
- fprintf(stderr, "%s", prepareHelp().getStr());
- ret = sal_False;
- } else
- {
- int rargc=0;
- char* rargv[512];
- char buffer[512];
-
- while ( fscanf(cmdFile, "%s", buffer) != EOF )
- {
- rargv[rargc]= strdup(buffer);
- rargc++;
- }
- fclose(cmdFile);
-
- ret = initOptions(rargc, rargv, bCmdFile);
-
- for (long j=0; j < rargc; j++)
- {
- free(rargv[j]);
- }
- }
- } else
- {
- m_inputFiles.push_back(av[i]);
- }
- }
- }
-
- return ret;
-}
-
-OString RdbOptions::prepareHelp()
-{
- OString help("\nusing: ");
- help += m_program + " [-options] (-R<regname> | file_1 [... file_n])\n";
- help += "The rdbmaker supports 2 modes:\n";
- help += " 1. using the internal UNO type description manager -> use -R<regname>\n"
- " where regname specifies the type library used by the UNO type description manager\n"
- " after UNO is bootstrapped. This option disables the use of any other type libraries.\n"
- " The tpye library must be a valid product type library which means that all types are\n"
- " stored under the global base node UCR (Uno Core Reflection data).\n";
- help += " 2. using one or more type library files -> use file_1 ... file_n\n"
- " file_1 .. file_n specifies one or more valid type library files which are used to\n"
- " find the needed type information. The used type libraries have to support the same base\n"
- " node (-B option).\n";
- help += "Options:\n";
- help += " -O<filename> = filename specifies the name of the generated registry\n";
- help += " or text file.\n";
- help += " -L = specifies that only a text file is generated with the\n";
- help += " names of the specified types and their dependencies.\n";
- help += " Default is that a registry file will be created\n";
- help += " -T<name> = name specifies a type or a list of types. The output for\n";
- help += " [t1;...] this type is generated.\n";
- help += " Example: 'com.sun.star.uno.XInterface' is a valid type.\n";
- help += " -FT<name> = name specifies a type or a list of types. For this types\n";
- help += " [t1;...] nothing will be generated.\n";
- help += " |F<file> = file specifies an text file. For the specified types in\n" ;
- help += " this file nothing will be generated.\n";
- help += " -B<name> = name specifies the base node. All types are searched under\n";
- help += " this node. Default is the root '/' of the registry files.\n";
- help += " This option takes effect using run mode 2 only.\n";
- help += " -b<name> = name specifies the base node of the output registry. All\n";
- help += " types will be generated under this node. Default is the\n";
- help += " root '/' of the registry file.\n";
- help += prepareVersion();
-
- return help;
-}
-
-OString RdbOptions::prepareVersion()
-{
- OString version("\nSun Microsystems (R) ");
- version += m_program + " Version 2.0\n\n";
-
- return version;
-}
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/rdbmaker/source/rdbmaker/rdboptions.hxx b/rdbmaker/source/rdbmaker/rdboptions.hxx
deleted file mode 100644
index aebf6d1323ef..000000000000
--- a/rdbmaker/source/rdbmaker/rdboptions.hxx
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _RDBMAKER_RDBOPTIONS_HXX_
-#define _RDBMAKER_RDBOPTIONS_HXX_
-
-#include <codemaker/options.hxx>
-
-class RdbOptions : public Options
-{
-public:
- RdbOptions()
- : Options()
- , m_generateTypeList(false)
- {}
-
- ~RdbOptions() {}
-
- sal_Bool initOptions(int ac, char* av[], sal_Bool bCmdFile=sal_False)
- throw( IllegalArgument );
-
- ::rtl::OString prepareHelp();
-
- ::rtl::OString prepareVersion();
-
- bool generateTypeList()
- { return m_generateTypeList; }
-
-protected:
- bool m_generateTypeList;
-};
-
-#endif // _RDBMAKER_RDBOPTIONS_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/rdbmaker/source/rdbmaker/rdbtype.cxx b/rdbmaker/source/rdbmaker/rdbtype.cxx
deleted file mode 100644
index c13c92438fd8..000000000000
--- a/rdbmaker/source/rdbmaker/rdbtype.cxx
+++ /dev/null
@@ -1,159 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <stdio.h>
-#include <rtl/alloc.h>
-#include <rtl/ustring.hxx>
-#include <rtl/strbuf.hxx>
-
-#include "rdbtype.hxx"
-#include "rdboptions.hxx"
-
-using ::rtl::OUString;
-using ::rtl::OString;
-using ::rtl::OStringToOUString;
-sal_Bool isBaseType(const OString& type)
-{
- if ( type.equals("long") ||
- type.equals("short") ||
- type.equals("hyper") ||
- type.equals("string") ||
- type.equals("boolean") ||
- type.equals("char") ||
- type.equals("byte") ||
- type.equals("any") ||
- type.equals("type") ||
- type.equals("float") ||
- type.equals("double") ||
- type.equals("octet") ||
- type.equals("void") ||
- type.equals("unsigned long") ||
- type.equals("unsigned short") ||
- type.equals("unsigned hyper") )
- return sal_True;
-
- return sal_False;
-}
-
-sal_Bool produceDependedTypes(const OString& typeName,
- TypeManager& typeMgr,
- TypeDependency& typeDependencies,
- RdbOptions* pOptions,
- FileStream& o,
- RegistryKey& regKey,
- StringSet& filterTypes)
- throw( CannotDumpException )
-{
- sal_Bool ret = sal_True;
-
- TypeUsingSet usingSet(typeDependencies.getDependencies(typeName));
-
- TypeUsingSet::const_iterator iter = usingSet.begin();
- OString sTypeName;
- sal_Int32 index = 0;
- while (iter != usingSet.end())
- {
- sTypeName = (*iter).m_type;
- if ((index = sTypeName.lastIndexOf(']')) > 0)
- sTypeName = sTypeName.copy(index + 1);
-
- if ( !isBaseType(sTypeName) )
- {
- if (!produceType(sTypeName,
- typeMgr,
- typeDependencies,
- pOptions,
- o, regKey,
- filterTypes,
- sal_True))
- {
- fprintf(stderr, "%s ERROR: %s\n",
- pOptions->getProgramName().getStr(),
- OString("cannot dump Type '" + sTypeName + "'").getStr());
- cleanUp(sal_True);
- exit(99);
- }
- }
- ++iter;
- }
-
- return ret;
-}
-
-//*************************************************************************
-// produceType
-//*************************************************************************
-sal_Bool produceType(const OString& typeName,
- TypeManager& typeMgr,
- TypeDependency& typeDependencies,
- RdbOptions* pOptions,
- FileStream& o,
- RegistryKey& regKey,
- StringSet& filterTypes,
- sal_Bool bDepend)
- throw( CannotDumpException )
-{
- if (typeDependencies.isGenerated(typeName) )
- return sal_True;
- if( !checkTypeDependencies(typeMgr, typeDependencies, typeName, bDepend))
- return sal_False;
-
- if ( !checkFilterTypes(typeName) )
- {
- if ( pOptions->generateTypeList() )
- {
- o << typeName.getStr() << "\n";
- } else
- {
- TypeReader reader = typeMgr.getTypeReader(typeName);
-
- if (!reader.isValid())
- {
- if (typeName.equals("/"))
- {
- return sal_True;
- } else
- {
- return sal_False;
- }
- }
- RegistryKey typeKey;
- if ( regKey.createKey( OStringToOUString(typeName, RTL_TEXTENCODING_UTF8), typeKey) )
- {
- return sal_False;
- }
-
- if ( typeKey.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)reader.getBlop(), reader.getBlopSize()) )
- {
- return sal_False;
- }
-
- }
- }
-
- typeDependencies.setGenerated(typeName);
- sal_Bool ret = produceDependedTypes(typeName, typeMgr, typeDependencies,
- pOptions, o, regKey, filterTypes);
-
- return ret;
-}
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/rdbmaker/source/rdbmaker/rdbtype.hxx b/rdbmaker/source/rdbmaker/rdbtype.hxx
deleted file mode 100644
index 46d80c72f01f..000000000000
--- a/rdbmaker/source/rdbmaker/rdbtype.hxx
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _RDBMAKER_RDBTYPE_HXX_
-#define _RDBMAKER_RDBTYPE_HXX_
-
-#include <codemaker/typemanager.hxx>
-#include <codemaker/dependency.hxx>
-
-sal_Bool checkFilterTypes(const ::rtl::OString& type);
-void cleanUp(sal_Bool);
-
-class RdbOptions;
-class FileStream;
-class RegistryKey;
-
-sal_Bool produceType(const ::rtl::OString& typeName,
- TypeManager& typeMgr,
- TypeDependency& typeDependencies,
- RdbOptions* pOptions,
- FileStream& o,
- RegistryKey& regKey,
- StringSet& filterTypes,
- sal_Bool bDepend = sal_False)
- throw( CannotDumpException );
-
-#endif // _RDBMAKER_RDBTYPE_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/rdbmaker/source/rdbmaker/specialtypemanager.cxx b/rdbmaker/source/rdbmaker/specialtypemanager.cxx
deleted file mode 100644
index 72f8341107c7..000000000000
--- a/rdbmaker/source/rdbmaker/specialtypemanager.cxx
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <rtl/alloc.h>
-
-#include "specialtypemanager.hxx"
-
-extern "C"
-{
-sal_Bool SAL_CALL initTypeMapper( const sal_Char* pRegName );
-sal_uInt32 SAL_CALL getTypeBlop(const sal_Char* pTypeName, sal_uInt8** pBlop);
-}
-
-using ::rtl::OString;
-SpecialTypeManager::SpecialTypeManager()
-{
- m_pImpl = new SpecialTypeManagerImpl();
- acquire();
-}
-
-SpecialTypeManager::~SpecialTypeManager()
-{
- release();
-}
-
-void SpecialTypeManager::acquire()
-{
- TypeManager::acquire();
-}
-
-void SpecialTypeManager::release()
-{
- if (0 == TypeManager::release())
- {
- delete m_pImpl;
- }
-}
-
-sal_Bool SpecialTypeManager::init(const OString& registryName)
-{
- return initTypeMapper( registryName.getStr() );
-}
-
-TypeReader SpecialTypeManager::getTypeReader(const OString& name)
-{
- TypeReader reader;
-
- sal_uInt8* pBlop = NULL;
- sal_uInt32 blopSize = 0;
-
- if ( (blopSize = getTypeBlop( name.getStr(), &pBlop)) > 0 )
- {
- reader = TypeReader(pBlop, blopSize, true);
- }
-
- if ( pBlop )
- {
- rtl_freeMemory(pBlop);
- }
-
- return reader;
-}
-
-RTTypeClass SpecialTypeManager::getTypeClass(const OString& name)
-{
- if (m_pImpl->m_t2TypeClass.count(name) > 0)
- {
- return m_pImpl->m_t2TypeClass[name];
- } else
- {
- }
-
- return RT_TYPE_INVALID;
-}
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/rdbmaker/source/rdbmaker/specialtypemanager.hxx b/rdbmaker/source/rdbmaker/specialtypemanager.hxx
deleted file mode 100644
index 264b56f477d7..000000000000
--- a/rdbmaker/source/rdbmaker/specialtypemanager.hxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _SPECIALTYPEMANAGER_HXX_
-#define _SPECIALTYPEMANAGER_HXX_
-
-#include <codemaker/registry.hxx>
-#include <codemaker/typemanager.hxx>
-
-
-struct SpecialTypeManagerImpl
-{
- T2TypeClassMap m_t2TypeClass;
-};
-
-class SpecialTypeManager : public TypeManager
-{
-public:
- SpecialTypeManager();
- ~SpecialTypeManager();
-
- SpecialTypeManager( const SpecialTypeManager& value )
- : TypeManager(value)
- , m_pImpl( value.m_pImpl )
- {
- acquire();
- }
-
- using TypeManager::init;
- sal_Bool init(const ::rtl::OString& registryName);
-
- sal_Bool isValidType(const ::rtl::OString&)
- { return sal_True; }
- TypeReader getTypeReader(const ::rtl::OString& name);
- RTTypeClass getTypeClass(const ::rtl::OString& name);
-
- sal_Int32 getSize() { return m_pImpl->m_t2TypeClass.size(); }
-
-protected:
- void acquire();
- void release();
-
-protected:
- SpecialTypeManagerImpl* m_pImpl;
-};
-
-#endif // _CODEMAKER_TYPEMANAGER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/rdbmaker/source/rdbmaker/typeblop.cxx b/rdbmaker/source/rdbmaker/typeblop.cxx
deleted file mode 100644
index 7049da4502be..000000000000
--- a/rdbmaker/source/rdbmaker/typeblop.cxx
+++ /dev/null
@@ -1,514 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <string.h>
-
-#include <rtl/alloc.h>
-#include <registry/reflwrit.hxx>
-#include <cppuhelper/servicefactory.hxx>
-#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
-#include <com/sun/star/reflection/XInterfaceTypeDescription.hpp>
-#include <com/sun/star/reflection/XConstantsTypeDescription.hpp>
-#include <com/sun/star/reflection/XConstantTypeDescription.hpp>
-#include <com/sun/star/reflection/XModuleTypeDescription.hpp>
-#include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
-#include <com/sun/star/reflection/XInterfaceAttributeTypeDescription.hpp>
-#include <com/sun/star/reflection/XMethodParameter.hpp>
-#include <com/sun/star/reflection/XCompoundTypeDescription.hpp>
-#include <com/sun/star/reflection/XIndirectTypeDescription.hpp>
-#include <com/sun/star/reflection/XEnumTypeDescription.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <codemaker/global.hxx>
-
-using namespace com::sun::star;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::reflection;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::container;
-using namespace cppu;
-
-using ::rtl::OUString;
-
-static Reference< XHierarchicalNameAccess > xNameAccess;
-
-void writeConstantData( RegistryTypeWriter& rWriter, sal_uInt16 fieldIndex,
- const Reference< XConstantTypeDescription >& xConstant)
-
-{
- RTConstValue constValue;
- OUString uConstTypeName;
- OUString uConstName = xConstant->getName();
- Any aConstantAny = xConstant->getConstantValue();
-
- switch ( aConstantAny.getValueTypeClass() )
- {
- case TypeClass_BOOLEAN:
- {
- uConstTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM("boolean") );
- constValue.m_type = RT_TYPE_BOOL;
- aConstantAny >>= constValue.m_value.aBool;
- }
- break;
- case TypeClass_BYTE:
- {
- uConstTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM("byte") );
- constValue.m_type = RT_TYPE_BYTE;
- aConstantAny >>= constValue.m_value.aByte;
- }
- break;
- case TypeClass_SHORT:
- {
- uConstTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM("short") );
- constValue.m_type = RT_TYPE_INT16;
- aConstantAny >>= constValue.m_value.aShort;
- }
- break;
- case TypeClass_UNSIGNED_SHORT:
- {
- uConstTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM("unsigned short") );
- constValue.m_type = RT_TYPE_UINT16;
- aConstantAny >>= constValue.m_value.aUShort;
- }
- break;
- case TypeClass_LONG:
- {
- uConstTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM("long") );
- constValue.m_type = RT_TYPE_INT32;
- aConstantAny >>= constValue.m_value.aLong;
- }
- break;
- case TypeClass_UNSIGNED_LONG:
- {
- uConstTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM("unsigned long") );
- constValue.m_type = RT_TYPE_UINT32;
- aConstantAny >>= constValue.m_value.aULong;
- }
- break;
- case TypeClass_FLOAT:
- {
- uConstTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM("float") );
- constValue.m_type = RT_TYPE_FLOAT;
- aConstantAny >>= constValue.m_value.aFloat;
- }
- break;
- case TypeClass_DOUBLE:
- {
- uConstTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM("double") );
- constValue.m_type = RT_TYPE_DOUBLE;
- aConstantAny >>= constValue.m_value.aDouble;
- }
- break;
- case TypeClass_STRING:
- {
- uConstTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM("string") );
- constValue.m_type = RT_TYPE_STRING;
- constValue.m_value.aString = ((OUString*)aConstantAny.getValue())->getStr();
- }
- break;
- default:
- OSL_ASSERT(false);
- break;
- }
-
- rWriter.setFieldData(fieldIndex, uConstName, uConstTypeName, OUString(),
- OUString(), RT_ACCESS_CONST, constValue);
-}
-
-sal_uInt32 getInheritedMemberCount( Reference< XTypeDescription >& xType )
-{
- sal_uInt32 memberCount = 0;
- if ( xType->getTypeClass() == TypeClass_INTERFACE )
- {
- Reference< XInterfaceTypeDescription > xIFace(xType, UNO_QUERY);
-
- if ( !xIFace.is() )
- return memberCount;
-
- Reference< XTypeDescription > xSuperType = xIFace->getBaseType();
-
- if ( xSuperType.is() )
- memberCount = getInheritedMemberCount( xSuperType );
-
- memberCount += xIFace->getMembers().getLength();
- }
-
- return memberCount;
-}
-
-void writeMethodData( RegistryTypeWriter& rWriter, sal_uInt32 calculatedMemberOffset,
- const Reference< XInterfaceMemberTypeDescription >& xMember,
- const Reference< XInterfaceMethodTypeDescription >& xMethod )
-{
- RTMethodMode methodMode = RT_MODE_TWOWAY;
- if ( xMethod->isOneway() )
- {
- methodMode = RT_MODE_ONEWAY;
- }
-
- Sequence< Reference< XMethodParameter > > parameters( xMethod->getParameters() );
- Sequence< Reference< XTypeDescription > > exceptions( xMethod->getExceptions() );
- sal_uInt16 methodIndex = (sal_uInt16)(xMember->getPosition() - calculatedMemberOffset);
- sal_uInt16 paramCount = (sal_uInt16)parameters.getLength();
- sal_uInt16 exceptionCount = (sal_uInt16)exceptions.getLength();
-
- rWriter.setMethodData(methodIndex, xMember->getMemberName(),
- xMethod->getReturnType()->getName().replace('.', '/'),
- methodMode, paramCount, exceptionCount, OUString());
-
- RTParamMode paramMode = RT_PARAM_IN;
- sal_uInt16 i;
-
- for ( i=0; i < paramCount; i++)
- {
- Reference< XMethodParameter > xParam = parameters[i];
- if ( xParam->isIn() && xParam->isOut())
- {
- paramMode = RT_PARAM_INOUT;
- } else
- if ( xParam->isIn() )
- {
- paramMode = RT_PARAM_IN;
- } else
- if ( xParam->isOut() )
- {
- paramMode = RT_PARAM_OUT;
- }
-
- rWriter.setParamData(methodIndex, (sal_uInt16)xParam->getPosition(), xParam->getType()->getName().replace('.', '/'),
- xParam->getName(), paramMode);
- }
-
- for (i=0; i < exceptionCount; i++)
- {
- rWriter.setExcData(methodIndex, i, exceptions[i]->getName().replace('.', '/'));
- }
-}
-
-extern "C"
-{
-
-sal_Bool SAL_CALL initTypeMapper( const sal_Char* pRegName )
-{
- try
- {
- if (!pRegName)
- return sal_False;
-
- Reference< XMultiServiceFactory > xSMgr( createRegistryServiceFactory( convertToFileUrl(pRegName) ) );
-
- if ( !xSMgr.is() )
- return sal_False;
-
- Reference< XHierarchicalNameAccess > xNAccess;
-
- Reference< beans::XPropertySet > xProps( xSMgr, UNO_QUERY );
- if (xProps.is())
- {
- try
- {
- Reference< XComponentContext > xContext;
- if (xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xContext)
- {
- xContext->getValueByName(
- OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.reflection.theTypeDescriptionManager") ) ) >>= xNAccess;
- }
- }
- catch (beans::UnknownPropertyException &)
- {
- }
- }
-
- if ( !xNAccess.is() )
- return sal_False;
-
- xNameAccess = xNAccess;
- }
- catch( Exception& )
- {
- return sal_False;
- }
-
- return sal_True;
-}
-
-sal_uInt32 SAL_CALL getTypeBlop(const sal_Char* pTypeName, sal_uInt8** pBlop)
-{
- sal_uInt32 length = 0;
-
- if ( !pTypeName )
- return length;
-
- OUString uTypeName( OUString::createFromAscii(pTypeName).replace('/', '.') );
- try
- {
- Any aTypeAny( xNameAccess->getByHierarchicalName( uTypeName ) );
-
- if ( !aTypeAny.hasValue() )
- return length;
-
- Reference< XTypeDescription > xType;
- aTypeAny >>= xType;
-
- if ( !xType.is() )
- return length;
-
- switch (xType->getTypeClass())
- {
- case TypeClass_CONSTANTS:
- {
- Reference< XConstantsTypeDescription > xCFace(xType, UNO_QUERY);
-
- if ( !xCFace.is() )
- return length;
-
- Sequence< Reference< XConstantTypeDescription > > constTypes( xCFace->getConstants());
- sal_uInt16 constCount = (sal_uInt16)constTypes.getLength();
-
- RegistryTypeWriter writer(RT_TYPE_MODULE, uTypeName.replace('.', '/'),
- OUString(), constCount, 0, 0);
-
- for (sal_uInt16 i=0; i < constCount; i++)
- writeConstantData(writer, i, constTypes[i]);
-
- length = writer.getBlopSize();
- *pBlop = (sal_uInt8*)rtl_allocateMemory( length );
- memcpy(*pBlop, writer.getBlop(), length);
- }
- break;
- case TypeClass_MODULE:
- {
- Reference< XModuleTypeDescription > xMFace(xType, UNO_QUERY);
-
- if ( !xMFace.is() )
- return length;
-
- Sequence< Reference< XTypeDescription > > memberTypes( xMFace->getMembers());
-
- sal_uInt16 memberCount = (sal_uInt16)memberTypes.getLength();
- sal_uInt16 constCount = 0;
- sal_Int16 i;
-
- for ( i=0; i < memberCount; i++)
- {
- if ( TypeClass_CONSTANT == memberTypes[i]->getTypeClass() )
- constCount++;
- }
-
- RegistryTypeWriter writer(RT_TYPE_MODULE, uTypeName.replace('.', '/'),
- OUString(), constCount, 0, 0);
-
- if ( 0 < constCount )
- {
- Reference< XConstantTypeDescription > xConst;
- sal_uInt16 fieldIndex = 0;
- for (i=0; i < memberCount; i++)
- {
- if ( TypeClass_CONSTANT == memberTypes[i]->getTypeClass() )
- {
- xConst = Reference< XConstantTypeDescription >(memberTypes[i], UNO_QUERY);
-
- writeConstantData(writer, ++fieldIndex, xConst);
- }
- }
- }
-
- length = writer.getBlopSize();
- *pBlop = (sal_uInt8*)rtl_allocateMemory( length );
- memcpy(*pBlop, writer.getBlop(), length);
- }
- break;
- case TypeClass_INTERFACE:
- {
- Reference< XInterfaceTypeDescription > xIFace(xType, UNO_QUERY);
-
- if ( !xIFace.is() )
- return length;
-
- Reference< XInterfaceAttributeTypeDescription > xAttr;
- Reference< XInterfaceMethodTypeDescription > xMethod;
- Sequence< Reference< XInterfaceMemberTypeDescription > > memberTypes( xIFace->getMembers());
- sal_uInt16 memberCount = (sal_uInt16)memberTypes.getLength();
- sal_uInt16 attrCount = 0;
- sal_uInt16 inheritedMemberCount = 0;
- sal_Int32 i;
-
- for ( i=0; i < memberCount; i++)
- {
- xAttr = Reference< XInterfaceAttributeTypeDescription >(memberTypes[i], UNO_QUERY);
- if ( xAttr.is() )
- {
- attrCount++;
- }
- }
-
- OUString uSuperType;
- Reference< XTypeDescription > xSuperType = xIFace->getBaseType();
- if ( xSuperType.is() )
- {
- uSuperType = xSuperType->getName().replace('.','/');
- inheritedMemberCount = (sal_uInt16)getInheritedMemberCount( xSuperType );
- }
-
- RegistryTypeWriter writer(RT_TYPE_INTERFACE, uTypeName.replace('.', '/'),
- uSuperType, attrCount, memberCount-attrCount, 0);
-
- Uik uik = xIFace->getUik();
- RTUik rtUik = { uik.m_Data1, uik.m_Data2, uik.m_Data3, uik.m_Data4, uik.m_Data5 };
- writer.setUik( rtUik );
-
- RTFieldAccess attrAccess = RT_ACCESS_READWRITE;
- // reset attrCount, used for method index calculation
- attrCount = 0;
-
- for (i=0; i < memberCount; i++)
- {
- xAttr = Reference< XInterfaceAttributeTypeDescription >(memberTypes[i], UNO_QUERY);
- if ( xAttr.is() )
- {
- ++attrCount;
- if (xAttr->isReadOnly())
- {
- attrAccess = RT_ACCESS_READONLY;
- } else
- {
- attrAccess = RT_ACCESS_READWRITE;
- }
- writer.setFieldData(sal::static_int_cast< sal_uInt16 >(memberTypes[i]->getPosition() - inheritedMemberCount),
- memberTypes[i]->getMemberName(),
- xAttr->getType()->getName().replace('.', '/'),
- OUString(), OUString(), attrAccess);
- continue;
- }
-
- xMethod = Reference< XInterfaceMethodTypeDescription >(memberTypes[i], UNO_QUERY);
- if ( xMethod.is() )
- {
- writeMethodData( writer, attrCount+inheritedMemberCount, memberTypes[i], xMethod );
- }
- }
-
- length = writer.getBlopSize();
- *pBlop = (sal_uInt8*)rtl_allocateMemory( length );
- memcpy(*pBlop, writer.getBlop(), length);
- }
- break;
- case TypeClass_STRUCT:
- case TypeClass_EXCEPTION:
- {
- RTTypeClass rtTypeClass = RT_TYPE_STRUCT;
- if (xType->getTypeClass() == TypeClass_EXCEPTION)
- {
- rtTypeClass = RT_TYPE_EXCEPTION;
- }
-#include <com/sun/star/reflection/XConstantsTypeDescription.hpp>
-
- Reference< XCompoundTypeDescription > xComp(xType, UNO_QUERY);
-
- if ( !xComp.is() )
- return length;
-
- Sequence< OUString > memberNames( xComp->getMemberNames());
- Sequence< Reference< XTypeDescription > > memberTypes( xComp->getMemberTypes());
- sal_uInt16 memberCount = (sal_uInt16)memberNames.getLength();
-
- OUString uSuperType;
- Reference< XTypeDescription > xSuperType = xComp->getBaseType();
- if ( xSuperType.is() )
- {
- uSuperType = xSuperType->getName().replace('.','/');
- }
-
- RegistryTypeWriter writer(rtTypeClass, uTypeName.replace('.', '/'),
- uSuperType, memberCount, 0, 0);
-
- for (sal_Int16 i=0; i < memberCount; i++)
- {
- writer.setFieldData(i , memberNames[i], memberTypes[i]->getName().replace('.', '/'),
- OUString(), OUString(), RT_ACCESS_READWRITE);
- }
-
- length = writer.getBlopSize();
- *pBlop = (sal_uInt8*)rtl_allocateMemory( length );
- memcpy(*pBlop, writer.getBlop(), length);
- }
- break;
- case TypeClass_ENUM:
- {
- Reference< XEnumTypeDescription > xEnum(xType, UNO_QUERY);
-
- if ( !xEnum.is() )
- return length;
-
- Sequence< OUString > enumNames( xEnum->getEnumNames());
- Sequence< sal_Int32 > enumValues( xEnum->getEnumValues());
- sal_uInt16 enumCount = (sal_uInt16)enumNames.getLength();
-
- RegistryTypeWriter writer(RT_TYPE_ENUM, uTypeName.replace('.', '/'),
- OUString(), enumCount, 0, 0);
-
- RTConstValue constValue;
- for (sal_Int16 i=0; i < enumCount; i++)
- {
- constValue.m_type = RT_TYPE_INT32;
- constValue.m_value.aLong = enumValues[i];
-
- writer.setFieldData(i, enumNames[i], OUString(), OUString(), OUString(),
- RT_ACCESS_CONST, constValue);
- }
-
- length = writer.getBlopSize();
- *pBlop = (sal_uInt8*)rtl_allocateMemory( length );
- memcpy(*pBlop, writer.getBlop(), length);
- }
- break;
- case TypeClass_TYPEDEF:
- {
- Reference< XIndirectTypeDescription > xTD(xType, UNO_QUERY);
-
- if ( !xTD.is() )
- return length;
-
- RegistryTypeWriter writer(RT_TYPE_TYPEDEF, uTypeName.replace('.', '/'),
- xTD->getReferencedType()->getName().replace('.', '/'),
- 0, 0, 0);
- length = writer.getBlopSize();
- *pBlop = (sal_uInt8*)rtl_allocateMemory( length );
- memcpy(*pBlop, writer.getBlop(), length);
- }
- break;
- default:
- OSL_ASSERT(false);
- break;
- }
-
- }
- catch( Exception& )
- {
- }
-
- return length;
-}
-
-} // extern "C"
-
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */