summaryrefslogtreecommitdiff
path: root/codemaker
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-04-16 13:48:49 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-04-16 13:52:29 +0200
commit30a7c6ba6b95ade8e59f9e28108470165dc9a175 (patch)
treef62070e3ab38f92df50d36a48c59751553c71444 /codemaker
parent24aeeb016323821b7eba6ab78a4dcf5e7ebb157a (diff)
WIP: Experimental new binary type.rdb format
Make uno-skeletonmaker work on top of unoidl/ instead of registry/. These changes have only been tested so far rather lightly. Basic uno-skeletonmaker still works, but more thorough testing of the various input flags is needed. Change-Id: Id7f3aee863a10f8c649325db2d6f34a4057f70ff
Diffstat (limited to 'codemaker')
-rw-r--r--codemaker/inc/codemaker/codemaker.hxx6
-rw-r--r--codemaker/inc/codemaker/commoncpp.hxx3
-rw-r--r--codemaker/source/codemaker/codemaker.cxx87
-rw-r--r--codemaker/source/commoncpp/commoncpp.cxx32
4 files changed, 12 insertions, 116 deletions
diff --git a/codemaker/inc/codemaker/codemaker.hxx b/codemaker/inc/codemaker/codemaker.hxx
index a1c3a14eea6c..c952c368b354 100644
--- a/codemaker/inc/codemaker/codemaker.hxx
+++ b/codemaker/inc/codemaker/codemaker.hxx
@@ -38,12 +38,6 @@ namespace codemaker {
rtl::OString convertString(rtl::OUString const & string);
-codemaker::UnoType::Sort decomposeAndResolve(
- rtl::Reference< TypeManager > const & manager, rtl::OString const & type,
- bool resolveTypedefs, bool allowVoid, bool allowExtraEntities,
- RTTypeClass * typeClass, rtl::OString * name, sal_Int32 * rank,
- std::vector< rtl::OString > * arguments);
-
}
#endif // INCLUDED_CODEMAKER_CODEMAKER_HXX
diff --git a/codemaker/inc/codemaker/commoncpp.hxx b/codemaker/inc/codemaker/commoncpp.hxx
index 3cfd7133c0f1..9eafb91b4ee0 100644
--- a/codemaker/inc/codemaker/commoncpp.hxx
+++ b/codemaker/inc/codemaker/commoncpp.hxx
@@ -36,8 +36,7 @@ namespace codemaker { namespace cpp {
rtl::OString scopedCppName(rtl::OString const & type, bool ns_alias=true);
rtl::OString translateUnoToCppType(
- codemaker::UnoType::Sort sort, RTTypeClass typeClass,
- rtl::OString const & nucleus, bool shortname);
+ codemaker::UnoType::Sort sort, rtl::OUString const & nucleus);
enum IdentifierTranslationMode {
ITM_GLOBAL,
diff --git a/codemaker/source/codemaker/codemaker.cxx b/codemaker/source/codemaker/codemaker.cxx
index 2ed28e12da34..c9f7e0b7f53c 100644
--- a/codemaker/source/codemaker/codemaker.cxx
+++ b/codemaker/source/codemaker/codemaker.cxx
@@ -62,93 +62,6 @@ rtl::OString convertString(rtl::OUString const & string) {
return s;
}
-codemaker::UnoType::Sort decomposeAndResolve(
- rtl::Reference< TypeManager > const & manager, rtl::OString const & type,
- bool resolveTypedefs, bool allowVoid, bool allowExtraEntities,
- RTTypeClass * typeClass, rtl::OString * name, sal_Int32 * rank,
- std::vector< rtl::OString > * arguments)
-{
- OSL_ASSERT(typeClass != 0 && name != 0 && rank != 0 && arguments != 0);
- *rank = 0;
- for (rtl::OString t(type);;) {
- sal_Int32 n = 0;
- *name = codemaker::UnoType::decompose(t, &n, arguments);
- if (n > SAL_MAX_INT32 - *rank) {
- throw CannotDumpException("Bad type information: " + b2u(type));
- //TODO
- }
- *rank += n;
- if (n > 0) {
- allowVoid = false;
- allowExtraEntities = false;
- }
- codemaker::UnoType::Sort sort = codemaker::UnoType::getSort(*name);
- switch (sort) {
- case codemaker::UnoType::SORT_VOID:
- if (!allowVoid) {
- throw CannotDumpException("Bad type information: " + b2u(type));
- //TODO
- }
- default:
- checkNoTypeArguments(*arguments);
- *typeClass = RT_TYPE_INVALID;
- return sort;
-
- case codemaker::UnoType::SORT_COMPLEX:
- typereg::Reader reader(manager->getTypeReader(*name));
- *typeClass = reader.getTypeClass();
- switch (*typeClass) {
- case RT_TYPE_ENUM:
- case RT_TYPE_INTERFACE:
- checkNoTypeArguments(*arguments);
- return sort;
-
- case RT_TYPE_STRUCT:
- if (!(allowExtraEntities && arguments->empty())
- && (arguments->size() > SAL_MAX_UINT16
- || (static_cast< sal_uInt16 >(arguments->size())
- != reader.getReferenceCount())))
- {
- throw CannotDumpException("Bad type information: " + b2u(type));
- //TODO
- }
- return sort;
-
- case RT_TYPE_MODULE:
- case RT_TYPE_EXCEPTION:
- case RT_TYPE_SERVICE:
- case RT_TYPE_SINGLETON:
- case RT_TYPE_CONSTANTS:
- if (!allowExtraEntities) {
- throw CannotDumpException("Bad type information: " + b2u(type));
- //TODO
- }
- checkNoTypeArguments(*arguments);
- //TODO: check reader for consistency
- return sort;
-
- case RT_TYPE_TYPEDEF:
- checkNoTypeArguments(*arguments);
- if (reader.getSuperTypeCount() == 1
- && reader.getFieldCount() == 0
- && reader.getMethodCount() == 0
- && reader.getReferenceCount() == 0)
- {
- if (resolveTypedefs) {
- t = convertString(reader.getSuperTypeName(0));
- continue;
- } else {
- return sort;
- }
- }
- default:
- throw CannotDumpException("Bad type information: " + b2u(type));
- //TODO
- }
- }
- }
-}
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/codemaker/source/commoncpp/commoncpp.cxx b/codemaker/source/commoncpp/commoncpp.cxx
index 6f530409f745..295488d28890 100644
--- a/codemaker/source/commoncpp/commoncpp.cxx
+++ b/codemaker/source/commoncpp/commoncpp.cxx
@@ -67,36 +67,26 @@ OString scopedCppName(OString const & type, bool ns_alias)
OString translateUnoToCppType(
- codemaker::UnoType::Sort sort, RTTypeClass typeClass,
- OString const & nucleus, bool shortname)
+ codemaker::UnoType::Sort sort, OUString const & nucleus)
{
OStringBuffer buf;
- if (sort == codemaker::UnoType::SORT_COMPLEX) {
- if (typeClass == RT_TYPE_INTERFACE
- && nucleus == OString("com/sun/star/uno/XInterface"))
- {
- buf.append("::com::sun::star::uno::XInterface");
- } else {
- //TODO: check that nucleus is a valid (UTF-8) identifier
- buf.append(nucleus);
- }
- } else {
+ if (sort <= codemaker::UnoType::SORT_ANY) {
static char const * const cppTypes[codemaker::UnoType::SORT_ANY + 1] = {
"void", "::sal_Bool", "::sal_Int8", "::sal_Int16", "::sal_uInt16",
"::sal_Int32", "::sal_uInt32", "::sal_Int64", "::sal_uInt64",
"float", "double", "::sal_Unicode", "rtl::OUString",
"::com::sun::star::uno::Type", "::com::sun::star::uno::Any" };
buf.append(cppTypes[sort]);
+ } else {
+ if (sort == codemaker::UnoType::SORT_INTERFACE_TYPE
+ && nucleus == "com.sun.star.uno.XInterface")
+ {
+ buf.append("::com::sun::star::uno::XInterface");
+ } else {
+ //TODO: check that nucleus is a valid (UTF-8) identifier
+ buf.append(u2b(nucleus));
+ }
}
-
- if (shortname) {
- OString s(buf.makeStringAndClear());
- if (s.indexOf("::com::sun::star") == 0)
- return s.replaceAt(0, 16, "css");
- else
- return s;
- }
-
return buf.makeStringAndClear();
}