This source file includes following definitions.
- GetPages
#include "printing/page_range.h"
#include <set>
namespace {
const std::size_t kMaxNumberOfPages = 100000;
}
namespace printing {
std::vector<int> PageRange::GetPages(const PageRanges& ranges) {
std::set<int> pages;
for (unsigned i = 0; i < ranges.size(); ++i) {
const PageRange& range = ranges[i];
for (int i = range.from; i <= range.to; ++i) {
pages.insert(i);
if (pages.size() >= kMaxNumberOfPages)
return std::vector<int>(pages.begin(), pages.end());
}
}
return std::vector<int>(pages.begin(), pages.end());
}
}