VistaIOExtractAttr(3)

✨ NAME ✨

VistaIOExtractAttr β€” bestie, this is the one that fetches an attribute AND deletes it in one go πŸ’…

(Also, hi, this is from the Library Functions Manual, section 3, the VistaIO crew 🫢)


🌸 SYNOPSIS 🌸

VistaIOBoolean VistaIOExtractAttr (list, name, dict, repn, value, required)
       VistaIOAttrList list;
       VistaIOStringConst name;
       VistaIODictEntry *dict;
       VistaIORepnKind repn;
       VistaIOPointer value;
       VistaIOBoolean required;

πŸŽ€ ARGUMENTS πŸŽ€

  • list β€” the list of attributes we're gonna search through, by name, looking for the one you want. πŸ”
  • name β€” the name of the attribute you're manifesting.
  • dict β€” may specify a dictionary used to recognize a keyword stored as the attribute's value… or it can just be NULL, no pressure. πŸ™ˆ
  • repn β€” the representation you want the attribute value handed back to you in.
  • value β€” the location where the attribute value gets returned. πŸ“
  • required β€” is TRUE if not finding the attribute should count as an error. yes, it's that serious.

πŸ’– DESCRIPTION πŸ’–

VistaIOExtractAttr locates the first attribute named name in list, removes it if it's found, and returns its value. It's giving "grab your stuff and go" energy, fr fr.

So if a dictionary, dict, has been provided and the attribute's value is stored as a character string, the routine checks whether that string is a keyword defined in the dictionary. If it is, it uses the value associated with that keyword instead of the attribute's original value. (Peep the VistaIOdictionary(3) manual page for the deets.) πŸ‘‘

The value obtained β€” either directly from the attribute or indirectly via the dictionary β€” gets converted to the representation repn and then stored at the location pointed to by value. The repn argument may have any VistaIORepnKind value, or any of the values returned by VistaIORegisterType(3). However β€” and this is the part you can't skip, bestie β€” an attribute value that is a string can only be returned as a string or a number, and other attribute values can only be returned in the representation with which they are stored. (You can use the VistaIOGetAttrRepn(3) macro to figure out an attribute value's representation.) 🌈


πŸ”₯ RETURN VALUES πŸ”₯

VistaIOExtractAttr returns FALSE if required is TRUE and no attribute named name is found. It also returns FALSE if an attribute is found but its value cannot be converted to the desired representation. 😭

Otherwise, VistaIOExtractAttr returns TRUE while perhaps modifying the list list and storing a value at value. slay. ✨


🌟 SEE ALSO 🌟

VistaIOGetAttr(3), VistaIOGetAttrValue(3), VistaIOLookupAttr(3), VistaIODeleteAttr(3), VistaIOInsertAttr(3), VistaIOattribute(3), VistaIOdictionary(3),


πŸ¦‹ NOTES πŸ¦‹

  • VistaIOExtractAttr is meant for use with attribute lists representing sets, where each attribute name occurs at most once. If list contains multiple attributes named name, only the first is located. first come first served, iykyk. πŸ’€
  • The value argument must point to sufficient storage to contain a value of the representation requested. Neither the routine nor the C compiler can automatically check that this is so. πŸ‘€ no cap, you gotta get this right yourself.
  • If a string value is returned, it will be in newly-allocated storage. Release the storage with VistaIOFree(3) when you're done with the string. don't leave it hanging, bestie 🫢

πŸ’œ DIAGNOSTICS πŸ’œ

  • **``name attribute missing.''** β€” No attribute named *name* could be found, and *required* is TRUE`.
  • ``name attribute has bad value.''` β€” The attribute was found, but its value cannot be converted to the desired representation.

πŸ‘‘ AUTHOR πŸ‘‘

Art Pope <pope@cs.ubc.ca>

Adaption to vistaio: Gert Wollny <gw.fossdev@gmail.com>


okay that's the whole page, you ate that πŸ’… this was VistaIO Version 1.2.14, dated 24 April 1993 β€” iconic behavior, honestly. mwah πŸŽ€βœ¨