Example #1
0
option_values_t
destination_implObj::default_option_values(const std::string_view &option)
	const
{
	auto s=option.size();

	char option_s[s+1];

	std::copy(option.begin(), option.end(), option_s);
	option_s[s]=0;

	auto[name, unicode_flag]=parse_unicode_option(option_s);

	info_t::lock lock{*this};

	auto attrs=cupsFindDestDefault(lock->http, lock->dest,
				       lock->info,
				       name);

	return parse_attribute_values(lock, attrs, name, unicode_flag);
}
Example #2
0
static void
show_default(http_t       *http,	/* I - Connection to destination */
	     cups_dest_t  *dest,	/* I - Destination */
	     cups_dinfo_t *dinfo,	/* I - Destination information */
	     const char  *option)	/* I - Option */
{
  if (!strcmp(option, "media"))
  {
   /*
    * Show default media option...
    */

    cups_size_t size;                   /* Media size information */

    if (cupsGetDestMediaDefault(http, dest, dinfo, CUPS_MEDIA_FLAGS_DEFAULT, &size))
      printf("%s (%.2fx%.2fmm, margins=[%.2f %.2f %.2f %.2f])\n", size.media, size.width * 0.01, size.length * 0.01, size.left * 0.01, size.bottom * 0.01, size.right * 0.01, size.top * 0.01);
     else
       puts("FAILED");
  }
  else
  {
   /*
    * Show default other option...
    */

    ipp_attribute_t *defattr;           /* Default attribute */

    if ((defattr = cupsFindDestDefault(http, dest, dinfo, option)) != NULL)
    {
      char value[1024];                 /* Value of default attribute */

      ippAttributeString(defattr, value, sizeof(value));
      puts(value);
    }
    else
      puts("FAILED");
  }
}