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