1is(n) [incr Tcl] is(n)
2
3
4
5______________________________________________________________________________
6
8 itcl::is - test argument to see if it is a class or an object
9
11 itcl::is option ?arg arg ...?
12______________________________________________________________________________
13
14
16 The is command is used to check if the argument given is a class or an
17 object; depending on the option given. If the argument if a class or
18 object, then 1 is returned. Otherwise, 0 is returned. The is command
19 also recognizes the commands wrapped in the itcl code command.
20
21 The option argument determines what action is carried out by the com‐
22 mand. The legal options (which may be abbreviated) are:
23
24 is class command
25 Returns 1 if command is a class, and returns 0 otherwise.
26
27 The fully qualified name of the class needs to be given as the
28 command argument. So, if a class resides in a namespace, then
29 the namespace needs to be specified as well. So, if a class C
30 resides in a namespace N, then the command should be called
31 like:
32
33 is N::C
34 or
35 is ::N::C
36
37 is object ?-class className? command
38 Returns 1 if command is an object, and returns 0 otherwise.
39
40 If the optional "-class" parameter is specified, then the com‐
41 mand will be checked within the context of the class given. Note
42 that className has to exist. If not, then an error will be
43 given. So, if className is uncertain to be a class, then the
44 programmer will need to check it's existance beforehand, or wrap
45 it in a catch statement.
46
47 So, if c is an object in the class C, in namespace N then these
48 are the possibilities (all return 1):
49
50 set obj [N::C c]
51 itcl::is object N::c
52 itcl::is object c
53 itcl::is object $obj
54 itcl::is object [itcl::code c]
55
57 class, object
58
59
60
61
62itcl 3.3 is(n)