2 * Sherlock Library -- Object Functions
4 * (c) 1997--2003 Martin Mares <mj@ucw.cz>
6 * This software may be freely distributed and used according to the terms
7 * of the GNU Lesser General Public License.
10 #ifndef _SHERLOCK_OBJECT_H
11 #define _SHERLOCK_OBJECT_H
13 /* FIXME: Buggy objects with long attributes still exist in old databases. Decrease to 1024 one day. */
14 #define MAX_ATTR_SIZE 4096 /* Maximum length an attribute can ever have (including name and trailing 0) */
18 struct odes { /* Object description */
21 struct oattr *cached_attr;
24 struct oattr { /* Object attribute */
25 struct oattr *next, *same;
30 void obj_dump(struct odes *);
31 struct odes *obj_new(struct mempool *);
32 int obj_read(struct fastbuf *, struct odes *);
33 void obj_write(struct fastbuf *, struct odes *);
34 void obj_write_nocheck(struct fastbuf *, struct odes *);
35 struct oattr *obj_find_attr(struct odes *, uns);
36 struct oattr *obj_find_attr_last(struct odes *, uns);
37 uns obj_del_attr(struct odes *, struct oattr *);
38 byte *obj_find_aval(struct odes *, uns);
39 struct oattr *obj_set_attr(struct odes *, uns, byte *);
40 struct oattr *obj_set_attr_num(struct odes *, uns, uns);
41 struct oattr *obj_add_attr(struct odes *, uns, byte *);
42 struct oattr *obj_prepend_attr(struct odes *, uns, byte *);
43 struct oattr *obj_insert_attr(struct odes *o, struct oattr *first, struct oattr *after, byte *v);