1*0841af79SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*0841af79SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*0841af79SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*0841af79SAndrew Rist * distributed with this work for additional information 6*0841af79SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*0841af79SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*0841af79SAndrew Rist * "License"); you may not use this file except in compliance 9*0841af79SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*0841af79SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*0841af79SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*0841af79SAndrew Rist * software distributed under the License is distributed on an 15*0841af79SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*0841af79SAndrew Rist * KIND, either express or implied. See the License for the 17*0841af79SAndrew Rist * specific language governing permissions and limitations 18*0841af79SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*0841af79SAndrew Rist *************************************************************/ 21cdf0e10cSrcweir 22cdf0e10cSrcweir #include <precomp.h> 23cdf0e10cSrcweir #include "protarea.hxx" 24cdf0e10cSrcweir 25cdf0e10cSrcweir 26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES 27cdf0e10cSrcweir #include "hdimpl.hxx" 28cdf0e10cSrcweir 29cdf0e10cSrcweir 30cdf0e10cSrcweir inline UINT8 31cdf0e10cSrcweir ProtectionArea::Index( ary::cpp::E_ClassKey i_eClassKey ) const 32cdf0e10cSrcweir { 33cdf0e10cSrcweir return i_eClassKey == ary::cpp::CK_class 34cdf0e10cSrcweir ? 0 35cdf0e10cSrcweir : i_eClassKey == ary::cpp::CK_struct 36cdf0e10cSrcweir ? 1 37cdf0e10cSrcweir : 2; 38cdf0e10cSrcweir } 39cdf0e10cSrcweir 40cdf0e10cSrcweir 41cdf0e10cSrcweir 42cdf0e10cSrcweir ProtectionArea::ProtectionArea( const char * i_sLabel, 43cdf0e10cSrcweir const char * i_sTitle ) 44cdf0e10cSrcweir : pSglTable( new S_Slot_Table(i_sTitle) ), 45cdf0e10cSrcweir aClassesTables(), 46cdf0e10cSrcweir sLabel(i_sLabel) 47cdf0e10cSrcweir { 48cdf0e10cSrcweir } 49cdf0e10cSrcweir 50cdf0e10cSrcweir ProtectionArea::~ProtectionArea() 51cdf0e10cSrcweir { 52cdf0e10cSrcweir 53cdf0e10cSrcweir } 54cdf0e10cSrcweir 55cdf0e10cSrcweir csi::html::Table & 56cdf0e10cSrcweir ProtectionArea::GetTable() 57cdf0e10cSrcweir { 58cdf0e10cSrcweir csv_assert(pSglTable); 59cdf0e10cSrcweir 60cdf0e10cSrcweir return pSglTable->GetTable(); 61cdf0e10cSrcweir } 62cdf0e10cSrcweir 63cdf0e10cSrcweir csi::html::Table & 64cdf0e10cSrcweir ProtectionArea::GetTable( ary::cpp::E_ClassKey i_eClassKey ) 65cdf0e10cSrcweir { 66cdf0e10cSrcweir csv_assert(aClassesTables[Index(i_eClassKey)]); 67cdf0e10cSrcweir return aClassesTables[Index(i_eClassKey)]->GetTable(); 68cdf0e10cSrcweir } 69cdf0e10cSrcweir 70cdf0e10cSrcweir DYN csi::html::Table * 71cdf0e10cSrcweir ProtectionArea::ReleaseTable() 72cdf0e10cSrcweir { 73cdf0e10cSrcweir csv_assert(pSglTable); 74cdf0e10cSrcweir return pSglTable->ReleaseTable(); 75cdf0e10cSrcweir } 76cdf0e10cSrcweir 77cdf0e10cSrcweir DYN csi::html::Table * 78cdf0e10cSrcweir ProtectionArea::ReleaseTable( ary::cpp::E_ClassKey i_eClassKey ) 79cdf0e10cSrcweir { 80cdf0e10cSrcweir csv_assert(aClassesTables[Index(i_eClassKey)]); 81cdf0e10cSrcweir return aClassesTables[Index(i_eClassKey)]->ReleaseTable(); 82cdf0e10cSrcweir } 83cdf0e10cSrcweir 84cdf0e10cSrcweir const char * 85cdf0e10cSrcweir ProtectionArea::Label() const 86cdf0e10cSrcweir { 87cdf0e10cSrcweir return sLabel; 88cdf0e10cSrcweir } 89cdf0e10cSrcweir 90cdf0e10cSrcweir 91cdf0e10cSrcweir bool 92cdf0e10cSrcweir ProtectionArea::WasUsed_Area() const 93cdf0e10cSrcweir { 94cdf0e10cSrcweir if ( pSglTable ) 95cdf0e10cSrcweir { 96cdf0e10cSrcweir return pSglTable->WasUsed(); 97cdf0e10cSrcweir } 98cdf0e10cSrcweir 99cdf0e10cSrcweir typedef const Dyn<ProtectionArea::S_Slot_Table> cdyntab; 100cdf0e10cSrcweir 101cdf0e10cSrcweir // Workaround a maybe compiler bug in Solaris5-CC ? 102cdf0e10cSrcweir // should normally work without the cast, 103cdf0e10cSrcweir // because that is exactly the genuine type, given: 104cdf0e10cSrcweir return static_cast< cdyntab& >(aClassesTables[0])->WasUsed() 105cdf0e10cSrcweir OR static_cast< cdyntab& >(aClassesTables[1])->WasUsed() 106cdf0e10cSrcweir OR static_cast< cdyntab& >(aClassesTables[2])->WasUsed(); 107cdf0e10cSrcweir } 108cdf0e10cSrcweir 109cdf0e10cSrcweir //******************* S_Slot_Table **********************// 110cdf0e10cSrcweir 111cdf0e10cSrcweir ProtectionArea:: 112cdf0e10cSrcweir S_Slot_Table::S_Slot_Table(const char * i_sTitle) 113cdf0e10cSrcweir : sTableTitle(i_sTitle) 114cdf0e10cSrcweir { 115cdf0e10cSrcweir } 116cdf0e10cSrcweir 117cdf0e10cSrcweir ProtectionArea:: 118cdf0e10cSrcweir S_Slot_Table::~S_Slot_Table() 119cdf0e10cSrcweir { 120cdf0e10cSrcweir } 121cdf0e10cSrcweir 122cdf0e10cSrcweir csi::html::Table & 123cdf0e10cSrcweir ProtectionArea:: 124cdf0e10cSrcweir S_Slot_Table::GetTable() 125cdf0e10cSrcweir { 126cdf0e10cSrcweir return pTable 127cdf0e10cSrcweir ? *pTable 128cdf0e10cSrcweir : *( pTable = &Create_ChildListTable(sTableTitle) ); 129cdf0e10cSrcweir } 130cdf0e10cSrcweir 131cdf0e10cSrcweir 132cdf0e10cSrcweir 133