13.4.3 Resource Access Functions

The following paragraphs describe the CLX functions used to return a value from a resource database.



get-resource database attribute-name attribute-class path-name path-class Function
        
database
A resource-database.
attribute-name
A string or symbol giving an attribute name from a complete resource name.
attribute-class
A string or symbol giving an attribute class name from a complete resource class.
path-name
The path list from a complete resource name. path-name and path-class must have the same length.
path-class
The path list from a complete resource class. path-name and path-class must have the same length.

Returns the value of the resource binding in the database whose resource name most closely matches the complete resource name/class given by the path-name, path-class, attribute-name, and attribute-class. The lookup algorithm implements the precedence rules described previously to determine the closest match. When comparing name elements, case is significant only if both elements are strings; otherwise, element matching is case-insensitive.

value
Type t.


get-search-table database path-name path-class Function
        
database
A resource-database.
path-name
The path list from a complete resource name. path-name and path-classmust have the same length.
path-class
The path list from a complete resource class. path-name and path-class must have the same length.

Returns a table containing the subset of the database that matches the path-name and path-class. Resources using the same path-name and path-class can be accessed much more efficiently by using this table as an argument to get-search-resource.

search-table
Type list.


get-search-resource table attribute-name attribute-class Function
        
table
A search table returned by get-search-table.
attribute-name
A string or symbol giving an attribute name from a complete resource name.
attribute-class
A string or symbol giving an attribute class name from a complete resource class.

Returns the value of the resource binding in the search table that most closely matches the attribute-name and attribute-class. The table is computed by get-search-table and represents a set of resource bindings. The closest match is determined by the same algorithm used in get-resource.

The following two forms are functionally equivalent:

(get-resource
  database attribute-name attribute-class path-name path-class)

(get-search-resource
 (get-search-table database path-name path-class)
 attribute-name attribute-class)
                      

However, the hard part of the search is done by get-search-table. Looking up values for several resource attributes that share the same path list can be done much more efficiently with calls to get-search-resource.

value
Type t.