summaryrefslogtreecommitdiff
path: root/codemaker/source/codemaker/exceptiontree.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-04-08 08:45:37 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-04-09 09:44:33 +0200
commit02a8e8acd1f0cbb512868fd9849363f9d069db95 (patch)
treece8a68631b45d663d583646c89d3aaaeb2a4e402 /codemaker/source/codemaker/exceptiontree.cxx
parent209d6a0fcca942a0168eb10ca3ab8f5f0d2ba9be (diff)
[API CHANGE] WIP: Experimental new binary type.rdb format
Make cppumaker work on top of unoidl/ instead of registry/, as a first step to change all the various codemakers. * API CHANGE: cppumaker no longer supports the -B switch, as that is meaningless with the new format. When reading from an old-format .rdb file, /UCR is hard-coded as the prefix now. * TODO: The new format does not yet support deprecation annotations, so the generated .hdl/.hpp files lack any SAL_DEPRECATED_INTERNALs for now. * codemaker/typemanager.hxx is extended with access to unoidl/ functionality, so the various codemakers can use registry/ and unoidl/ in parallel for now. The access to registry/ functionality will be removed. (Added small throwaway helper functions u2b/b2u to easily map between OString and OUString at the remaining seams for now.) * Includes a selective revert of ba044b1e9613ed30906a9a540b7da8392923e4e3 "remove needless forward rtl::OUString declarations" in those parts of codemaker, unodevtools, unoidl that were covered by this local work-in-progress patch; I would otherwise have hard a hard time re-applying it. * The generated .hdl/.hpp files are mostly unchanged, except for a few minor things: ** Any SAL_DEPRECATED_INTERNALs are missing (see above). ** In comprehensive getCppuType definitions, some members were erroneously classified as TypeCalss_UNKNOWN. ** In comprehensive getCppuType definitions, some unnecessary calls like ::cppu::UnoType< ::sal_Int32 >::get(); can be removed. ** For typedef sequence<X>, the .hdl file need not include X.hdl, but only needs to forward-declare it. ** Unnecessary includes for optional bases of interfaces can be removed. ** Some numbering of local variable names (sMethodName1, ...) has changed. Change-Id: Icad98f248ac15177337f1b4ab709a755a8af6238
Diffstat (limited to 'codemaker/source/codemaker/exceptiontree.cxx')
-rw-r--r--codemaker/source/codemaker/exceptiontree.cxx42
1 files changed, 19 insertions, 23 deletions
diff --git a/codemaker/source/codemaker/exceptiontree.cxx b/codemaker/source/codemaker/exceptiontree.cxx
index 1b4915b65224..f8dd868f9180 100644
--- a/codemaker/source/codemaker/exceptiontree.cxx
+++ b/codemaker/source/codemaker/exceptiontree.cxx
@@ -22,11 +22,11 @@
#include "codemaker/typemanager.hxx"
#include "osl/diagnose.h"
-#include "registry/reader.hxx"
-#include "registry/types.h"
+#include "rtl/ref.hxx"
#include "rtl/string.hxx"
#include "rtl/textenc.h"
#include "rtl/ustring.hxx"
+#include "unoidl/unoidl.hxx"
#include <memory>
#include <vector>
@@ -34,7 +34,7 @@
using codemaker::ExceptionTree;
using codemaker::ExceptionTreeNode;
-ExceptionTreeNode * ExceptionTreeNode::add(OString const & theName) {
+ExceptionTreeNode * ExceptionTreeNode::add(rtl::OString const & theName) {
std::auto_ptr< ExceptionTreeNode > node(new ExceptionTreeNode(theName));
children.push_back(node.get());
return node.release();
@@ -48,34 +48,30 @@ void ExceptionTreeNode::clearChildren() {
}
void ExceptionTree::add(
- OString const & name, rtl::Reference< TypeManager > const & manager)
- throw( CannotDumpException )
+ rtl::OString const & name, rtl::Reference< TypeManager > const & manager)
{
- typedef std::vector< OString > OStringList;
- OStringList stringlist;
+ std::vector< rtl::OString > list;
bool runtimeException = false;
- for (OString n(name); n != "com/sun/star/uno/Exception";) {
- if (n == "com/sun/star/uno/RuntimeException") {
+ for (rtl::OString n(name); n != "com.sun.star.uno.Exception";) {
+ if (n == "com.sun.star.uno.RuntimeException") {
runtimeException = true;
break;
}
- stringlist.push_back(n);
- typereg::Reader reader(manager->getTypeReader(n));
- if (!reader.isValid())
- throw CannotDumpException(
- OString("Unknown type '" + n.replace('/', '.')
- + "', incomplete type library."));
-
- OSL_ASSERT(
- reader.getTypeClass() == RT_TYPE_EXCEPTION
- && reader.getSuperTypeCount() == 1);
- n = OUStringToOString(
- reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8);
+ list.push_back(n);
+ rtl::Reference< unoidl::Entity > ent;
+ codemaker::UnoType::Sort s = manager->getSort(b2u(n), &ent);
+ assert(s == codemaker::UnoType::SORT_EXCEPTION_TYPE);
+ n = u2b(
+ static_cast< unoidl::ExceptionTypeEntity * >(ent.get())->
+ getDirectBase());
+ assert(!n.isEmpty());
}
if (!runtimeException) {
ExceptionTreeNode * node = &m_root;
- for (OStringList::reverse_iterator i(stringlist.rbegin()); !node->present; ++i) {
- if (i == stringlist.rend()) {
+ for (std::vector< rtl::OString >::reverse_iterator i(list.rbegin());
+ !node->present; ++i)
+ {
+ if (i == list.rend()) {
node->setPresent();
break;
}