cups_ipp_helper.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. // Methods for parsing IPP Printer attributes.
  5. #ifndef PRINTING_BACKEND_CUPS_IPP_HELPER_H_
  6. #define PRINTING_BACKEND_CUPS_IPP_HELPER_H_
  7. #include <memory>
  8. #include "base/component_export.h"
  9. #include "printing/backend/cups_printer.h"
  10. #include "printing/backend/print_backend.h"
  11. namespace printing {
  12. // Smart ptr wrapper for CUPS ipp_t
  13. using ScopedIppPtr = std::unique_ptr<ipp_t, void (*)(ipp_t*)>;
  14. // Returns the default paper setting for `printer`.
  15. COMPONENT_EXPORT(PRINT_BACKEND)
  16. PrinterSemanticCapsAndDefaults::Paper DefaultPaper(
  17. const CupsOptionProvider& printer);
  18. // Populates the `printer_info` object with attributes retrieved using IPP from
  19. // `printer`.
  20. COMPONENT_EXPORT(PRINT_BACKEND)
  21. void CapsAndDefaultsFromPrinter(const CupsOptionProvider& printer,
  22. PrinterSemanticCapsAndDefaults* printer_info);
  23. // Wraps `ipp` in unique_ptr with appropriate deleter
  24. COMPONENT_EXPORT(PRINT_BACKEND) ScopedIppPtr WrapIpp(ipp_t* ipp);
  25. } // namespace printing
  26. #endif // PRINTING_BACKEND_CUPS_IPP_HELPER_H_