update dev300-m58
[ooovba.git] / autodoc / source / ary / doc / d_oldcppdocu.cxx
blob820b48a22919e99bb266142ec2466c986354bf0e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: d_oldcppdocu.cxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <precomp.h>
32 #include <ary/doc/d_oldcppdocu.hxx>
35 // NOT FULLY DEFINED SERVICES
36 #include <ary/info/all_tags.hxx>
37 #include <ary/info/docstore.hxx>
38 #include <ary/info/infodisp.hxx>
39 #include <docu_node_ids.hxx>
44 namespace ary
46 namespace doc
49 using namespace info;
54 unsigned char C_ucNO_INDEX = 255;
55 typedef DYN StdTag * (F_CREATE)();
58 OldCppDocu::OldCppDocu()
59 : Node(docnt::nt_OldCppDocu),
60 bIsObsolete(false),
61 bIsInternal(false),
62 bIsInterface(false)
64 memset( nTags, C_ucNO_INDEX, size_t(C_eAtTag_NrOfClasses) );
67 OldCppDocu::~OldCppDocu()
71 void
72 OldCppDocu::Store2( info::DocuStore & o_rDocuStore )
74 o_rDocuStore.Store2ConnectedDeclaration(*this);
77 AtTag *
78 OldCppDocu::Create_StdTag( E_AtTagId i_eId )
80 UINT8 nIndex = static_cast<UINT8>(i_eId);
81 if ( nTags[nIndex] == C_ucNO_INDEX )
83 AtTag * ret = new StdTag(i_eId);
84 NewTag(nIndex) = ret;
85 return ret;
87 else
89 return GetTag(nIndex).GetFollower();
93 AtTag *
94 OldCppDocu::CheckIn_BaseTag()
96 UINT8 nIndex = atc_base;
97 if ( nTags[nIndex] == C_ucNO_INDEX )
99 AtTag * ret = new BaseTag();
100 NewTag(nIndex) = ret;
101 return ret;
103 else
105 return GetTag(nIndex).GetFollower();
109 AtTag *
110 OldCppDocu::CheckIn_ExceptionTag()
112 UINT8 nIndex = atc_exception;
113 if ( nTags[nIndex] == C_ucNO_INDEX )
115 AtTag * ret = new ExceptionTag();
116 NewTag(nIndex) = ret;
117 return ret;
119 else
121 return GetTag(nIndex).GetFollower();
125 AtTag *
126 OldCppDocu::Create_ImplementsTag()
128 UINT8 nIndex = atc_implements;
129 if ( nTags[nIndex] == C_ucNO_INDEX )
131 AtTag * ret = new ImplementsTag();
132 NewTag(nIndex) = ret;
133 return ret;
135 else
137 return GetTag(nIndex).GetFollower();
141 AtTag *
142 OldCppDocu::Create_KeywordTag()
144 UINT8 nIndex = atc_keyword;
145 if ( nTags[nIndex] == C_ucNO_INDEX )
147 AtTag * ret = new KeywordTag();
148 NewTag(nIndex) = ret;
149 return ret;
151 else
153 return GetTag(nIndex).GetFollower();
157 AtTag *
158 OldCppDocu::CheckIn_ParameterTag()
160 UINT8 nIndex = atc_parameter;
161 if ( nTags[nIndex] == C_ucNO_INDEX )
163 AtTag * ret = new ParameterTag();
164 NewTag(nIndex) = ret;
165 return ret;
167 else
169 return GetTag(nIndex).GetFollower();
173 AtTag *
174 OldCppDocu::CheckIn_SeeTag()
176 UINT8 nIndex = atc_see;
177 if ( nTags[nIndex] == C_ucNO_INDEX )
179 AtTag * ret = new SeeTag();
180 NewTag(nIndex) = ret;
181 return ret;
183 else
185 return GetTag(nIndex).GetFollower();
189 AtTag *
190 OldCppDocu::CheckIn_TemplateTag()
192 UINT8 nIndex = atc_template;
193 if ( nTags[nIndex] == C_ucNO_INDEX )
195 AtTag * ret = new TemplateTag();
196 NewTag(nIndex) = ret;
197 return ret;
199 else
201 return GetTag(nIndex).GetFollower();
205 AtTag *
206 OldCppDocu::Create_LabelTag()
208 UINT8 nIndex = atc_label;
209 if ( nTags[nIndex] == C_ucNO_INDEX )
211 AtTag * ret = new LabelTag();
212 NewTag(nIndex) = ret;
213 return ret;
215 else
217 return GetTag(nIndex).GetFollower();
221 AtTag *
222 OldCppDocu::Create_DefaultTag()
224 UINT8 nIndex = atid_descr;
225 if ( nTags[nIndex] == C_ucNO_INDEX )
227 AtTag * ret = new StdTag(atid_descr);
228 NewTag(nIndex) = ret;
229 return ret;
231 else
233 return GetTag(nIndex).GetFollower();
237 AtTag *
238 OldCppDocu::Create_SinceTag()
240 UINT8 nIndex = atc_since;
241 if ( nTags[nIndex] == C_ucNO_INDEX )
243 AtTag * ret = new SinceTag();
244 NewTag(nIndex) = ret;
245 return ret;
247 else
249 return GetTag(nIndex).GetFollower();
254 void
255 OldCppDocu::Replace_AtShort_By_AtDescr()
257 unsigned char nPosInTags = nTags[atid_short];
258 if ( nPosInTags == C_ucNO_INDEX )
259 return;
261 AtTag * pTag = aTags[ nPosInTags ];
262 if ( pTag == 0 ) // Should be csv_assert().
263 return;
265 csv_assert( dynamic_cast< StdTag* >(pTag) != 0 );
266 StdTag * pStdTag = static_cast< StdTag* >(pTag);
268 pStdTag->ChangeId2(atid_descr);
269 nTags[atid_short] = C_ucNO_INDEX;
270 nTags[atid_descr] = nPosInTags;
273 void
274 OldCppDocu::Set_Obsolete()
276 bIsObsolete = true;
279 void
280 OldCppDocu::Set_Internal()
282 bIsInternal = true;
285 const AtTag &
286 OldCppDocu::Short() const
288 static const StdTag aNull_(atid_short);
290 unsigned char nPosInTags = nTags[atid_short];
291 if ( nPosInTags != C_ucNO_INDEX )
293 AtTag * pTag = aTags[ nPosInTags ];
294 if ( pTag != 0 ) // Should be csv_assert().
296 return *pTag;
300 return aNull_;
303 AtTag * &
304 OldCppDocu::NewTag(UINT8 i_nIndex)
306 nTags[i_nIndex] = static_cast<UINT8>(aTags.size());
307 aTags.push_back(0);
308 return aTags.back();
311 AtTag &
312 OldCppDocu::GetTag( UINT8 i_nIndex )
314 csv_assert( i_nIndex < C_eAtTag_NrOfClasses );
315 csv_assert( nTags[i_nIndex] != C_ucNO_INDEX );
316 csv_assert( aTags[nTags[i_nIndex]] != 0 );
317 return * aTags[nTags[i_nIndex]];
320 bool
321 OldCppDocu::IsInternal() const
323 return bIsInternal;
326 bool
327 OldCppDocu::IsInterface() const
329 return bIsInterface;
332 void
333 OldCppDocu::do_Accept(csv::ProcessorIfc & io_processor) const
335 csv::CheckedCall(io_processor, *this);
338 } // namespace doc
339 } // namespace ary