XrmGetResource()XrmGetResource()NameXrmGetResource – get a resource from name and class as strings.
Synopsis
Bool XrmGetResource(database, str_name, str_class, str_type_return,
value_return)
XrmDatabase database;
char *str_name;
char *str_class;
char **str_type_return;
XrmValue *value_return;
Arguments
database Specifies the database that is to be used.
str_name Specifies the fully qualified name of the value being
retrieved.
str_class Specifies the fully qualified class of the value being
retrieved.
str_type_return
Returns a pointer to the representation type of the destina‐
tion. In this function, the representation type is repre‐
sented as a string, not as an XrmRepresentation.
value_return
Returns the value in the database. Do not modify or free
this data.
Returns
True if the resource was found, else False.
DescriptionXrmGetResource() retrieves a resource from the specified database. It
takes a fully qualified name/class pair, a destination resource repre‐
sentation, and the address of a value (size/address pair). The value
and returned type point into database memory; therefore, you must not
modify the data.
The database only frees or overwrites entries on XrmPutResource(),
XrmQPutResource(), or XrmMergeDatabases(). A client that is not stor‐
ing new values into the database or is not merging the database should
be safe using the address passed back at any time until it exits. If a
resource was found, XrmGetResource() returns True; otherwise it returns
False.
Most applications and toolkits do not make random probes into a
resource database to fetch resources. The X toolkit access pattern for
a resource database is quite stylized. A series of from 1 to 20 probes
are made with only the last name/class differing in each probe. XrmGe‐
tResource() uses at worst a 2n algorithm, where n is the length of the
name/class list. This can be improved upon by the application program‐
mer by prefetching a list of database levels that might match the first
part of a name/class list.
Structures
XrmDatabase is a pointer to an opaque data type.
typedef struct {
unsigned int size;
XPointer addr;
} XrmValue;
See AlsoXrmDestroyDatabase(), XrmGetFileDatabase(), XrmGetStringDatabase(),
XrmInitialize(), XrmMergeDatabases(), XrmParseCommand(), XrmPutFile‐
Database(), XrmPutLineResource(), XrmPutResource(), XrmPutStringRe‐
source(), XrmQGetResource(), XrmQGetSearchList(), XrmQGetSearchRe‐
source(), XrmQPutResource(), XrmQPutStringResource(), XrmQuark‐
ToString(), XrmStringToBindingQuarkList(), XrmStringToQuarkList(), Xrm‐
StringToQuark(), XrmUniqueQuark().
Xlib - Resource Manager XrmGetResource()