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 10cdf0e10cSrcweir * 11*2fe1ca3dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 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. 19cdf0e10cSrcweir * 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 #include <idlc/astarray.hxx> 27cdf0e10cSrcweir 28cdf0e10cSrcweir using namespace ::rtl; 29cdf0e10cSrcweir 30cdf0e10cSrcweir AstArray::AstArray(const OString& name, AstType* pType, const ExprList& rDimExpr, AstScope* pScope) 31cdf0e10cSrcweir : AstType(NT_array, name, pScope) 32cdf0e10cSrcweir , m_pType(pType) 33cdf0e10cSrcweir , m_dimension((sal_uInt32)(rDimExpr.size())) 34cdf0e10cSrcweir , m_dimExpressions(rDimExpr) 35cdf0e10cSrcweir { 36cdf0e10cSrcweir if ( m_pType ) 37cdf0e10cSrcweir setName(makeName()); 38cdf0e10cSrcweir } 39cdf0e10cSrcweir 40cdf0e10cSrcweir AstArray::AstArray(AstType* pType, const ExprList& rDimExpr, AstScope* pScope) 41cdf0e10cSrcweir : AstType(NT_array, OString("arrary_"), pScope) 42cdf0e10cSrcweir , m_pType(pType) 43cdf0e10cSrcweir , m_dimension((sal_uInt32)(rDimExpr.size())) 44cdf0e10cSrcweir , m_dimExpressions(rDimExpr) 45cdf0e10cSrcweir { 46cdf0e10cSrcweir if ( m_pType ) 47cdf0e10cSrcweir setName(makeName()); 48cdf0e10cSrcweir } 49cdf0e10cSrcweir 50cdf0e10cSrcweir OString AstArray::makeName() 51cdf0e10cSrcweir { 52cdf0e10cSrcweir if ( m_pType ) 53cdf0e10cSrcweir { 54cdf0e10cSrcweir OString name(m_pType->getScopedName()); 55cdf0e10cSrcweir OString openBracket("["); 56cdf0e10cSrcweir OString closeBracket("]"); 57cdf0e10cSrcweir ExprList::iterator iter = m_dimExpressions.begin(); 58cdf0e10cSrcweir ExprList::iterator end = m_dimExpressions.end(); 59cdf0e10cSrcweir 60cdf0e10cSrcweir while ( iter != end ) 61cdf0e10cSrcweir { 62cdf0e10cSrcweir name += openBracket; 63cdf0e10cSrcweir name += (*iter)->toString(); 64cdf0e10cSrcweir name += closeBracket; 65cdf0e10cSrcweir ++iter; 66cdf0e10cSrcweir } 67cdf0e10cSrcweir return name; 68cdf0e10cSrcweir } 69cdf0e10cSrcweir return OString(); 70cdf0e10cSrcweir } 71