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 <ary/doc/d_oldcppdocu.hxx>
24
25
26 // NOT FULLY DEFINED SERVICES
27 #include <ary/info/all_tags.hxx>
28 #include <ary/info/docstore.hxx>
29 #include <ary/info/infodisp.hxx>
30 #include <docu_node_ids.hxx>
31
32
33
34
35 namespace ary
36 {
37 namespace doc
38 {
39
40 using namespace info;
41
42
43
44
45 unsigned char C_ucNO_INDEX = 255;
46 typedef DYN StdTag * (F_CREATE)();
47
48
OldCppDocu()49 OldCppDocu::OldCppDocu()
50 : Node(docnt::nt_OldCppDocu),
51 bIsObsolete(false),
52 bIsInternal(false),
53 bIsInterface(false)
54 {
55 memset( nTags, C_ucNO_INDEX, size_t(C_eAtTag_NrOfClasses) );
56 }
57
~OldCppDocu()58 OldCppDocu::~OldCppDocu()
59 {
60 }
61
62 void
Store2(info::DocuStore & o_rDocuStore)63 OldCppDocu::Store2( info::DocuStore & o_rDocuStore )
64 {
65 o_rDocuStore.Store2ConnectedDeclaration(*this);
66 }
67
68 AtTag *
Create_StdTag(E_AtTagId i_eId)69 OldCppDocu::Create_StdTag( E_AtTagId i_eId )
70 {
71 UINT8 nIndex = static_cast<UINT8>(i_eId);
72 if ( nTags[nIndex] == C_ucNO_INDEX )
73 {
74 AtTag * ret = new StdTag(i_eId);
75 NewTag(nIndex) = ret;
76 return ret;
77 }
78 else
79 {
80 return GetTag(nIndex).GetFollower();
81 }
82 }
83
84 AtTag *
CheckIn_BaseTag()85 OldCppDocu::CheckIn_BaseTag()
86 {
87 UINT8 nIndex = atc_base;
88 if ( nTags[nIndex] == C_ucNO_INDEX )
89 {
90 AtTag * ret = new BaseTag();
91 NewTag(nIndex) = ret;
92 return ret;
93 }
94 else
95 {
96 return GetTag(nIndex).GetFollower();
97 }
98 }
99
100 AtTag *
CheckIn_ExceptionTag()101 OldCppDocu::CheckIn_ExceptionTag()
102 {
103 UINT8 nIndex = atc_exception;
104 if ( nTags[nIndex] == C_ucNO_INDEX )
105 {
106 AtTag * ret = new ExceptionTag();
107 NewTag(nIndex) = ret;
108 return ret;
109 }
110 else
111 {
112 return GetTag(nIndex).GetFollower();
113 }
114 }
115
116 AtTag *
Create_ImplementsTag()117 OldCppDocu::Create_ImplementsTag()
118 {
119 UINT8 nIndex = atc_implements;
120 if ( nTags[nIndex] == C_ucNO_INDEX )
121 {
122 AtTag * ret = new ImplementsTag();
123 NewTag(nIndex) = ret;
124 return ret;
125 }
126 else
127 {
128 return GetTag(nIndex).GetFollower();
129 }
130 }
131
132 AtTag *
Create_KeywordTag()133 OldCppDocu::Create_KeywordTag()
134 {
135 UINT8 nIndex = atc_keyword;
136 if ( nTags[nIndex] == C_ucNO_INDEX )
137 {
138 AtTag * ret = new KeywordTag();
139 NewTag(nIndex) = ret;
140 return ret;
141 }
142 else
143 {
144 return GetTag(nIndex).GetFollower();
145 }
146 }
147
148 AtTag *
CheckIn_ParameterTag()149 OldCppDocu::CheckIn_ParameterTag()
150 {
151 UINT8 nIndex = atc_parameter;
152 if ( nTags[nIndex] == C_ucNO_INDEX )
153 {
154 AtTag * ret = new ParameterTag();
155 NewTag(nIndex) = ret;
156 return ret;
157 }
158 else
159 {
160 return GetTag(nIndex).GetFollower();
161 }
162 }
163
164 AtTag *
CheckIn_SeeTag()165 OldCppDocu::CheckIn_SeeTag()
166 {
167 UINT8 nIndex = atc_see;
168 if ( nTags[nIndex] == C_ucNO_INDEX )
169 {
170 AtTag * ret = new SeeTag();
171 NewTag(nIndex) = ret;
172 return ret;
173 }
174 else
175 {
176 return GetTag(nIndex).GetFollower();
177 }
178 }
179
180 AtTag *
CheckIn_TemplateTag()181 OldCppDocu::CheckIn_TemplateTag()
182 {
183 UINT8 nIndex = atc_template;
184 if ( nTags[nIndex] == C_ucNO_INDEX )
185 {
186 AtTag * ret = new TemplateTag();
187 NewTag(nIndex) = ret;
188 return ret;
189 }
190 else
191 {
192 return GetTag(nIndex).GetFollower();
193 }
194 }
195
196 AtTag *
Create_LabelTag()197 OldCppDocu::Create_LabelTag()
198 {
199 UINT8 nIndex = atc_label;
200 if ( nTags[nIndex] == C_ucNO_INDEX )
201 {
202 AtTag * ret = new LabelTag();
203 NewTag(nIndex) = ret;
204 return ret;
205 }
206 else
207 {
208 return GetTag(nIndex).GetFollower();
209 }
210 }
211
212 AtTag *
Create_DefaultTag()213 OldCppDocu::Create_DefaultTag()
214 {
215 UINT8 nIndex = atid_descr;
216 if ( nTags[nIndex] == C_ucNO_INDEX )
217 {
218 AtTag * ret = new StdTag(atid_descr);
219 NewTag(nIndex) = ret;
220 return ret;
221 }
222 else
223 {
224 return GetTag(nIndex).GetFollower();
225 }
226 }
227
228 AtTag *
Create_SinceTag()229 OldCppDocu::Create_SinceTag()
230 {
231 UINT8 nIndex = atc_since;
232 if ( nTags[nIndex] == C_ucNO_INDEX )
233 {
234 AtTag * ret = new SinceTag();
235 NewTag(nIndex) = ret;
236 return ret;
237 }
238 else
239 {
240 return GetTag(nIndex).GetFollower();
241 }
242 }
243
244
245 void
Replace_AtShort_By_AtDescr()246 OldCppDocu::Replace_AtShort_By_AtDescr()
247 {
248 unsigned char nPosInTags = nTags[atid_short];
249 if ( nPosInTags == C_ucNO_INDEX )
250 return;
251
252 AtTag * pTag = aTags[ nPosInTags ];
253 if ( pTag == 0 ) // Should be csv_assert().
254 return;
255
256 csv_assert( dynamic_cast< StdTag* >(pTag) != 0 );
257 StdTag * pStdTag = static_cast< StdTag* >(pTag);
258
259 pStdTag->ChangeId2(atid_descr);
260 nTags[atid_short] = C_ucNO_INDEX;
261 nTags[atid_descr] = nPosInTags;
262 }
263
264 void
Set_Obsolete()265 OldCppDocu::Set_Obsolete()
266 {
267 bIsObsolete = true;
268 }
269
270 void
Set_Internal()271 OldCppDocu::Set_Internal()
272 {
273 bIsInternal = true;
274 }
275
276 const AtTag &
Short() const277 OldCppDocu::Short() const
278 {
279 static const StdTag aNull_(atid_short);
280
281 unsigned char nPosInTags = nTags[atid_short];
282 if ( nPosInTags != C_ucNO_INDEX )
283 {
284 AtTag * pTag = aTags[ nPosInTags ];
285 if ( pTag != 0 ) // Should be csv_assert().
286 {
287 return *pTag;
288 }
289 }
290
291 return aNull_;
292 }
293
294 AtTag * &
NewTag(UINT8 i_nIndex)295 OldCppDocu::NewTag(UINT8 i_nIndex)
296 {
297 nTags[i_nIndex] = static_cast<UINT8>(aTags.size());
298 aTags.push_back(0);
299 return aTags.back();
300 }
301
302 AtTag &
GetTag(UINT8 i_nIndex)303 OldCppDocu::GetTag( UINT8 i_nIndex )
304 {
305 csv_assert( i_nIndex < C_eAtTag_NrOfClasses );
306 csv_assert( nTags[i_nIndex] != C_ucNO_INDEX );
307 csv_assert( aTags[nTags[i_nIndex]] != 0 );
308 return * aTags[nTags[i_nIndex]];
309 }
310
311 bool
IsInternal() const312 OldCppDocu::IsInternal() const
313 {
314 return bIsInternal;
315 }
316
317 bool
IsInterface() const318 OldCppDocu::IsInterface() const
319 {
320 return bIsInterface;
321 }
322
323 void
do_Accept(csv::ProcessorIfc & io_processor) const324 OldCppDocu::do_Accept(csv::ProcessorIfc & io_processor) const
325 {
326 csv::CheckedCall(io_processor, *this);
327 }
328
329 } // namespace doc
330 } // namespace ary
331