cups_deleters.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. #ifndef PRINTING_BACKEND_CUPS_DELETERS_H_
  5. #define PRINTING_BACKEND_CUPS_DELETERS_H_
  6. #include <cups/cups.h>
  7. #include <memory>
  8. #include "base/component_export.h"
  9. namespace printing {
  10. struct COMPONENT_EXPORT(PRINT_BACKEND) HttpDeleter {
  11. void operator()(http_t* http) const;
  12. };
  13. struct COMPONENT_EXPORT(PRINT_BACKEND) DestinationDeleter {
  14. void operator()(cups_dest_t* dest) const;
  15. };
  16. struct COMPONENT_EXPORT(PRINT_BACKEND) DestInfoDeleter {
  17. void operator()(cups_dinfo_t* info) const;
  18. };
  19. struct COMPONENT_EXPORT(PRINT_BACKEND) OptionDeleter {
  20. void operator()(cups_option_t* option) const;
  21. };
  22. using ScopedHttpPtr = std::unique_ptr<http_t, HttpDeleter>;
  23. using ScopedDestination = std::unique_ptr<cups_dest_t, DestinationDeleter>;
  24. using ScopedDestInfo = std::unique_ptr<cups_dinfo_t, DestInfoDeleter>;
  25. using ScopedCupsOption = std::unique_ptr<cups_option_t, OptionDeleter>;
  26. } // namespace printing
  27. #endif // PRINTING_BACKEND_CUPS_DELETERS_H_