VistaIOGetAttr(3)
π VistaIOGetAttr π
ok so bestie, we're in section 3 of the Library Functions Manual today and the vibe is immaculate β this is the VistaIOGetAttr page, aka the one where you finally learn how to snatch an attribute's value out of a list. let's go π«Ά
β¨ NAME β¨
VistaIOGetAttr, VistaIOGetAttrValue β fetch an attribute's value π
πΈ SYNOPSIS πΈ
VistaIOGetAttrResult VistaIOGetAttr (list, name, dict, repn, value)
VistaIOAttrList list;
VistaIOStringConst name;
VistaIODictEntry *dict;
VistaIORepnKind repn;
VistaIOPointer value;
typedef enum { VistaIOAttrFound, VistaIOAttrMissing, VistaIOAttrBadValue } VistaIOGetAttrResult;
VistaIOBoolean VistaIOGetAttrValue (posn, dict, repn, value)
VistaIOAttrListPosn *posn;
VistaIODictEntry *dict;
VistaIORepnKind repn;
VistaIOPointer value;
π ARGUMENTS π
listβ the list of attributes we're gonna search by name to find the one you want. it's giving directory energy πnameβ the name of the attribute you're looking for. literally just the name. iconic.posnβ where the desired attribute is chillin' inside its attribute list. it's the position, bestie πdictβ may specify a dictionary used for recognizing a keyword that's stored as the attribute's valueβ¦ or it can beNULL. your call, queen πrepnβ the representation you want the attribute value returned in. like, what form should it come back as? π€valueβ the location where the attribute value gets returned. this is where it lands, no cap π¬
π¦ DESCRIPTION π¦
okay so both of these routines return an attribute's value, right? but the way they find the attribute is different, and that's the whole plot twist:
VistaIOGetAttrfetches the value of the first attribute with the namenamein the listlist. π₯VistaIOGetAttrValuefetches the value of the attribute whose position within an attribute list isposn. π«
now here's the part where it gets juicy. 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 tea β)
the value you get β whether it came 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 (like, any of the values returned by VistaIORegisterType(3)). however β and this is the catch, 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. (the VistaIOGetAttrRepn(3) macro can tell you an attribute value's representation if you're ever unsure π)
so about copying: if repn calls for a number to be returned, the caller receives a copy of the value stored with the attribute. if, on the other hand, it calls for a string, attribute list, pointer, image, edge set, etc., the caller receives a pointer to the same value as that stored with the attribute. same value, not a copy. noted. βοΈ
π RETURN VALUES π
- if the specified attribute is not found,
VistaIOGetAttrreturnsVistaIOAttrMissing. π - if it is found but its value can't be converted to the desired representation,
VistaIOGetAttrreturnsVistaIOAttrBadValue. π - otherwise?
VistaIOGetAttris successful and returnsVistaIOAttrFound, having stored the attribute's value at*value. slay β¨
and for the other one:
VistaIOGetAttrValuereturnsTRUEif it's successfully returning the attribute's value at*value, andFALSEif the value can't be converted to the desired representation. simple as that π
π EXAMPLES π
okay this code fragment prints the name of an image, and honestly it eats:
VistaIOImage image;
VistaIOStringConst name;
if (VistaIOGetAttr (VistaIOImageAttrList (image), VistaIONameAttr, NULL,
VistaIOStringRepn, (VistaIOPointer) & name) == VistaIOAttrFound)
printf ("Name: %s\n", name);
β SEE ALSO β
VistaIOExtractAttr(3), VistaIOSetAttr(3), VistaIOSetAttrValue(3), VistaIOattribute(3), VistaIOdictionary(3),
π§ NOTES π§
VistaIOGetAttris meant for use with attribute lists representing sets, in which each attribute name occurs at most once. iflistcontains multiple attributes namedname, only the first is located and returned. first come, first served, periodt π
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. this is a you problem, bestie, and the compiler will not save you π
π AUTHOR π
Art Pope <pope@cs.ubc.ca>
Adaption to vistaio: Gert Wollny <gw.fossdev@gmail.com>
and that's the whole page, bestie π this was VistaIO Version 1.2.14, dated 24 April 1993 β a whole vintage icon that's still serving looks. go forth and fetch those attributes, you've got this π¦β¨π
π¦ where this page comes from
- debian bookworm: libvistaio-dev 1.2.19-3 Β· libvista-orig
- debian trixie: libvistaio-dev 1.2.19-3+b2 Β· libvista-orig
- ubuntu jammy: libvistaio-dev 1.2.19-3 Β· libvista-orig
- ubuntu noble: libvistaio-dev 1.2.19-3 Β· libvista-orig
- ubuntu questing: libvistaio-dev 1.2.19-4
- ubuntu resolute: libvistaio-dev 1.2.19-4build1 Β· libvista-orig
- ubuntu stonking: libvistaio-dev 1.2.19-4build1 Β· libvista-orig
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms