1 // Copyright 2011 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef PRINTING_PAGE_RANGE_H_
6 #define PRINTING_PAGE_RANGE_H_
13 #include "base/component_export.h"
19 using PageRanges = std::vector<PageRange>;
21 // Print range is inclusive. To select one page, set from == to.
22 struct COMPONENT_EXPORT(PRINTING) PageRange {
23 // Any value above maximum practical page count (enforced by PageNumber)
24 // would work, but we chose something that works even where the page
25 // numbers are 1-based (i.e. can be increased by one without overflow).
26 static constexpr uint32_t kMaxPage = std::numeric_limits<uint32_t>::max() - 1;
31 bool operator<(const PageRange& rhs) const {
32 return from < rhs.from || (from == rhs.from && to < rhs.to);
34 bool operator==(const PageRange& rhs) const {
35 return from == rhs.from && to == rhs.to;
38 // Ensures entries come in monotonically increasing order and do not
40 static void Normalize(PageRanges& ranges);
43 } // namespace printing
45 #endif // PRINTING_PAGE_RANGE_H_