Files
libreoffice/codemaker/source/cppumaker/dumputils.cxx
Stephan Bergmann 02a8e8acd1 [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 ba044b1e96
  "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
2013-04-09 09:44:33 +02:00

80 lines
2.2 KiB
C++

/* -*- 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 "dumputils.hxx"
#include "codemaker/global.hxx"
#include "codemaker/commoncpp.hxx"
#include "rtl/ustring.hxx"
#include "sal/types.h"
namespace codemaker { namespace cppumaker {
bool dumpNamespaceOpen(
FileStream & out, rtl::OUString const & entityName, bool fullModuleType)
{
bool output = false;
bool first = true;
for (sal_Int32 i = 0; i >= 0;) {
rtl::OUString id(entityName.getToken(0, '.', i));
if (fullModuleType || i >= 0) {
if (!first) {
out << " ";
}
out << "namespace " << id << " {";
first = false;
output = true;
}
}
return output;
}
bool dumpNamespaceClose(
FileStream & out, rtl::OUString const & entityName, bool fullModuleType)
{
bool output = false;
bool first = true;
for (sal_Int32 i = 0; i >= 0;) {
i = entityName.indexOf('.', i);
if (i >= 0) {
++i;
}
if (fullModuleType || i >= 0) {
if (!first) {
out << " ";
}
out << "}";
first = false;
output = true;
}
}
return output;
}
void dumpTypeIdentifier(FileStream & out, rtl::OUString const & entityName) {
out << entityName.copy(entityName.lastIndexOf('.') + 1);
}
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */