Back to index

tetex-bin  3.0
Public Member Functions | Private Member Functions | Private Attributes
Dict Class Reference

#include <Dict.h>

Collaboration diagram for Dict:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Dict (XRef *xrefA)
 ~Dict ()
int incRef ()
int decRef ()
int getLength ()
void add (char *key, Object *val)
GBool is (char *type)
Objectlookup (char *key, Object *obj)
ObjectlookupNF (char *key, Object *obj)
char * getKey (int i)
ObjectgetVal (int i, Object *obj)
ObjectgetValNF (int i, Object *obj)
void setXRef (XRef *xrefA)

Private Member Functions

DictEntryfind (char *key)

Private Attributes

XRefxref
DictEntryentries
int size
int length
int ref

Detailed Description

Definition at line 29 of file Dict.h.


Constructor & Destructor Documentation

Dict::Dict ( XRef xrefA)

Definition at line 26 of file Dict.cc.

                      {
  xref = xrefA;
  entries = NULL;
  size = length = 0;
  ref = 1;
}

Definition at line 33 of file Dict.cc.

            {
  int i;

  for (i = 0; i < length; ++i) {
    gfree(entries[i].key);
    entries[i].val.free();
  }
  gfree(entries);
}

Here is the call graph for this function:


Member Function Documentation

void Dict::add ( char *  key,
Object val 
)

Definition at line 43 of file Dict.cc.

                                     {
  if (length == size) {
    if (length == 0) {
      size = 8;
    } else {
      size *= 2;
    }
    entries = (DictEntry *)grealloc(entries, size * sizeof(DictEntry));
  }
  entries[length].key = key;
  entries[length].val = *val;
  ++length;
}

Here is the call graph for this function:

int Dict::decRef ( ) [inline]

Definition at line 40 of file Dict.h.

{ return --ref; }
DictEntry * Dict::find ( char *  key) [inline, private]

Definition at line 57 of file Dict.cc.

                                      {
  int i;

  for (i = 0; i < length; ++i) {
    if (!strcmp(key, entries[i].key))
      return &entries[i];
  }
  return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char * Dict::getKey ( int  i)

Definition at line 85 of file Dict.cc.

                        {
  return entries[i].key;
}

Here is the caller graph for this function:

int Dict::getLength ( ) [inline]

Definition at line 43 of file Dict.h.

{ return length; }

Here is the caller graph for this function:

Object * Dict::getVal ( int  i,
Object obj 
)

Definition at line 89 of file Dict.cc.

                                       {
  return entries[i].val.fetch(xref, obj);
}

Here is the call graph for this function:

Object * Dict::getValNF ( int  i,
Object obj 
)

Definition at line 93 of file Dict.cc.

                                         {
  return entries[i].val.copy(obj);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int Dict::incRef ( ) [inline]

Definition at line 39 of file Dict.h.

{ return ++ref; }

Here is the caller graph for this function:

GBool Dict::is ( char *  type)

Definition at line 67 of file Dict.cc.

                         {
  DictEntry *e;

  return (e = find("Type")) && e->val.isName(type);
}

Here is the call graph for this function:

Object * Dict::lookup ( char *  key,
Object obj 
)

Definition at line 73 of file Dict.cc.

                                           {
  DictEntry *e;

  return (e = find(key)) ? e->val.fetch(xref, obj) : obj->initNull();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Object * Dict::lookupNF ( char *  key,
Object obj 
)

Definition at line 79 of file Dict.cc.

                                             {
  DictEntry *e;

  return (e = find(key)) ? e->val.copy(obj) : obj->initNull();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Dict::setXRef ( XRef xrefA) [inline]

Definition at line 64 of file Dict.h.

{ xref = xrefA; }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 69 of file Dict.h.

int Dict::length [private]

Definition at line 71 of file Dict.h.

int Dict::ref [private]

Definition at line 72 of file Dict.h.

int Dict::size [private]

Definition at line 70 of file Dict.h.

XRef* Dict::xref [private]

Definition at line 68 of file Dict.h.


The documentation for this class was generated from the following files: