VistaIOEncodeAttrValue(3)

NAME
VistaIOEncodeAttrValue - encode an attribute value

SYNOPSIS
VistaIOStringConst VistaIOEncodeAttrValue (dict, repn, value)
    VistaIODictEntry *dict;
    VistaIORepnKind repn;
    type value;

where type, according to repn, is VistaIOBit, VistaIOUByte, VistaIOSByte, VistaIOShort, VistaIOLong, VistaIOFloat, VistaIODouble, VistaIOBoolean, or VistaIOString.

ARGUMENTS

dict
    May specify a dictionary to be used in translating the value supplied to a keyword that should be returned as the encoded value, or it may be NULL

repn
    Specifies the representation of the value to be encoded.

value
    Specifies the value to be encoded.

DESCRIPTION
VistaIOEncodeAttrValue takes a value and an optional dictionary, and encodes the value as a character string suitable for storage in an attribute list or output to a data file.

With the dict argument you can provide a dictionary for mapping value to a keyword that will be returned as the encoded value (see VistaIOdictionary(3)). For example, if you pass a value of 1 and a dictionary that associates the value 1 with the keyword ubyte (as the dictionaryVistaIORepnDict does), then the string ubyte will be returned. Dictionaries may be used to map both numeric values and strings to keywords. If you supply a dictionary but value is not mentioned in that dictionary, then value itself will be encoded as a string and returned.

RETURN VALUES
If successful, VistaIOEncodeAttrValue returns a string that is valid until the next VistaIOEncodeAttrValue, VistaIOSetAttr, or VistaIOSetAttrValue call. If, on the other hand, it fails because repn is not one of the representations supported, it returns NULL

SEE ALSO
VistaIODecodeAttrValue(3), VistaIOSetAttr(3), VistaIOattribute(3),

DIAGNOSTICS

``Can't encode from repn.''
    The repn argument is not one of VistaIOBitRepn, VistaIOUByteRepn, ..., VistaIOBooleanRepn, or VistaIOStringRepn.

AUTHOR
Art Pope <pope@cs.ubc.ca>

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