Debian Codegraph @

src/test/01-Basic/273-doc-describe.ck

raw
1 // show how to add descriptions with classes and functions
2 // using @doc; descriptions added in this manner are associatd
3 // with respective classes and functions and will appear in the
4 // .help() runtime info mechanism, as well as in documentation
5 // generated using CKDoc.
6 //
7 // requires: chuck-1.5.4.5 or higher
8
9 // add inline documenation (processed at compile-time)
10 // (@doc must appear right before the class definition)
11 @doc "this is a description for the class Foo"
12 class Foo
13 {
14 // add inline documenation (processed at compile-time)
15 // (@doc must appear immediately before the function definition)
16 @doc "a function in Foo, bar() likes calling his friends"
17 fun void bar()
18 {
19 beth();
20 kenny();
21 }
22
23 // add inline documenation (processed at compile-time)
24 @doc "beth() is working on a novel about shared memory"
25 fun static void beth()
26 { }
27
28 // add inline documenation (processed at compile-time)
29 @doc "kenny() is fun, and expects nothing in return"
30 fun static void kenny()
31 { }
32
33 // add inline documentation for variable
34 @doc "this here is a variable called Foo"
35 5 => int varFoo;
36
37 // add inline documentation for variable
38 @doc "this here is a static variable called Bar"
39 10 => static int varBar;
40
41 // add inline documentation for variable (but hide it)
42 @doc "(hidden) this variable is documented but hidden from ckdoc"
43 15 => static int varBarHidden;
44 }
45
46 // print runtime info about Foo...
47 // (will also appear in documentation generated by CKDoc)
48 <<< CKDoc.describe( Foo ) >>>;
49 <<< CKDoc.describe( Foo.beth ) >>>;
50 <<< CKDoc.describe( Foo.kenny ) >>>;
51
52 // with an instance, can also get info about instanced functions
53 Foo f;
54 <<< CKDoc.describe( f ) >>>;
55 <<< CKDoc.describe( f.bar ) >>>;
56
57 // print the ckdoc for Foo
58 // Foo.help()