[cups.development] Retrieve string value from attributes

Michael R Sweet msweet at apple.com
Wed Aug 27 11:46:31 PDT 2008


Cherif YAYA wrote:
> After a call to cupsDoRequest(), one can retrieve response attributes from the response ipp_t object.
> For instance to retrieve all integers :
> 
> ..
> ipp_t* resp = cupsDoRequest(...)
> ipp_attribute_t* attr;
> for(attr = resp->attrs;attr;attr = attr->next){
>    if(attr->value_tag == IPP_TAG_INTEGER)
>      int i = attr->value[0].integer;
> }
> ..
> 
> But the ipp_value_u doesn't have a field for char values. (as far as I can tell).
> So, can we retrieve the value when the attribute is string valued one (IPP_TAG_STRING,IPP_TAG_URI...)?

The string can be found in values[n].string.text.  For IPP
conformance, we also support the "textWithLanguage" and
"nameWithLanguage" types (IPP_TAG_TEXTLANG and IPP_TAG_NAMELANG
respectively) which also have a values[n].string.charset string
containing the character set for the string, however CUPS only
supports UTF-8 strings internally.

-- 
______________________________________________________________________
Michael R Sweet                        Senior Printing System Engineer





More information about the cups-devel mailing list