/*
 * thing: a barebones associative array
 * should I redo this as a template, so I can use it to hold arbitrary
 * data?
 *
 * Copyright (c) 1997 David L Parsons 
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms are permitted
 * provided that the above copyright notice and this paragraph are
 * duplicated in all such forms and that any documentation,
 * advertising materials, and other materials related to such
 * distribution and use acknowledge that the software was developed
 * by David L Parsons (orc@pell.chi.il.us).  My name may not be used
 * to endorse or promote products derived from this software without
 * specific prior written permission.  THIS SOFTWARE IS PROVIDED
 * ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
 * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE.
 */
#ifndef THING_D
#define THING_D

extern "C" {
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include <stdlib.h>
}

/*
 * a semi-private class that contains the list
 */
class litem {
public:
    int valid;
    char *name;
    void *value;
    inline int null() { return !valid; }
    int print(FILE *output = stdout);
    void *operator = (void *rval);
}; 

/*
 * the associative array, in mortal flesh; should this be a template?
 */
class thing {
private:
    litem *list;
    int count;
public:
    thing();
    ~thing();
    int assoc(char *name);
    litem &operator[] (char *key);
    litem &find(char *key);
};

#endif/*THING_D*/
