xref: /AOO42X/main/autodoc/source/ary/info/all_tags.cxx (revision b1c5455db1639c48e26c568e4fa7ee78ca5d60ee)
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/info/all_tags.hxx>
24 
25 
26 // NOT FULLY DEFINED SERVICES
27 #include <limits>
28 #include <ary/info/infodisp.hxx>
29 #include <adc_cl.hxx>
30 
31 
32 namespace ary
33 {
34 namespace info
35 {
36 
37 
38 
39 //*****************************     StdTag      ***********************//
40 
41 
StdTag(E_AtTagId i_eId)42 StdTag::StdTag( E_AtTagId i_eId )
43     :   eId(i_eId),
44         // aText,
45         pNext(0)
46 {
47 }
48 
49 bool
Add_SpecialMeaningToken(const char *,intt)50 StdTag::Add_SpecialMeaningToken( const char *   ,
51                                  intt           )
52 {
53     // Does nothing
54 
55     // KORR_FUTURE
56     //   Should be a logical exception:
57     // csv_assert(false);
58     return false;
59 }
60 
61 UINT8
NrOfSpecialMeaningTokens() const62 StdTag::NrOfSpecialMeaningTokens() const
63 {
64     return 0;
65 }
66 
67 AtTag *
GetFollower()68 StdTag::GetFollower()
69 {
70     if (pNext != 0)
71         return pNext->GetFollower();
72     pNext = new StdTag(eId);
73     return pNext;
74 }
75 
76 void
do_StoreAt(DocuDisplay & o_rDisplay) const77 StdTag::do_StoreAt( DocuDisplay &  o_rDisplay ) const
78 {
79     o_rDisplay.Display_StdTag( *this );
80 }
81 
82 DocuText *
Text()83 StdTag::Text()
84 {
85     return &aText;
86 }
87 
88 
89 
90 //*****************************     BaseTag     ***********************//
91 
BaseTag()92 BaseTag::BaseTag()
93     :   // sBase
94         // aText
95         pNext(0)
96 {
97 }
98 
99 bool
Add_SpecialMeaningToken(const char * i_sText,intt i_nNr)100 BaseTag::Add_SpecialMeaningToken( const char *      i_sText,
101                                   intt              i_nNr )
102 {
103     if ( i_nNr == 1 )
104     {
105         sBase.AssignText(i_sText,"::");
106         return true;
107     }
108     return false;
109 }
110 
111 const char *
Title() const112 BaseTag::Title() const
113 {
114     return "Base Classes";
115 }
116 
117 UINT8
NrOfSpecialMeaningTokens() const118 BaseTag::NrOfSpecialMeaningTokens() const
119 {
120     return 1;
121 }
122 
123 AtTag *
GetFollower()124 BaseTag::GetFollower()
125 {
126     if (pNext != 0)
127         return pNext->GetFollower();
128     pNext = new BaseTag;
129     return pNext;
130 }
131 
132 DocuText *
Text()133 BaseTag::Text()
134 {
135     return &aText;
136 }
137 
138 
139 
140 //*****************************     ExceptionTag    ***********************//
141 
ExceptionTag()142 ExceptionTag::ExceptionTag()
143     :   // sException,
144         // aText
145         pNext(0)
146 {
147 }
148 
149 bool
Add_SpecialMeaningToken(const char * i_sText,intt i_nNr)150 ExceptionTag::Add_SpecialMeaningToken( const char *     i_sText,
151                                        intt             i_nNr )
152 {
153     if ( i_nNr == 1 )
154     {
155         sException.AssignText(i_sText,"::");
156         return true;
157     }
158     return false;
159 }
160 
161 const char *
Title() const162 ExceptionTag::Title() const
163 {
164     return "Thrown Exceptions";
165 }
166 
167 UINT8
NrOfSpecialMeaningTokens() const168 ExceptionTag::NrOfSpecialMeaningTokens() const
169 {
170     return 1;
171 }
172 
173 AtTag *
GetFollower()174 ExceptionTag::GetFollower()
175 {
176     if (pNext != 0)
177         return pNext->GetFollower();
178     pNext = new ExceptionTag;
179     return pNext;
180 }
181 
182 DocuText *
Text()183 ExceptionTag::Text()
184 {
185     return &aText;
186 }
187 
188 
189 //*****************************     ImplementsTag   ***********************//
190 
ImplementsTag()191 ImplementsTag::ImplementsTag()
192     :   // sBase
193         // aText
194         pNext(0)
195 {
196 }
197 
198 bool
Add_SpecialMeaningToken(const char * i_sText,intt i_nNr)199 ImplementsTag::Add_SpecialMeaningToken( const char *        i_sText,
200                                         intt                i_nNr )
201 {
202     if ( i_nNr == 1 )
203     {
204         sName.AssignText(i_sText,"::");
205     }
206     else
207     {
208         GetFollower()->Add_SpecialMeaningToken(i_sText,1);
209     }
210     return true;
211 }
212 
213 const char *
Title() const214 ImplementsTag::Title() const
215 {
216     return "Implements";
217 }
218 
219 UINT8
NrOfSpecialMeaningTokens() const220 ImplementsTag::NrOfSpecialMeaningTokens() const
221 {
222     return std::numeric_limits<UINT8>::max();
223 }
224 
225 AtTag *
GetFollower()226 ImplementsTag::GetFollower()
227 {
228     if (pNext != 0)
229         return pNext->GetFollower();
230     pNext = new ImplementsTag;
231     return pNext;
232 }
233 
234 DocuText *
Text()235 ImplementsTag::Text()
236 {
237     return 0;
238 }
239 
240 
241 //*****************************     KeywordTag      ***********************//
242 
243 
KeywordTag()244 KeywordTag::KeywordTag()
245 //  :   sKeys
246 {
247 }
248 
249 bool
Add_SpecialMeaningToken(const char * i_sText,intt)250 KeywordTag::Add_SpecialMeaningToken( const char *       i_sText,
251                                      intt               )
252 {
253     sKeys.push_back(i_sText);
254     return true;
255 }
256 
257 const char *
Title() const258 KeywordTag::Title() const
259 {
260     return "Keywords";
261 }
262 
263 UINT8
NrOfSpecialMeaningTokens() const264 KeywordTag::NrOfSpecialMeaningTokens() const
265 {
266     return std::numeric_limits<UINT8>::max();
267 }
268 
269 AtTag *
GetFollower()270 KeywordTag::GetFollower()
271 {
272     return this;
273 }
274 
275 DocuText *
Text()276 KeywordTag::Text()
277 {
278     return 0;
279 }
280 
281 
282 
283 //*****************************     ParameterTag    ***********************//
284 
285 
ParameterTag()286 ParameterTag::ParameterTag()
287     :   // sName
288         // aText
289         pNext(0)
290 {
291 }
292 
293 bool
Add_SpecialMeaningToken(const char * i_sText,intt i_nNr)294 ParameterTag::Add_SpecialMeaningToken( const char *     i_sText,
295                                        intt             i_nNr )
296 {
297     if ( i_nNr == 1 )
298     {
299         sName = i_sText;
300         return true;
301     }
302     else if (i_nNr == 2)
303     {
304         uintt nLen = strlen(i_sText);
305         if (*i_sText == '[' AND i_sText[nLen-1] == ']')
306         {
307             sValidRange = String(i_sText+1, nLen-2);
308             return true;
309         }
310     }
311     return false;
312 }
313 
314 UINT8
NrOfSpecialMeaningTokens() const315 ParameterTag::NrOfSpecialMeaningTokens() const
316 {
317     return 2;
318 }
319 
320 AtTag *
GetFollower()321 ParameterTag::GetFollower()
322 {
323     if (pNext != 0)
324         return pNext->GetFollower();
325     return  pNext = new ParameterTag;
326 }
327 
328 DocuText *
Text()329 ParameterTag::Text()
330 {
331     return &aText;
332 }
333 
334 void
do_StoreAt(DocuDisplay & o_rDisplay) const335 ParameterTag::do_StoreAt( DocuDisplay &  o_rDisplay ) const
336 {
337     o_rDisplay.Display_ParameterTag( *this );
338 }
339 
340 
341 
342 //*****************************     SeeTag          ***********************//
343 
344 
345 
SeeTag()346 SeeTag::SeeTag()
347 //  :   sReferences
348 {
349 }
350 
351 bool
Add_SpecialMeaningToken(const char * i_sText,intt)352 SeeTag::Add_SpecialMeaningToken( const char *       i_sText,
353                                  intt               )
354 {
355     static QualifiedName aNull_;
356     sReferences.push_back(aNull_);
357     sReferences.back().AssignText(i_sText,"::");
358 
359     return true;
360 }
361 
362 const char *
Title() const363 SeeTag::Title() const
364 {
365     return "See Also";
366 }
367 
368 UINT8
NrOfSpecialMeaningTokens() const369 SeeTag::NrOfSpecialMeaningTokens() const
370 {
371     return std::numeric_limits<UINT8>::max();
372 }
373 
374 AtTag *
GetFollower()375 SeeTag::GetFollower()
376 {
377     return this;
378 }
379 
380 void
do_StoreAt(DocuDisplay & o_rDisplay) const381 SeeTag::do_StoreAt( DocuDisplay &  o_rDisplay ) const
382 {
383     o_rDisplay.Display_SeeTag( *this );
384 }
385 
386 DocuText *
Text()387 SeeTag::Text()
388 {
389     return 0;
390 }
391 
392 
393 
394 //*****************************     TemplateTag     ***********************//
395 
396 
TemplateTag()397 TemplateTag::TemplateTag()
398     :   // sName
399         // aText
400         pNext(0)
401 {
402 }
403 
404 bool
Add_SpecialMeaningToken(const char * i_sText,intt i_nNr)405 TemplateTag::Add_SpecialMeaningToken( const char *      i_sText,
406                                        intt             i_nNr )
407 {
408     if ( i_nNr == 1 )
409     {
410         sName = i_sText;
411         return true;
412     }
413     return false;
414 }
415 
416 const char *
Title() const417 TemplateTag::Title() const
418 {
419     return "Template Parameters";
420 }
421 
422 UINT8
NrOfSpecialMeaningTokens() const423 TemplateTag::NrOfSpecialMeaningTokens() const
424 {
425     return 1;
426 }
427 
428 AtTag *
GetFollower()429 TemplateTag::GetFollower()
430 {
431     if (pNext != 0)
432         return pNext->GetFollower();
433     return  pNext = new TemplateTag;
434 }
435 
436 void
do_StoreAt(DocuDisplay & o_rDisplay) const437 TemplateTag::do_StoreAt( DocuDisplay &  o_rDisplay ) const
438 {
439     o_rDisplay.Display_TemplateTag( *this );
440 }
441 
442 
443 DocuText *
Text()444 TemplateTag::Text()
445 {
446     return &aText;
447 }
448 
449 
450 //*****************************     LabelTag        ***********************//
451 
452 
453 
LabelTag()454 LabelTag::LabelTag()
455     :   sLabel()
456 {
457 }
458 
459 bool
Add_SpecialMeaningToken(const char * i_sText,intt i_nNr)460 LabelTag::Add_SpecialMeaningToken( const char *     i_sText,
461                                    intt             i_nNr )
462 {
463     if ( i_nNr == 1 AND sLabel.length() == 0 )
464     {
465         sLabel = i_sText;
466         return true;
467     }
468     // KORR_FUTURE
469 //  else    // Throw exception because of double label.
470     return false;
471 }
472 
473 const char *
Title() const474 LabelTag::Title() const
475 {
476     return "Label";
477 }
478 
479 UINT8
NrOfSpecialMeaningTokens() const480 LabelTag::NrOfSpecialMeaningTokens() const
481 {
482     return 1;
483 }
484 
485 AtTag *
GetFollower()486 LabelTag::GetFollower()
487 {
488     return this;
489 }
490 
491 DocuText *
Text()492 LabelTag::Text()
493 {
494     return 0;
495 }
496 
497 
498 //*****************************     SinceTag        ***********************//
499 
SinceTag()500 SinceTag::SinceTag()
501     :   sVersion()
502 {
503 }
504 
505 bool
Add_SpecialMeaningToken(const char * i_sText,intt)506 SinceTag::Add_SpecialMeaningToken( const char *     i_sText,
507                                    intt             )
508 {
509     const char cCiphersend = '9' + 1;
510     if ( sVersion.empty()
511          AND NOT csv::in_range('0', *i_sText, cCiphersend)
512          AND autodoc::CommandLine::Get_().DoesTransform_SinceTag() )
513     {
514         return true;
515     }
516 
517     if (sVersion.empty())
518     {
519         sVersion = i_sText;
520     }
521     else
522     {
523         StreamLock sHelp(100);
524         sVersion = sHelp() << sVersion << " " << i_sText << c_str;
525     }
526 
527     return true;
528 }
529 
530 const char *
Title() const531 SinceTag::Title() const
532 {
533     return "Label";
534 }
535 
536 UINT8
NrOfSpecialMeaningTokens() const537 SinceTag::NrOfSpecialMeaningTokens() const
538 {
539     return UINT8(-1);
540 }
541 
542 AtTag *
GetFollower()543 SinceTag::GetFollower()
544 {
545     return this;
546 }
547 
548 void
do_StoreAt(DocuDisplay & o_rDisplay) const549 SinceTag::do_StoreAt( DocuDisplay & o_rDisplay ) const
550 {
551     o_rDisplay.Display_SinceTag( *this );
552 }
553 
554 DocuText *
Text()555 SinceTag::Text()
556 {
557     return 0;
558 }
559 
560 
561 }   // namespace info
562 }   // namespace ary
563