src/pmc/packfiledirectory.pmc - PackfileDirectory PMC


This class implements a PackfileDirectory object, a segment of the .pbc data file used for listing the rest of the file's contents. Essentially this segment is a container for all other segments within a Packfile.

See packfile.pmc for the toplevel Packfile interface, see packfilesegment.pmc for the list of common methods every packfile segment pmc must implement; see PDD13 for the design spec.

Methods ^

INTVAL elements()

Get the number of elements in the array.

PMC *get_pmc_keyed_int(INTVAL index)

Fetch a segment PMC from the array.

STRING *get_string_keyed_int(INTVAL index)

Fetch a string containing the name of the specified segment PMC.

PMC *get_pmc_keyed_str(STRING *name)

Search the array for a segment with the given name, and return it if it exists.

PMC *get_pmc_keyed(PMC *key)

Fetch a keyed string value from the packfiledirectory object. Dispatches to get_pmc_keyed_str.

void set_pmc_keyed_str(STRING *name, PMC *segment)

Add a segment with the given name to the directory. If a segment with this name already existed, it will be replaced with the new segment.