mirror of
https://pdfium.googlesource.com/pdfium
synced 2026-07-31 22:26:36 +08:00
Updates old-style copyright headers to the new style, by removing "All rights reserved." Also inserts "The" before "PDFium Authors", which is required by both styles. Mechanically generated by this command: PATTERN='Copyright \([0-9]\+\) \(The \)\?PDFium Authors. All rights reserved.' git grep -l "$PATTERN" \ | xargs sed "s/$PATTERN/Copyright \1 The PDFium Authors/" -i'' Fixed: pdfium:1884 Change-Id: I6f781d811df8839e2e21b85f716529b813828bcd Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/100371 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: K. Moon <kmoon@chromium.org>
48 lines
998 B
C++
48 lines
998 B
C++
// Copyright 2017 The PDFium Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef TESTING_RANGE_SET_H_
|
|
#define TESTING_RANGE_SET_H_
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <set>
|
|
#include <utility>
|
|
|
|
class RangeSet {
|
|
public:
|
|
using Range = std::pair<size_t, size_t>;
|
|
|
|
RangeSet();
|
|
~RangeSet();
|
|
|
|
bool Contains(const Range& range) const;
|
|
|
|
void Union(const Range& range);
|
|
|
|
void Union(const RangeSet& range_set);
|
|
|
|
bool IsEmpty() const { return ranges().empty(); }
|
|
|
|
void Clear() { ranges_.clear(); }
|
|
|
|
struct range_compare {
|
|
bool operator()(const Range& lval, const Range& rval) const {
|
|
return lval.first < rval.first;
|
|
}
|
|
};
|
|
|
|
using RangesContainer = std::set<Range, range_compare>;
|
|
const RangesContainer& ranges() const { return ranges_; }
|
|
|
|
private:
|
|
Range FixDirection(const Range& range) const;
|
|
|
|
bool IsEmptyRange(const Range& range) const;
|
|
|
|
RangesContainer ranges_;
|
|
};
|
|
|
|
#endif // TESTING_RANGE_SET_H_
|