XrmPutResource(3)

πŸ’… XrmPutResource β€” store database resources (bestie edition)

okay so this is a whole family of libX11 functions from <X11/Xresource.h> that literally just put resources into your XrmDatabase. five functions, one mission: get that data in. it's giving "I'm the write half of the database API." let's go πŸ’–


✨ SYNTAX ✨

#include <X11/Xresource.h>

void XrmPutResource(XrmDatabase *database, char *specifier, char *type,
       XrmValue *value);

void XrmQPutResource(XrmDatabase *database, XrmBindingList bindings,
       XrmQuarkList quarks, XrmRepresentation type, XrmValue *value);

void XrmPutStringResource(XrmDatabase *database, _Xconst char
       *specifier, _Xconst char *value);

void XrmQPutStringResource(XrmDatabase *database, XrmBindingList
       bindings, XrmQuarkList quarks, _Xconst char *value);

void XrmPutLineResource(XrmDatabase *database, _Xconst char *line);

πŸŽ€ ARGUMENTS πŸŽ€

  • bindings β€” a list of bindings, periodt.
  • database β€” the resource database in question. iconic.
  • line β€” the resource name and value pair, but as one single string. lowkey efficient.
  • quarks β€” the complete or partial name, or the class list, of the resource (as quarks, obviously πŸ¦‹).
  • specifier β€” a complete or partial specification of the resource.
  • type β€” the type of the resource.
  • value β€” the value of the resource, and it's specified as a string, no cap.

🌸 DESCRIPTION 🌸

πŸ’œ XrmPutResource

if database contains NULL, XrmPutResource creates a new database and returns a pointer to it (main character energy fr fr). it's a convenience function that calls XrmStringToBindingQuarkList and then hits you with:

XrmQPutResource(database, bindings, quarks, XrmStringToQuark(type), value)

if the specifier and type are not in the Host Portable Character Encoding, the result is implementation-dependent 😭. the value is stored in the database without modification β€” no edits, no notes, just vibes preserved.

πŸ¦‹ XrmQPutResource

if database contains NULL, XrmQPutResource creates a new database and returns a pointer to it. and listen: if a resource entry with the identical bindings and quarks already exists in the database, the previous type and value get replaced by the new specified type and value. it ate and left no crumbs πŸ’…. the value is stored in the database without modification.

πŸŽ€ XrmPutStringResource

if database contains NULL, XrmPutStringResource creates a new database and returns a pointer to it. it adds a resource with the specified value to the specified database. it's a convenience function that first calls XrmStringToBindingQuarkList on the specifier and then calls XrmQPutResource, using a "String" representation type. if the specifier is not in the Host Portable Character Encoding, the result is implementation-dependent πŸ™ˆ. the value is stored in the database without modification.

⭐ XrmQPutStringResource

if database contains NULL, XrmQPutStringResource creates a new database and returns a pointer to it. it's a convenience routine that constructs an XrmValue for the value string (by calling strlen to compute the size, look at her go) and then calls XrmQPutResource, using a "String" representation type. the value is stored in the database without modification.

🌈 XrmPutLineResource

if database contains NULL, XrmPutLineResource creates a new database and returns a pointer to it. it adds a single resource entry to the specified database. the line should be in valid ResourceLine format (see section 15.1) terminated by a newline or null character.

⚠️ bestie be careful: the database that results from using a string with incorrect syntax is implementation-dependent. live your truth but maybe validate first 😭

the string is parsed in the locale of the database. if the ResourceName is not in the Host Portable Character Encoding, the result is implementation-dependent. and don't forget: comment lines are not stored πŸ‘‘.


πŸ”₯ SEE ALSO πŸ”₯


that's the whole lore, bestie 🫢. this page is from X Version 11, libX11 1.8.14 β€” yeah, that libX11, the iconic one. mwah, go populate some databases πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from