summaryrefslogtreecommitdiffstats
path: root/printing/page_range.h
diff options
context:
space:
mode:
Diffstat (limited to 'printing/page_range.h')
-rw-r--r--printing/page_range.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/printing/page_range.h b/printing/page_range.h
new file mode 100644
index 0000000..1237d5d
--- /dev/null
+++ b/printing/page_range.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PRINTING_PAGE_RANGE_H_
+#define PRINTING_PAGE_RANGE_H_
+
+#include <vector>
+
+namespace printing {
+
+struct PageRange;
+
+typedef std::vector<PageRange> PageRanges;
+
+// Print range is inclusive. To select one page, set from == to.
+struct PageRange {
+ int from;
+ int to;
+
+ bool operator==(const PageRange& rhs) const {
+ return from == rhs.from && to == rhs.to;
+ }
+
+ // Retrieves the sorted list of unique pages in the page ranges.
+ static std::vector<int> GetPages(const PageRanges& ranges);
+
+ // Gets the total number of pages.
+ static int GetTotalPages(const PageRanges& ranges);
+};
+
+} // namespace printing
+
+#endif // PRINTING_PAGE_RANGE_H_