1ff7655f0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3ff7655f0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4ff7655f0SAndrew Rist * or more contributor license agreements. See the NOTICE file 5ff7655f0SAndrew Rist * distributed with this work for additional information 6ff7655f0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7ff7655f0SAndrew Rist * to you under the Apache License, Version 2.0 (the 8ff7655f0SAndrew Rist * "License"); you may not use this file except in compliance 9ff7655f0SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11ff7655f0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13ff7655f0SAndrew Rist * Unless required by applicable law or agreed to in writing, 14ff7655f0SAndrew Rist * software distributed under the License is distributed on an 15ff7655f0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16ff7655f0SAndrew Rist * KIND, either express or implied. See the License for the 17ff7655f0SAndrew Rist * specific language governing permissions and limitations 18ff7655f0SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20ff7655f0SAndrew Rist *************************************************************/ 21ff7655f0SAndrew Rist 22ff7655f0SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25*8f71f2daSDamjan Jovanovic #include "precompiled_cppumaker.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "dumputils.hxx" 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include "codemaker/global.hxx" 30cdf0e10cSrcweir #include "codemaker/commoncpp.hxx" 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include "rtl/ustring.hxx" 33cdf0e10cSrcweir #include "sal/types.h" 34cdf0e10cSrcweir 35cdf0e10cSrcweir 36cdf0e10cSrcweir namespace codemaker { namespace cppumaker { 37cdf0e10cSrcweir 38cdf0e10cSrcweir bool dumpNamespaceOpen( 39cdf0e10cSrcweir FileStream & out, rtl::OString const & registryType, bool fullModuleType) 40cdf0e10cSrcweir { 41cdf0e10cSrcweir bool output = false; 42cdf0e10cSrcweir if (registryType != "/") { 43cdf0e10cSrcweir bool first = true; 44cdf0e10cSrcweir for (sal_Int32 i = 0; i >= 0;) { 45cdf0e10cSrcweir rtl::OString id(registryType.getToken(0, '/', i)); 46cdf0e10cSrcweir if (fullModuleType || i >= 0) { 47cdf0e10cSrcweir if (!first) { 48cdf0e10cSrcweir out << " "; 49cdf0e10cSrcweir } 50cdf0e10cSrcweir out << "namespace " << id << " {"; 51cdf0e10cSrcweir first = false; 52cdf0e10cSrcweir output = true; 53cdf0e10cSrcweir } 54cdf0e10cSrcweir } 55cdf0e10cSrcweir } 56cdf0e10cSrcweir return output; 57cdf0e10cSrcweir } 58cdf0e10cSrcweir 59cdf0e10cSrcweir bool dumpNamespaceClose( 60cdf0e10cSrcweir FileStream & out, rtl::OString const & registryType, bool fullModuleType) 61cdf0e10cSrcweir { 62cdf0e10cSrcweir bool output = false; 63cdf0e10cSrcweir if (registryType != "/") { 64cdf0e10cSrcweir bool first = true; 65cdf0e10cSrcweir for (sal_Int32 i = 0; i >= 0;) { 66cdf0e10cSrcweir i = registryType.indexOf('/', i); 67cdf0e10cSrcweir if (i >= 0) { 68cdf0e10cSrcweir ++i; 69cdf0e10cSrcweir } 70cdf0e10cSrcweir if (fullModuleType || i >= 0) { 71cdf0e10cSrcweir if (!first) { 72cdf0e10cSrcweir out << " "; 73cdf0e10cSrcweir } 74cdf0e10cSrcweir out << "}"; 75cdf0e10cSrcweir first = false; 76cdf0e10cSrcweir output = true; 77cdf0e10cSrcweir } 78cdf0e10cSrcweir } 79cdf0e10cSrcweir } 80cdf0e10cSrcweir return output; 81cdf0e10cSrcweir } 82cdf0e10cSrcweir 83cdf0e10cSrcweir void dumpTypeIdentifier(FileStream & out, rtl::OString const & registryType) { 84cdf0e10cSrcweir out << registryType.copy(registryType.lastIndexOf('/') + 1); 85cdf0e10cSrcweir } 86cdf0e10cSrcweir 87cdf0e10cSrcweir } } 88