1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #include <precomp.h> 29 #include <ary/doc/d_oldcppdocu.hxx> 30 31 32 // NOT FULLY DEFINED SERVICES 33 #include <ary/info/all_tags.hxx> 34 #include <ary/info/docstore.hxx> 35 #include <ary/info/infodisp.hxx> 36 #include <docu_node_ids.hxx> 37 38 39 40 41 namespace ary 42 { 43 namespace doc 44 { 45 46 using namespace info; 47 48 49 50 51 unsigned char C_ucNO_INDEX = 255; 52 typedef DYN StdTag * (F_CREATE)(); 53 54 55 OldCppDocu::OldCppDocu() 56 : Node(docnt::nt_OldCppDocu), 57 bIsObsolete(false), 58 bIsInternal(false), 59 bIsInterface(false) 60 { 61 memset( nTags, C_ucNO_INDEX, size_t(C_eAtTag_NrOfClasses) ); 62 } 63 64 OldCppDocu::~OldCppDocu() 65 { 66 } 67 68 void 69 OldCppDocu::Store2( info::DocuStore & o_rDocuStore ) 70 { 71 o_rDocuStore.Store2ConnectedDeclaration(*this); 72 } 73 74 AtTag * 75 OldCppDocu::Create_StdTag( E_AtTagId i_eId ) 76 { 77 UINT8 nIndex = static_cast<UINT8>(i_eId); 78 if ( nTags[nIndex] == C_ucNO_INDEX ) 79 { 80 AtTag * ret = new StdTag(i_eId); 81 NewTag(nIndex) = ret; 82 return ret; 83 } 84 else 85 { 86 return GetTag(nIndex).GetFollower(); 87 } 88 } 89 90 AtTag * 91 OldCppDocu::CheckIn_BaseTag() 92 { 93 UINT8 nIndex = atc_base; 94 if ( nTags[nIndex] == C_ucNO_INDEX ) 95 { 96 AtTag * ret = new BaseTag(); 97 NewTag(nIndex) = ret; 98 return ret; 99 } 100 else 101 { 102 return GetTag(nIndex).GetFollower(); 103 } 104 } 105 106 AtTag * 107 OldCppDocu::CheckIn_ExceptionTag() 108 { 109 UINT8 nIndex = atc_exception; 110 if ( nTags[nIndex] == C_ucNO_INDEX ) 111 { 112 AtTag * ret = new ExceptionTag(); 113 NewTag(nIndex) = ret; 114 return ret; 115 } 116 else 117 { 118 return GetTag(nIndex).GetFollower(); 119 } 120 } 121 122 AtTag * 123 OldCppDocu::Create_ImplementsTag() 124 { 125 UINT8 nIndex = atc_implements; 126 if ( nTags[nIndex] == C_ucNO_INDEX ) 127 { 128 AtTag * ret = new ImplementsTag(); 129 NewTag(nIndex) = ret; 130 return ret; 131 } 132 else 133 { 134 return GetTag(nIndex).GetFollower(); 135 } 136 } 137 138 AtTag * 139 OldCppDocu::Create_KeywordTag() 140 { 141 UINT8 nIndex = atc_keyword; 142 if ( nTags[nIndex] == C_ucNO_INDEX ) 143 { 144 AtTag * ret = new KeywordTag(); 145 NewTag(nIndex) = ret; 146 return ret; 147 } 148 else 149 { 150 return GetTag(nIndex).GetFollower(); 151 } 152 } 153 154 AtTag * 155 OldCppDocu::CheckIn_ParameterTag() 156 { 157 UINT8 nIndex = atc_parameter; 158 if ( nTags[nIndex] == C_ucNO_INDEX ) 159 { 160 AtTag * ret = new ParameterTag(); 161 NewTag(nIndex) = ret; 162 return ret; 163 } 164 else 165 { 166 return GetTag(nIndex).GetFollower(); 167 } 168 } 169 170 AtTag * 171 OldCppDocu::CheckIn_SeeTag() 172 { 173 UINT8 nIndex = atc_see; 174 if ( nTags[nIndex] == C_ucNO_INDEX ) 175 { 176 AtTag * ret = new SeeTag(); 177 NewTag(nIndex) = ret; 178 return ret; 179 } 180 else 181 { 182 return GetTag(nIndex).GetFollower(); 183 } 184 } 185 186 AtTag * 187 OldCppDocu::CheckIn_TemplateTag() 188 { 189 UINT8 nIndex = atc_template; 190 if ( nTags[nIndex] == C_ucNO_INDEX ) 191 { 192 AtTag * ret = new TemplateTag(); 193 NewTag(nIndex) = ret; 194 return ret; 195 } 196 else 197 { 198 return GetTag(nIndex).GetFollower(); 199 } 200 } 201 202 AtTag * 203 OldCppDocu::Create_LabelTag() 204 { 205 UINT8 nIndex = atc_label; 206 if ( nTags[nIndex] == C_ucNO_INDEX ) 207 { 208 AtTag * ret = new LabelTag(); 209 NewTag(nIndex) = ret; 210 return ret; 211 } 212 else 213 { 214 return GetTag(nIndex).GetFollower(); 215 } 216 } 217 218 AtTag * 219 OldCppDocu::Create_DefaultTag() 220 { 221 UINT8 nIndex = atid_descr; 222 if ( nTags[nIndex] == C_ucNO_INDEX ) 223 { 224 AtTag * ret = new StdTag(atid_descr); 225 NewTag(nIndex) = ret; 226 return ret; 227 } 228 else 229 { 230 return GetTag(nIndex).GetFollower(); 231 } 232 } 233 234 AtTag * 235 OldCppDocu::Create_SinceTag() 236 { 237 UINT8 nIndex = atc_since; 238 if ( nTags[nIndex] == C_ucNO_INDEX ) 239 { 240 AtTag * ret = new SinceTag(); 241 NewTag(nIndex) = ret; 242 return ret; 243 } 244 else 245 { 246 return GetTag(nIndex).GetFollower(); 247 } 248 } 249 250 251 void 252 OldCppDocu::Replace_AtShort_By_AtDescr() 253 { 254 unsigned char nPosInTags = nTags[atid_short]; 255 if ( nPosInTags == C_ucNO_INDEX ) 256 return; 257 258 AtTag * pTag = aTags[ nPosInTags ]; 259 if ( pTag == 0 ) // Should be csv_assert(). 260 return; 261 262 csv_assert( dynamic_cast< StdTag* >(pTag) != 0 ); 263 StdTag * pStdTag = static_cast< StdTag* >(pTag); 264 265 pStdTag->ChangeId2(atid_descr); 266 nTags[atid_short] = C_ucNO_INDEX; 267 nTags[atid_descr] = nPosInTags; 268 } 269 270 void 271 OldCppDocu::Set_Obsolete() 272 { 273 bIsObsolete = true; 274 } 275 276 void 277 OldCppDocu::Set_Internal() 278 { 279 bIsInternal = true; 280 } 281 282 const AtTag & 283 OldCppDocu::Short() const 284 { 285 static const StdTag aNull_(atid_short); 286 287 unsigned char nPosInTags = nTags[atid_short]; 288 if ( nPosInTags != C_ucNO_INDEX ) 289 { 290 AtTag * pTag = aTags[ nPosInTags ]; 291 if ( pTag != 0 ) // Should be csv_assert(). 292 { 293 return *pTag; 294 } 295 } 296 297 return aNull_; 298 } 299 300 AtTag * & 301 OldCppDocu::NewTag(UINT8 i_nIndex) 302 { 303 nTags[i_nIndex] = static_cast<UINT8>(aTags.size()); 304 aTags.push_back(0); 305 return aTags.back(); 306 } 307 308 AtTag & 309 OldCppDocu::GetTag( UINT8 i_nIndex ) 310 { 311 csv_assert( i_nIndex < C_eAtTag_NrOfClasses ); 312 csv_assert( nTags[i_nIndex] != C_ucNO_INDEX ); 313 csv_assert( aTags[nTags[i_nIndex]] != 0 ); 314 return * aTags[nTags[i_nIndex]]; 315 } 316 317 bool 318 OldCppDocu::IsInternal() const 319 { 320 return bIsInternal; 321 } 322 323 bool 324 OldCppDocu::IsInterface() const 325 { 326 return bIsInterface; 327 } 328 329 void 330 OldCppDocu::do_Accept(csv::ProcessorIfc & io_processor) const 331 { 332 csv::CheckedCall(io_processor, *this); 333 } 334 335 } // namespace doc 336 } // namespace ary 337