1*ff7655f0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*ff7655f0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*ff7655f0SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*ff7655f0SAndrew Rist * distributed with this work for additional information
6*ff7655f0SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*ff7655f0SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*ff7655f0SAndrew Rist * "License"); you may not use this file except in compliance
9*ff7655f0SAndrew Rist * with the License. You may obtain a copy of the License at
10*ff7655f0SAndrew Rist *
11*ff7655f0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*ff7655f0SAndrew Rist *
13*ff7655f0SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*ff7655f0SAndrew Rist * software distributed under the License is distributed on an
15*ff7655f0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ff7655f0SAndrew Rist * KIND, either express or implied. See the License for the
17*ff7655f0SAndrew Rist * specific language governing permissions and limitations
18*ff7655f0SAndrew Rist * under the License.
19*ff7655f0SAndrew Rist *
20*ff7655f0SAndrew Rist *************************************************************/
21*ff7655f0SAndrew Rist
22*ff7655f0SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_codemaker.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
dumpNamespaceOpen(FileStream & out,rtl::OString const & registryType,bool fullModuleType)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
dumpNamespaceClose(FileStream & out,rtl::OString const & registryType,bool fullModuleType)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
dumpTypeIdentifier(FileStream & out,rtl::OString const & registryType)83cdf0e10cSrcweir void dumpTypeIdentifier(FileStream & out, rtl::OString const & registryType) {
84cdf0e10cSrcweir out << registryType.copy(registryType.lastIndexOf('/') + 1);
85cdf0e10cSrcweir }
86cdf0e10cSrcweir
87cdf0e10cSrcweir } }
88