1*2fe1ca3dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*2fe1ca3dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*2fe1ca3dSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*2fe1ca3dSAndrew Rist * distributed with this work for additional information
6*2fe1ca3dSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*2fe1ca3dSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*2fe1ca3dSAndrew Rist * "License"); you may not use this file except in compliance
9*2fe1ca3dSAndrew Rist * with the License. You may obtain a copy of the License at
10*2fe1ca3dSAndrew Rist *
11*2fe1ca3dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*2fe1ca3dSAndrew Rist *
13*2fe1ca3dSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*2fe1ca3dSAndrew Rist * software distributed under the License is distributed on an
15*2fe1ca3dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2fe1ca3dSAndrew Rist * KIND, either express or implied. See the License for the
17*2fe1ca3dSAndrew Rist * specific language governing permissions and limitations
18*2fe1ca3dSAndrew Rist * under the License.
19*2fe1ca3dSAndrew Rist *
20*2fe1ca3dSAndrew Rist *************************************************************/
21*2fe1ca3dSAndrew Rist
22*2fe1ca3dSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_idlc.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "idlc/aststructinstance.hxx"
28cdf0e10cSrcweir
29cdf0e10cSrcweir #include "idlc/asttype.hxx"
30cdf0e10cSrcweir #include "idlc/idlctypes.hxx"
31cdf0e10cSrcweir
32cdf0e10cSrcweir #include "rtl/strbuf.hxx"
33cdf0e10cSrcweir #include "rtl/string.hxx"
34cdf0e10cSrcweir
35cdf0e10cSrcweir namespace {
36cdf0e10cSrcweir
createName(AstType const * typeTemplate,DeclList const * typeArguments)37cdf0e10cSrcweir rtl::OString createName(
38cdf0e10cSrcweir AstType const * typeTemplate, DeclList const * typeArguments)
39cdf0e10cSrcweir {
40cdf0e10cSrcweir rtl::OStringBuffer buf(typeTemplate->getScopedName());
41cdf0e10cSrcweir if (typeArguments != 0) {
42cdf0e10cSrcweir buf.append('<');
43cdf0e10cSrcweir for (DeclList::const_iterator i(typeArguments->begin());
44cdf0e10cSrcweir i != typeArguments->end(); ++i)
45cdf0e10cSrcweir {
46cdf0e10cSrcweir if (i != typeArguments->begin()) {
47cdf0e10cSrcweir buf.append(',');
48cdf0e10cSrcweir }
49cdf0e10cSrcweir if (*i != 0) {
50cdf0e10cSrcweir buf.append((*i)->getScopedName());
51cdf0e10cSrcweir }
52cdf0e10cSrcweir }
53cdf0e10cSrcweir buf.append('>');
54cdf0e10cSrcweir }
55cdf0e10cSrcweir return buf.makeStringAndClear();
56cdf0e10cSrcweir }
57cdf0e10cSrcweir
58cdf0e10cSrcweir }
59cdf0e10cSrcweir
AstStructInstance(AstType const * typeTemplate,DeclList const * typeArguments,AstScope * scope)60cdf0e10cSrcweir AstStructInstance::AstStructInstance(
61cdf0e10cSrcweir AstType const * typeTemplate, DeclList const * typeArguments,
62cdf0e10cSrcweir AstScope * scope):
63cdf0e10cSrcweir AstType(
64cdf0e10cSrcweir NT_instantiated_struct, createName(typeTemplate, typeArguments), scope),
65cdf0e10cSrcweir m_typeTemplate(typeTemplate), m_typeArguments(*typeArguments)
66cdf0e10cSrcweir {}
67