File: ch15.html

package info (click to toggle)
ebook-dev-kde20 200010-3
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k, sarge
  • size: 11,428 kB
  • ctags: 2,726
  • sloc: sh: 96; makefile: 35
file content (1089 lines) | stat: -rw-r--r-- 21,257 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML
><HEAD
><TITLE
>Creating Documentation</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.54"/><LINK
REL="HOME"
TITLE="KDE 2.0 Development"
HREF="index.html"/><LINK
REL="UP"
TITLE="Developer Tools and Support"
HREF="p04.html"/><LINK
REL="PREVIOUS"
TITLE="Developer Tools and Support"
HREF="p04.html"/><LINK
REL="NEXT"
TITLE="Documenting Applications"
HREF="ch15lev1sec2.html"/><META
HTTP-EQUIV="Content-Style-Type"
CONTENT="text/css"/><LINK
REL="stylesheet"
HREF="kde-common.css"
TYPE="text/css"/><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=iso-8859-1"/><META
HTTP-EQUIV="Content-Language"
CONTENT="en"/><LINK
REL="stylesheet"
HREF="kde-localised.css"
TYPE="text/css"
TITLE="KDE-English"/><LINK
REL="stylesheet"
HREF="kde-default.css"
TYPE="text/css"
TITLE="KDE-Default"/></HEAD
><BODY
CLASS="chapter"
LINK="#336699"
VLINK="#336699"
ALINK="#336699"
BGCOLOR="#FFFFFF"
><DIV
ALIGN="RIGHT"
CLASS="NAVBAR"
><P
><A
HREF="p04.html"
>Prev</A
> <A
HREF="ch15lev1sec2.html"
>Next</A
> <A
HREF="index.html"
>Table of Contents</A
></P
></DIV
><DIV
CLASS="chapter"
><H1
><A
NAME="ch15"
>Chapter 15. Creating Documentation</A
></H1
><P
><I
CLASS="emphasis"
>by David Sweet</I
></P
><DIV
CLASS="highlights"
><A
NAME="AEN22456"
></A
><P
><B
>In This Chapter</B
></P
><UL
COMPACT="COMPACT"
><LI
STYLE="list-style-type: disc"
><P
><I
CLASS="emphasis"
><A
HREF="ch15.html#ch15lev1sec1"
>Documenting Source Code</A
></I
></P
></LI
><LI
STYLE="list-style-type: disc"
><P
><I
CLASS="emphasis"
><A
HREF="ch15lev1sec2.html"
>Documenting Applications</A
></I
></P
></LI
></UL
></DIV
><P
>Much effort is put into making the process of creating documentation simpler for other developers and end users. Standards exist for writing such documentation, as do software tools to help you turn your documentation into attractive, accessible formats. In this chapter you learn about two such standards: the KDE source-code documentation style and DocBook and their related software tools.</P
><DIV
CLASS="section"
><TABLE
WIDTH="100%"
CELLPADDING="0"
CELLSPACING="0"
BORDER="0"
ALIGN="CENTER"
><TR
><TD
WIDTH="90%"
><H1
CLASS="section"
><A
NAME="ch15lev1sec1"
>15.1. Documenting Source Code</A
></H1
><P
>As mentioned in earlier chapters, it is important to document source code so that you and others can read and understand it later on. When you are attempting to manage a large collection of classes and functions, you will undoubtedly forget precisely how some of them work. Comments in the class declarations (in the header files), for example, can serve as a handy reference when this happens. Of course, if others want to use or change one of your classes, they will appreciate all the help they can get. If you are writing open source code, you will probably appreciate it when other developers send you patches, and again, it is easier for others to create patches if your code is documented.</P
><P
>In a large project, such as the KDE project, in which hundreds of developers are writing and hacking at hundreds of thousands of lines of source code, documentation becomes invaluable. The utility of such documentation was realized early on and a documentation standard was created.</P
><P
>KDE developers put special comments in their header files before each class and method name. These comments can be processed by a set of Perl scripts called KDOC. (This documentation style is similar to that used by JavaDoc, a Java language documentation preparation program.) KDOC can create output in HTML, DocBook, LaTeX, TeXInfo, and UNIX man page formats. The default format, HTML, is the one most commonly used in the KDE project. You can see samples of KDOC output on the KDE developers' Web site at <A
HREF="http://developer.kde.org/documentation/library/2.0-api/classref/index.html"
TARGET="_top"
>http://developer.kde.org/documentation/library/2.0-api/classref/index.html</A
>. This page contains links to documentation of the KDE 2.0 API documentation.</P
><DIV
CLASS="section"
><TABLE
WIDTH="100%"
CELLPADDING="0"
CELLSPACING="0"
BORDER="0"
ALIGN="CENTER"
><TR
><TD
WIDTH="90%"
><H2
CLASS="section"
><A
NAME="ch15lev2sec1"
>15.1.1. Obtaining and Installing KDOC</A
></H2
><P
>The KDOC source code is available from <A
HREF="http://www.ph.unimelb.edu.au/~ssk/kde/kdoc"
TARGET="_top"
>http://www.ph.unimelb.edu.au/~ssk/kde/kdoc</A
> or from the KDE CVS source code repository in the module kdoc (see <A
HREF="ch17.html"
>Chapter 17, <SPAN
CLASS="QUOTE"
>"Managing Source Code with CVS"</SPAN
></A
> for information on retrieving modules from the source code repository).</P
><P
>KDE 2.0 uses KDOC 2, so if you visit the Web site (where both KDOC 1 and KDOC 2 are available), be sure to get KDOC 2.</P
><P
>Be sure you have Perl 5.005 (or later, see <A
HREF="http://www.cpan.org"
TARGET="_top"
>http://www.cpan.org</A
>) installed before you attempt to install KDOC 2.</P
><P
>If you downloaded the file (a compressed tar archive) kdoc-snapshot.tar.gz from the Web site mentioned earlier, you should unpack it with</P
><DIV
CLASS="informalexample"
><HR/><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>   1&nbsp;
   2&nbsp;<I
CLASS="emphasis"
>gzip -d kdoc-shapshot.tar.gz</I
>
   3&nbsp;<I
CLASS="emphasis"
>tar -xvf kdoc-snapshot.tar</I
></PRE
></TD
></TR
></TABLE
><HR/></DIV
><P
>The archive unpacks to a directory called kdoc. Change to this directory with</P
><DIV
CLASS="informalexample"
><HR/><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>   1&nbsp;
   2&nbsp;<I
CLASS="emphasis"
>cd kdoc</I
></PRE
></TD
></TR
></TABLE
><HR/></DIV
><P
>If you downloaded the CVS modules, you won't need to do any unpacking, but you will need to type</P
><DIV
CLASS="informalexample"
><HR/><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>   1&nbsp;
   2&nbsp;<I
CLASS="emphasis"
>cd kdoc</I
>
   3&nbsp;<I
CLASS="emphasis"
>make -f Makefile.cvs</I
></PRE
></TD
></TR
></TABLE
><HR/></DIV
><P
>to prepare the directory for use.</P
><P
>In either case&#8212;whether you downloaded the archive from the Web site or the module from CVS&#8212;you are ready to compile and install kdoc. Log in as root and type</P
><DIV
CLASS="informalexample"
><HR/><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>   1&nbsp;
   2&nbsp;<I
CLASS="emphasis"
>./configure</I
>
   3&nbsp;<I
CLASS="emphasis"
>make install</I
></PRE
></TD
></TR
></TABLE
><HR/></DIV
><P
>KDOC is installed and ready to use. (Before continuing, you should log out and log in as a nonroot user.)</P
></TD
><TD
WIDTH="10%"
VALIGN="BOTTOM"
ALIGN="CENTER"
><ANNMARK
NAME="ch15lev2sec1"/></TD
></TR
><ANNOTATION
NAME="ch15lev2sec1"
TITLE="Obtaining and Installing KDOC"/></TABLE
></DIV
><DIV
CLASS="section"
><TABLE
WIDTH="100%"
CELLPADDING="0"
CELLSPACING="0"
BORDER="0"
ALIGN="CENTER"
><TR
><TD
WIDTH="90%"
><H2
CLASS="section"
><A
NAME="ch15lev2sec2"
>15.1.2. Using KDOC</A
></H2
><P
>Using KDOC is simple. You add a comment before each class declaration and inside class declarations before each method or enum declarations. These comments are C-style, like this:</P
><DIV
CLASS="informalexample"
><HR/><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>   1&nbsp;
   2&nbsp;/**
   3&nbsp; * This is a KDOC comment.
   4&nbsp; */</PRE
></TD
></TR
></TABLE
><HR/></DIV
><P
>Notice that the first line begins with <TT
CLASS="literal"
>/**</TT
>. The double asterisk is the signal to KDOC that it should process this comment. Comments without the double asterisk are ignored. Each subsequent line should begin with an asterisk. Note that these comments appear in header files. KDOC is not designed to process comments in source-code files.</P
><P
>The comments should describe the element&#8212;class, method, or enum&#8212;that they precede. Look at <A
HREF="ch15.html#ch15list01"
>Listing 15.1</A
> as an example. One large comment describes the class by telling what it does, who wrote it, what version it is, and so on. The comments preceding the methods tell what function the methods perform, what their arguments mean, and so on.</P
><DIV
CLASS="example"
><HR/><A
NAME="ch15list01"
></A
><P
><B
>Example 15.1. <TT
CLASS="literal"
>kdocsample.h</TT
>: A Class Declaration Commented for Processing by KDOC</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>   1&nbsp;
   2&nbsp; 1: #ifndef __KDOCSAMPLE_H__
   3&nbsp; 2: #define __KDOCSAMPLE_H__
   4&nbsp; 3:
   5&nbsp; 4: /**
   6&nbsp; 5:  * @libdoc A single-class library.
   7&nbsp; 6:  *
   8&nbsp; 7:  * This comment is the overall documentation for entire library.
   9&nbsp; 8:  * It could appear in any one header file.
  10&nbsp; 9:  * The single class in this library is called @ref KDocSample.
  11&nbsp;10:  **/
  12&nbsp;11:
  13&nbsp;12:
  14&nbsp;13: /**
  15&nbsp;14:  * This header file is documented in kdoc format.
  16&nbsp;15:  *
  17&nbsp;16:  * This is a new paragraph of documentation because it is preceeded
  18&nbsp;17:  * by a blank line.  The string "/**" above marks this comment as
  19&nbsp;18:  * documentation.
  20&nbsp;19:  *
  21&nbsp;20:  * If this class created a widget, we might put a small screenshot
  22&nbsp;21:  *  here:
  23&nbsp;22:  * @image /home/dsweet/KDE/HEAD/kde/share/icons/large/hicolor/apps/go.png
  24&nbsp;23:  * @short Sample documented header file
  25&nbsp;24:  * @author Joe Developer &lt;jdevel@kde.org&gt;
  26&nbsp;25:  * @version 1.0
  27&nbsp;26:  */
  28&nbsp;27: class KDocSample
  29&nbsp;28: {
  30&nbsp;29:  public:
  31&nbsp;30:   /**
  32&nbsp;31:    * @sect Important stuff
  33&nbsp;32:    *
  34&nbsp;33:    * Instantiate this class.
  35&nbsp;34:    *
  36&nbsp;35:    * Notes
  37&nbsp;36:    * @li Don't forget to &#8230;
  38&nbsp;37:    * @li Be sure to &#8230;
  39&nbsp;38:    * @param goodstuff Some good stuff to document.
  40&nbsp;39:    * @see getStuff
  41&nbsp;40:    **/
  42&nbsp;41:   KDocSample (QString goodstuff);
  43&nbsp;42:
  44&nbsp;43:   /**
  45&nbsp;44:    * Retrieve the good stuff.
  46&nbsp;45:    *
  47&nbsp;46:    * @since one two three
  48&nbsp;47:    * @returns The good stuff.
  49&nbsp;48:    * @exception some_exception some_other_exception
  50&nbsp;49:    **/
  51&nbsp;50:   virtual QString getStuff () const;
  52&nbsp;51: };
  53&nbsp;52:
  54&nbsp;53:
  55&nbsp;54: #endif</PRE
></TD
></TR
></TABLE
><HR/></DIV
><P
>You can create HTML output with the following command:</P
><DIV
CLASS="informalexample"
><HR/><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>   1&nbsp;
   2&nbsp;<I
CLASS="emphasis"
>kdoc -d KDocSampleOutput -n KDocSample kdocsample.h</I
></PRE
></TD
></TR
></TABLE
><HR/></DIV
><P
>This command instructs KDOC to create its HTML output&#8212;a <I
CLASS="emphasis"
>collection</I
> of .html files&#8212;in the directory MyLibraryOutput (via the option <TT
CLASS="literal"
>-d</TT
>) and to name the collection of files (within the documentation files) KDocSample (via the option <TT
CLASS="literal"
>-n</TT
>). kdoc can take multiple filenames as input. For example,</P
><DIV
CLASS="informalexample"
><HR/><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>   1&nbsp;
   2&nbsp;<I
CLASS="emphasis"
>kdoc -d MyLibraryOutput -n MyLibrary *.h</I
></PRE
></TD
></TR
></TABLE
><HR/></DIV
><P
>processes all header files with the extension .h in this directory into a collection of HTML files in the directory MyLibraryOutput and titles it MyLibrary. <A
HREF="ch15.html#ch15fig01"
>Figure 15.1</A
> shows some of the HTML output as viewed by Konqueror.</P
><DIV
CLASS="figure"
><HR/><A
NAME="ch15fig01"
></A
><P
><B
>Figure 15.1. Screen shot of Konqueror viewing the HTML output of kdoc given kdocsample.h as input.</B
></P
><DIV
CLASS="mediaobject"
><P
><IMG
SRC="graphics/15fig01.gif"
></IMG
></P
></DIV
><HR/></DIV
><P
>Each KDOC-formatted comment can include the following elements:</P
><UL
COMPACT="COMPACT"
><LI
STYLE="list-style-type: disc"
><P
>Unformatted text&#8212;Each paragraph is separated by an empty line (that is, an asterisk followed only by whitespace).</P
></LI
><LI
STYLE="list-style-type: disc"
><P
><TT
CLASS="literal"
>&lt;pre&gt;&#8230;&lt;/pre&gt;</TT
> tags&#8212;These tags mark preformatted text, such as code segments (the same as in HTML).</P
></LI
><LI
STYLE="list-style-type: disc"
><P
>Tags beginning with the <TT
CLASS="literal"
>@</TT
> character&#8212;One such tag, <TT
CLASS="literal"
>@author</TT
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>name</TT
></I
>, tells who the author of the code is. Other possible KDOC tags are described in the next section.</P
></LI
></UL
><P
>The next sections detail tags that can be used when formatting comments for KDOC.</P
></TD
><TD
WIDTH="10%"
VALIGN="BOTTOM"
ALIGN="CENTER"
><ANNMARK
NAME="ch15lev2sec2"/></TD
></TR
><ANNOTATION
NAME="ch15lev2sec2"
TITLE="Using KDOC"/></TABLE
></DIV
><DIV
CLASS="section"
><TABLE
WIDTH="100%"
CELLPADDING="0"
CELLSPACING="0"
BORDER="0"
ALIGN="CENTER"
><TR
><TD
WIDTH="90%"
><H2
CLASS="section"
><A
NAME="ch15lev2sec3"
>15.1.3. Library Documentation</A
></H2
><UL
COMPACT="COMPACT"
><LI
STYLE="list-style-type: disc"
><P
><TT
CLASS="literal"
>@libdoc</TT
>&#8212;Thistag marks this entire comment as library documentation. That means that it will appear on the page that indexes the library and thus should describe the functions available in the library. See <A
HREF="http://www.ph.unimelb.edu.au/~ssk/kde/srcdoc/kio/index.html"
TARGET="_top"
>http://www.ph.unimelb.edu.au/~ssk/kde/srcdoc/kio/index.html</A
> for an example.</P
></LI
></UL
></TD
><TD
WIDTH="10%"
VALIGN="BOTTOM"
ALIGN="CENTER"
><ANNMARK
NAME="ch15lev2sec3"/></TD
></TR
><ANNOTATION
NAME="ch15lev2sec3"
TITLE="Library Documentation"/></TABLE
></DIV
><DIV
CLASS="section"
><TABLE
WIDTH="100%"
CELLPADDING="0"
CELLSPACING="0"
BORDER="0"
ALIGN="CENTER"
><TR
><TD
WIDTH="90%"
><H2
CLASS="section"
><A
NAME="ch15lev2sec4"
>15.1.4. Class Documentation</A
></H2
><UL
COMPACT="COMPACT"
><LI
STYLE="list-style-type: disc"
><P
><TT
CLASS="literal"
>@short</TT
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>Short description</TT
></I
>&#8212;Offers a short description of the class.</P
></LI
><LI
STYLE="list-style-type: disc"
><P
><TT
CLASS="literal"
>@author</TT
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>authorName</TT
></I
>&#8212;Specifies the name of the author of the class.</P
></LI
><LI
STYLE="list-style-type: disc"
><P
><TT
CLASS="literal"
>@version</TT
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>version</TT
></I
>&#8212;Specifies the version of the class.</P
></LI
><LI
STYLE="list-style-type: disc"
><P
><TT
CLASS="literal"
>@internal</TT
>&#8212;Indicates that a class is used only internally by a library.</P
></LI
><LI
STYLE="list-style-type: disc"
><P
><TT
CLASS="literal"
>@deprecated</TT
>&#8212;Indicates that a class is deprecated.</P
></LI
></UL
></TD
><TD
WIDTH="10%"
VALIGN="BOTTOM"
ALIGN="CENTER"
><ANNMARK
NAME="ch15lev2sec4"/></TD
></TR
><ANNOTATION
NAME="ch15lev2sec4"
TITLE="Class Documentation"/></TABLE
></DIV
><DIV
CLASS="section"
><TABLE
WIDTH="100%"
CELLPADDING="0"
CELLSPACING="0"
BORDER="0"
ALIGN="CENTER"
><TR
><TD
WIDTH="90%"
><H2
CLASS="section"
><A
NAME="ch15lev2sec5"
>15.1.5. Method Documentation</A
></H2
><UL
COMPACT="COMPACT"
><LI
STYLE="list-style-type: disc"
><P
><TT
CLASS="literal"
>@param</TT
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>parameterName description</TT
></I
>&#8212;Describes one of the parameters (arguments) that is passed to this function.</P
></LI
><LI
STYLE="list-style-type: disc"
><P
><TT
CLASS="literal"
>@returns</TT
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>description</TT
></I
>&#8212;Describes the value returned by this method.</P
></LI
><LI
STYLE="list-style-type: disc"
><P
><TT
CLASS="literal"
>@since</TT
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>version</TT
></I
>&#8212;Says that this method was added in version <I
CLASS="emphasis"
>version</I
> of the class.</P
></LI
><LI
STYLE="list-style-type: disc"
><P
><TT
CLASS="literal"
>@exception</TT
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>ref1</TT
></I
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>ref2</TT
></I
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>&#8230;</TT
></I
>&#8212;Tells what exceptions might be thrown from this function.</P
></LI
><LI
STYLE="list-style-type: disc"
><P
><TT
CLASS="literal"
>@throws</TT
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>ref1</TT
></I
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>ref2</TT
></I
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>&#8230;</TT
></I
>&#8212;Tells what exceptions might be thrown from this function. (Same as <TT
CLASS="literal"
>@exception</TT
>.)</P
></LI
><LI
STYLE="list-style-type: disc"
><P
><TT
CLASS="literal"
>@raises</TT
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>ref1</TT
></I
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>ref2</TT
></I
> <I
CLASS="emphasis"
>&#8230;</I
>&#8212;Tells what exceptions might be thrown from this function. (Same as <TT
CLASS="literal"
>@exception</TT
>.)</P
></LI
></UL
></TD
><TD
WIDTH="10%"
VALIGN="BOTTOM"
ALIGN="CENTER"
><ANNMARK
NAME="ch15lev2sec5"/></TD
></TR
><ANNOTATION
NAME="ch15lev2sec5"
TITLE="Method Documentation"/></TABLE
></DIV
><DIV
CLASS="section"
><TABLE
WIDTH="100%"
CELLPADDING="0"
CELLSPACING="0"
BORDER="0"
ALIGN="CENTER"
><TR
><TD
WIDTH="90%"
><H2
CLASS="section"
><A
NAME="ch15lev2sec6"
>15.1.6. Class and Method Documentation</A
></H2
><UL
COMPACT="COMPACT"
><LI
STYLE="list-style-type: disc"
><P
><TT
CLASS="literal"
>@see</TT
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>ref1</TT
></I
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>re2</TT
></I
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>&#8230;</TT
></I
>&#8212;Provides cross-reference to one or multiple other classes or methods. The arguments <I
CLASS="emphasis"
><TT
CLASS="literal"
>ref1</TT
></I
>, <I
CLASS="emphasis"
><TT
CLASS="literal"
>ref2</TT
></I
>, and so on have the format <TT
CLASS="literal"
>Classname</TT
> or <TT
CLASS="literal"
>Classname::method</TT
>. KDOC will turn these references into hyperlinks (when producing HTML output) if it can. Note: Don't include the parentheses or arguments when naming methods. That is, use <TT
CLASS="literal"
>method</TT
>, not <TT
CLASS="literal"
>method()</TT
>.</P
></LI
><LI
STYLE="list-style-type: disc"
><P
><TT
CLASS="literal"
>@ref</TT
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>ref</TT
></I
>&#8212;This is an inline cross-reference. For example, the following text:</P
><DIV
CLASS="informalexample"
><HR/><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>   1&nbsp;
   2&nbsp;* Take a look at @ref KClass, it's a good one!</PRE
></TD
></TR
></TABLE
><HR/></DIV
><P
>includes a hyperlinked (if possible) reference to KClass.</P
></LI
><LI
STYLE="list-style-type: disc"
><P
><TT
CLASS="literal"
>@image</TT
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>pathOrUrl</TT
></I
>&#8212;Includes an image that can be found at the path or URL <I
CLASS="emphasis"
><TT
CLASS="literal"
>pathOrURL</TT
></I
>.</P
></LI
><LI
STYLE="list-style-type: disc"
><P
><TT
CLASS="literal"
>@sect</TT
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>sectionName</TT
></I
>&#8212;Starts a new section of the documentation and cells it <I
CLASS="emphasis"
><TT
CLASS="literal"
>sectionName</TT
></I
></P
></LI
><LI
STYLE="list-style-type: disc"
><P
><TT
CLASS="literal"
>@li</TT
> <I
CLASS="emphasis"
><TT
CLASS="literal"
>listItem</TT
></I
>&#8212;Includes a list item (<TT
CLASS="literal"
>&lt;LI&gt;</TT
> in HTML) called <I
CLASS="emphasis"
><TT
CLASS="literal"
>listItem</TT
></I
> at this point in the document.</P
></LI
></UL
><P
>The tags <TT
CLASS="literal"
>@see</TT
> and <TT
CLASS="literal"
>@image</TT
> need to be followed by a blank KDOC comment line. For example:</P
><DIV
CLASS="informalexample"
><HR/><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>   1&nbsp;
   2&nbsp;* @see KOtherClass
   3&nbsp;  *
   4&nbsp;  * @version 1.0</PRE
></TD
></TR
></TABLE
><HR/></DIV
><P
>is allowed, whereas</P
><DIV
CLASS="informalexample"
><HR/><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>   1&nbsp;
   2&nbsp;  * @see KOtherClass
   3&nbsp;  * @version 1.0</PRE
></TD
></TR
></TABLE
><HR/></DIV
><P
>is not. The blank line tells KDOC to stop processing the <TT
CLASS="literal"
>@see</TT
> or <TT
CLASS="literal"
>@image</TT
> tag.</P
></TD
><TD
WIDTH="10%"
VALIGN="BOTTOM"
ALIGN="CENTER"
><ANNMARK
NAME="ch15lev2sec6"/></TD
></TR
><ANNOTATION
NAME="ch15lev2sec6"
TITLE="Class and Method Documentation"/></TABLE
></DIV
></TD
><TD
WIDTH="10%"
VALIGN="BOTTOM"
ALIGN="CENTER"
><ANNMARK
NAME="ch15lev1sec1"/></TD
></TR
><ANNOTATION
NAME="ch15lev1sec1"
TITLE="Documenting Source Code"/></TABLE
></DIV
></DIV
><DIV
ALIGN="RIGHT"
CLASS="NAVBAR"
><P
><A
HREF="p04.html"
>Prev</A
> <A
HREF="ch15lev1sec2.html"
>Next</A
> <A
HREF="index.html"
>Table of Contents</A
></P
></DIV
><HR
WIDTH="100%"
SIZE="2"
ALIGN="CENTER"
NOSHADE="NOSHADE"/></BODY
></HTML
>