RbInfoHash Class

Overview

This class is used to maintain a HashTable of NAME=VALUE entries that represent the information in a .info file. The RbMake class has an "infoHash" member variable that is used to determine what data gets put into the book's .info file.

The RbInfoHash_newFromMBuf() function creates a new RbInfoHash object from an MBuf object. Use this if you have a buffer of NAME=VALUE entries, one per line (separated by a newline only).

The RbInfoHash_newFromRbFile() function creates a new RbInfoHash object from an RbFile object (representing an open .rb file).

The RbInfoHash_toMBuf() function turns an RbInfoHash object into an MBuf. The NAME=VALUE entries are rendered one per line, separated by newlines (suitable for writing out to a .rb file).

The RbInfoHash_maybeStore() function sets the value of the indicated key name if (and only if) the key name does not already have a value.

The RbInfoHash_mergeFromHash() function merges an RbInfoHash object into another RbInfoHash object. This means that any entries that we find in the second object that are not already set in the first object are added to the first object. The second object is destroyed in the process of merging its contents into the first object.

The RbInfoHash_mergeFromMBuf() function parses the MBuf into a set of NAME=VALUE pairs, and then merges it into the RbInfoHash object.

The RbInfoHash_mergeFromRbFile() function reads the info data from the indicated RbFile object, and merges it into the RbInfoHash object.

The RbInfoHash_mergeFromFile() function reads the info data from the indicated URL and merges it into the RbInfoHash object. If the filename is "-", the data is read from stdin. Otherwise the name must be either a file: or http: URL to read or fetch.