1struct::map(n)                                                  struct::map(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       struct::map - Manage key/value maps
9

SYNOPSIS

11       package require struct::map  ?1?
12
13       ::struct::map mapName
14
15       mapName method ?arg arg ...?
16
17       mapName get
18
19       mapName names
20
21       mapName set name ?value?
22
23       mapName unset ?pattern...?
24
25______________________________________________________________________________
26

DESCRIPTION

28       Provides a snit class whose instances manage a key/value map.  In other
29       words, an object wrapper around Tcl arrays.
30

API

32       The main command provides construction of maps:
33
34       ::struct::map mapName
35              Creates a new, empty map with an associated global  Tcl  command
36              whose  name is mapName.  It may be used to invoke various opera‐
37              tions on the map.  It has the following general form:
38
39              mapName method ?arg arg ...?
40                     method and arguments determine the exact behavior of  the
41                     command.
42
43              If  mapName  is specified as %AUTO% a unique name will be gener‐
44              ated by the package itself.  The result of the  command  is  the
45              fully-qualified name of the instance command.
46
47       The following commands are possible for map objects:
48
49       mapName get
50              Returns the entire map as a Tcl dictionary.
51
52       mapName names
53              Returns  the list of all keys known to the map, in arbitrary or‐
54              der.
55
56       mapName set name ?value?
57              Sets key name to the specified value, if  the  value  specified.
58              Returns  the  value  for the key.  Throws an error if the key is
59              not known.
60
61       mapName unset ?pattern...?
62              Removes all keys matching at least one of the glob patterns from
63              the  map.   If no pattern is specified all keys are removed.  In
64              other words, the default pattern is *.  The result of  the  com‐
65              mand is the empty string.
66

BUGS, IDEAS, FEEDBACK

68       This  document,  and the package it describes, will undoubtedly contain
69       bugs and other problems.  Please report such in the category struct  ::
70       list  of  the  Tcllib  Trackers [http://core.tcl.tk/tcllib/reportlist].
71       Please also report any ideas for enhancements you may have  for  either
72       package and/or documentation.
73
74       When proposing code changes, please provide unified diffs, i.e the out‐
75       put of diff -u.
76
77       Note further that  attachments  are  strongly  preferred  over  inlined
78       patches.  Attachments  can  be  made  by  going to the Edit form of the
79       ticket immediately after its creation, and  then  using  the  left-most
80       button in the secondary navigation bar.
81
82
83
84tcllib                                 1                        struct::map(n)
Impressum