summaryrefslogtreecommitdiffstats
path: root/codemaker/source
diff options
context:
space:
mode:
Diffstat (limited to 'codemaker/source')
-rw-r--r--codemaker/source/codemaker/codemaker.cxx24
-rw-r--r--codemaker/source/codemaker/typemanager.cxx303
-rw-r--r--codemaker/source/codemaker/unotype.cxx20
-rw-r--r--codemaker/source/commoncpp/commoncpp.cxx2
-rw-r--r--codemaker/source/commonjava/commonjava.cxx2
-rwxr-xr-xcodemaker/source/cppumaker/cpputype.cxx12
-rw-r--r--codemaker/source/cppumaker/dependencies.cxx1
-rw-r--r--codemaker/source/javamaker/javamaker.cxx6
-rw-r--r--codemaker/source/javamaker/javatype.cxx1
9 files changed, 23 insertions, 348 deletions
diff --git a/codemaker/source/codemaker/codemaker.cxx b/codemaker/source/codemaker/codemaker.cxx
index 3c67b3788e39..18082b827f33 100644
--- a/codemaker/source/codemaker/codemaker.cxx
+++ b/codemaker/source/codemaker/codemaker.cxx
@@ -17,36 +17,26 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
#include "sal/config.h"
#include "codemaker/codemaker.hxx"
-
-#include "codemaker/options.hxx"
-#include "codemaker/typemanager.hxx"
-#include "codemaker/unotype.hxx"
-
-#include "osl/diagnose.h"
-#include "registry/reader.hxx"
-#include "registry/types.h"
-#include "rtl/strbuf.h"
-#include "rtl/string.h"
+#include "codemaker/global.hxx"
#include "rtl/string.hxx"
+#include "rtl/textcvt.h"
+#include "rtl/textenc.h"
#include "rtl/ustring.hxx"
-#include "sal/types.h"
-
-#include <vector>
namespace codemaker {
-rtl::OString convertString(rtl::OUString const & string) {
- rtl::OString s;
+OString convertString(OUString const & string) {
+ OString s;
if (!string.convertToString(
&s, RTL_TEXTENCODING_UTF8,
(RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
| RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
{
- throw CannotDumpException("Failure converting string from UTF-16 to UTF-8");
+ throw CannotDumpException(
+ "Failure converting string from UTF-16 to UTF-8");
}
return s;
}
diff --git a/codemaker/source/codemaker/typemanager.cxx b/codemaker/source/codemaker/typemanager.cxx
index 5116aba904d4..ff0e6f92a259 100644
--- a/codemaker/source/codemaker/typemanager.cxx
+++ b/codemaker/source/codemaker/typemanager.cxx
@@ -21,306 +21,19 @@
#include <cstdlib>
#include <cstring>
+#include <vector>
-#include "rtl/alloc.h"
+#include "codemaker/global.hxx"
#include "codemaker/typemanager.hxx"
-#include "registry/reader.hxx"
-#include "registry/version.h"
+#include "rtl/ref.hxx"
+#include "rtl/ustring.hxx"
#include "unoidl/unoidl.hxx"
-using ::rtl::OUString;
-using ::rtl::OString;
-using ::rtl::OStringToOUString;
-using ::rtl::OUStringToOString;
+TypeManager::TypeManager(): manager_(new unoidl::Manager) {}
-TypeManager::TypeManager(): m_base("UCR"), manager_(new unoidl::Manager) {}
+TypeManager::~TypeManager() {}
-TypeManager::~TypeManager()
-{
- freeRegistries();
-}
-
-sal_Bool TypeManager::init(
- const StringVector& regFiles,
- StringVector const & extraFiles )
-{
- 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_registries.push_back(new Registry(tmpReg));
- else
- {
- freeRegistries();
- return sal_False;
- }
- ++iter;
- }
- iter = extraFiles.begin();
- while (iter != extraFiles.end())
- {
- if (!tmpReg.open( convertToFileUrl(*iter), REG_READONLY))
- m_extra_registries.push_back(new Registry(tmpReg));
- else
- {
- freeRegistries();
- return sal_False;
- }
- ++iter;
- }
-
- return sal_True;
-}
-
-::rtl::OString TypeManager::getTypeName(RegistryKey& rTypeKey) const
-{
- OString typeName = OUStringToOString(rTypeKey.getName(), RTL_TEXTENCODING_UTF8);
-
- if (m_base.getLength() > 1)
- typeName = typeName.copy(typeName.indexOf('/', 1) + 1);
- else
- typeName = typeName.copy(1);
-
- return typeName;
-}
-
-typereg::Reader TypeManager::getTypeReader(
- const OString& name, sal_Bool * pIsExtraType ) const
-{
- typereg::Reader reader;
- RegistryKey key(searchTypeKey(name, pIsExtraType));
-
- 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 = typereg::Reader(
- pBuffer, valueSize, true, TYPEREG_VERSION_1);
- }
- rtl_freeMemory(pBuffer);
- }
- }
- return reader;
-}
-
-typereg::Reader TypeManager::getTypeReader(RegistryKey& rTypeKey) const
-{
- typereg::Reader reader;
-
- if (rTypeKey.isValid())
- {
- RegValueType valueType;
- sal_uInt32 valueSize;
-
- if (!rTypeKey.getValueInfo(OUString(), &valueType, &valueSize))
- {
- sal_uInt8* pBuffer = (sal_uInt8*)rtl_allocateMemory(valueSize);
- if (!rTypeKey.getValue(OUString(), pBuffer))
- {
- reader = typereg::Reader(
- pBuffer, valueSize, true, TYPEREG_VERSION_1);
- }
- rtl_freeMemory(pBuffer);
- }
- }
- return reader;
-}
-
-
-RTTypeClass TypeManager::getTypeClass(const OString& name) const
-{
- if (m_t2TypeClass.count(name) > 0)
- {
- return 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))
- {
- typereg::Reader reader(
- pBuffer, valueSize, false, TYPEREG_VERSION_1);
-
- RTTypeClass ret = reader.getTypeClass();
-
- rtl_freeMemory(pBuffer);
-
- m_t2TypeClass[name] = ret;
- return ret;
- }
- rtl_freeMemory(pBuffer);
- }
- }
- }
-
- return RT_TYPE_INVALID;
-}
-
-RTTypeClass TypeManager::getTypeClass(RegistryKey& rTypeKey) const
-{
- OString name = getTypeName(rTypeKey);
-
- if (m_t2TypeClass.count(name) > 0)
- {
- return m_t2TypeClass[name];
- } else
- {
- if (rTypeKey.isValid())
- {
- RegValueType valueType;
- sal_uInt32 valueSize;
-
- if (!rTypeKey.getValueInfo(OUString(), &valueType, &valueSize))
- {
- sal_uInt8* pBuffer = (sal_uInt8*)rtl_allocateMemory(valueSize);
- if (!rTypeKey.getValue(OUString(), pBuffer))
- {
- typereg::Reader reader(
- pBuffer, valueSize, false, TYPEREG_VERSION_1);
-
- RTTypeClass ret = reader.getTypeClass();
-
- rtl_freeMemory(pBuffer);
-
- m_t2TypeClass[name] = ret;
- return ret;
- }
- rtl_freeMemory(pBuffer);
- }
- }
- }
-
- return RT_TYPE_INVALID;
-}
-
-void TypeManager::setBase(const OString& base)
-{
-
- if (base.lastIndexOf('/') == (base.getLength() - 1))
- m_base = base.copy(0, base.lastIndexOf('/') - 1);
- else
- m_base = base;
-}
-
-void TypeManager::freeRegistries()
-{
- RegistryList::const_iterator iter = m_registries.begin();
- while (iter != m_registries.end())
- {
- delete *iter;
- ++iter;
- }
- iter = m_extra_registries.begin();
- while (iter != m_extra_registries.end())
- {
- delete *iter;
- ++iter;
- }
-}
-
-RegistryKey TypeManager::searchTypeKey(const OString& name_, sal_Bool * pIsExtraType )
- const
-{
- OUString name( OStringToOUString(m_base + "/" + name_, RTL_TEXTENCODING_UTF8) );
- RegistryKey key, rootKey;
-
- RegistryList::const_iterator iter = m_registries.begin();
- while (iter != m_registries.end())
- {
- if (!(*iter)->openRootKey(rootKey))
- {
- if (!rootKey.openKey(name, key))
- {
- if (pIsExtraType)
- *pIsExtraType = sal_False;
- return key;
- }
- }
- ++iter;
- }
- iter = m_extra_registries.begin();
- while (iter != m_extra_registries.end())
- {
- if (!(*iter)->openRootKey(rootKey))
- {
- if (!rootKey.openKey(name, key))
- {
- if (pIsExtraType)
- *pIsExtraType = sal_True;
- break;
- }
- }
- ++iter;
- }
-
- return key;
-}
-
-RegistryKeyList TypeManager::getTypeKeys(const ::rtl::OString& name_) const
-{
- RegistryKeyList keyList= RegistryKeyList();
- OString tmpName;
- if ( name_ == "/" || name_ == m_base ) {
- tmpName = m_base;
- } else {
- if ( m_base == "/" )
- tmpName = name_;
- else
- tmpName = m_base + "/" + name_;
- }
-
- OUString name( OStringToOUString(tmpName, RTL_TEXTENCODING_UTF8) );
- RegistryKey key, rootKey;
-
- RegistryList::const_iterator iter = m_registries.begin();
- while (iter != m_registries.end())
- {
- if (!(*iter)->openRootKey(rootKey))
- {
- if (!rootKey.openKey(name, key))
- {
- keyList.push_back(KeyPair(key, sal_False));
- }
- }
- ++iter;
- }
- iter = m_extra_registries.begin();
- while (iter != m_extra_registries.end())
- {
- if (!(*iter)->openRootKey(rootKey))
- {
- if (!rootKey.openKey(name, key))
- {
- keyList.push_back(KeyPair(key, sal_True));
- }
- }
- ++iter;
- }
-
- return keyList;
-}
-
-
-void TypeManager::loadProvider(rtl::OUString const & uri, bool primary) {
+void TypeManager::loadProvider(OUString const & uri, bool primary) {
rtl::Reference< unoidl::Provider > prov(
unoidl::loadProvider(manager_, uri));
manager_->addProvider(prov);
@@ -329,7 +42,7 @@ void TypeManager::loadProvider(rtl::OUString const & uri, bool primary) {
}
}
-bool TypeManager::foundAtPrimaryProvider(rtl::OUString const & name) const {
+bool TypeManager::foundAtPrimaryProvider(OUString const & name) const {
if (name.isEmpty()) {
return !primaryProviders_.empty();
}
diff --git a/codemaker/source/codemaker/unotype.cxx b/codemaker/source/codemaker/unotype.cxx
index a0872ea33a37..5b76a04462b2 100644
--- a/codemaker/source/codemaker/unotype.cxx
+++ b/codemaker/source/codemaker/unotype.cxx
@@ -26,26 +26,6 @@
#include <vector>
-codemaker::UnoType::Sort codemaker::UnoType::getSort(OString const & type)
-{
- return type == "void" ? SORT_VOID
- : type == "boolean" ? SORT_BOOLEAN
- : type == "byte" ? SORT_BYTE
- : type == "short" ? SORT_SHORT
- : type == "unsigned short" ? SORT_UNSIGNED_SHORT
- : type == "long" ? SORT_LONG
- : type == "unsigned long" ? SORT_UNSIGNED_LONG
- : type == "hyper" ? SORT_HYPER
- : type == "unsigned hyper" ? SORT_UNSIGNED_HYPER
- : type == "float" ? SORT_FLOAT
- : type == "double" ? SORT_DOUBLE
- : type == "char" ? SORT_CHAR
- : type == "string" ? SORT_STRING
- : type == "type" ? SORT_TYPE
- : type == "any" ? SORT_ANY
- : SORT_COMPLEX;
-}
-
OString codemaker::UnoType::decompose(
OString const & type, sal_Int32 * rank,
std::vector< OString > * arguments)
diff --git a/codemaker/source/commoncpp/commoncpp.cxx b/codemaker/source/commoncpp/commoncpp.cxx
index 295488d28890..5d8d79bb3f49 100644
--- a/codemaker/source/commoncpp/commoncpp.cxx
+++ b/codemaker/source/commoncpp/commoncpp.cxx
@@ -26,8 +26,6 @@
#include "codemaker/unotype.hxx"
#include "osl/diagnose.h"
-#include "registry/reader.hxx"
-#include "registry/types.h"
#include "rtl/strbuf.hxx"
#include "rtl/string.hxx"
#include "rtl/ustring.hxx"
diff --git a/codemaker/source/commonjava/commonjava.cxx b/codemaker/source/commonjava/commonjava.cxx
index 84722d5908e0..20bdce402e51 100644
--- a/codemaker/source/commonjava/commonjava.cxx
+++ b/codemaker/source/commonjava/commonjava.cxx
@@ -27,8 +27,6 @@
#include "codemaker/unotype.hxx"
#include "osl/diagnose.h"
-#include "registry/reader.hxx"
-#include "registry/types.h"
#include "rtl/strbuf.h"
#include "rtl/string.h"
#include "rtl/string.hxx"
diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx
index 7540c02ed57c..8411f58a7702 100755
--- a/codemaker/source/cppumaker/cpputype.cxx
+++ b/codemaker/source/cppumaker/cpputype.cxx
@@ -3357,9 +3357,9 @@ void ServiceType::dumpHxxFile(
i->parameters.begin());
j != i->parameters.end(); ++j)
{
- if (codemaker::UnoType::getSort(
- codemaker::UnoType::decompose(
- u2b(j->type), 0, 0))
+ if (m_typeMgr->getSort(
+ b2u(codemaker::UnoType::decompose(
+ u2b(j->type), 0, 0)))
== codemaker::UnoType::SORT_CHAR)
{
includes.addCppuUnotypeHxx();
@@ -3506,9 +3506,9 @@ void ServiceType::dumpHxxFile(
u2b(j->name), "param",
codemaker::cpp::ITM_NONGLOBAL));
sal_Int32 rank;
- if (codemaker::UnoType::getSort(
- codemaker::UnoType::decompose(
- u2b(j->type), &rank, 0))
+ if (m_typeMgr->getSort(
+ b2u(codemaker::UnoType::decompose(
+ u2b(j->type), &rank, 0)))
== codemaker::UnoType::SORT_CHAR)
{
o << "= ::com::sun::star::uno::Any(&" << param
diff --git a/codemaker/source/cppumaker/dependencies.cxx b/codemaker/source/cppumaker/dependencies.cxx
index 35a4ab37cd86..82ae4a1de026 100644
--- a/codemaker/source/cppumaker/dependencies.cxx
+++ b/codemaker/source/cppumaker/dependencies.cxx
@@ -23,6 +23,7 @@
#include <utility>
#include <vector>
+#include "codemaker/global.hxx"
#include "codemaker/typemanager.hxx"
#include "codemaker/unotype.hxx"
diff --git a/codemaker/source/javamaker/javamaker.cxx b/codemaker/source/javamaker/javamaker.cxx
index 9250153be6fd..2b1a9d5c020a 100644
--- a/codemaker/source/javamaker/javamaker.cxx
+++ b/codemaker/source/javamaker/javamaker.cxx
@@ -48,12 +48,6 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
}
try {
rtl::Reference< TypeManager > typeMgr(new TypeManager);
- if (!typeMgr->init(
- options.getInputFiles(), options.getExtraInputFiles()))
- {
- std::cerr << "Initialization of registries failed\n";
- return EXIT_FAILURE;
- }
for (std::vector< rtl::OString >::const_iterator i(
options.getExtraInputFiles().begin());
i != options.getExtraInputFiles().end(); ++i)
diff --git a/codemaker/source/javamaker/javatype.cxx b/codemaker/source/javamaker/javatype.cxx
index 3bd6ef4cc6d9..6f3186632fe1 100644
--- a/codemaker/source/javamaker/javatype.cxx
+++ b/codemaker/source/javamaker/javatype.cxx
@@ -28,6 +28,7 @@
#include <utility>
#include <vector>
+#include "codemaker/codemaker.hxx"
#include "codemaker/exceptiontree.hxx"
#include "codemaker/generatedtypeset.hxx"
#include "codemaker/global.hxx"