2 /* Copyright (C) 1989-2014 Free Software Foundation, Inc.
3 Written by James Clark (jjc@jclark.com)
5 This file is part of groff.
7 groff is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 groff is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 // there is no distinction between name with no value and name with NULL value
23 // null names are not permitted (they will be ignored).
28 association() : v(0) {}
33 class dictionary_iterator {
37 dictionary_iterator(dictionary &);
38 int get(symbol *, void **);
50 void *lookup(symbol s, void *v=0); // returns value associated with key
51 void *lookup(const char *);
52 // if second parameter not NULL, value will be replaced
54 friend class dictionary_iterator;
63 void remove_reference();
66 class object_dictionary;
68 class object_dictionary_iterator {
69 dictionary_iterator di;
71 object_dictionary_iterator(object_dictionary &);
72 int get(symbol *, object **);
75 class object_dictionary {
78 object_dictionary(int);
79 object *lookup(symbol nm);
80 void define(symbol nm, object *obj);
81 void rename(symbol oldnm, symbol newnm);
82 void remove(symbol nm);
83 int alias(symbol newnm, symbol oldnm);
84 friend class object_dictionary_iterator;
88 inline int object_dictionary_iterator::get(symbol *sp, object **op)
90 return di.get(sp, (void **)op);