5#ifndef UI_GFX_RANGE_RANGE_H_
6#define UI_GFX_RANGE_RANGE_H_
20#import <Foundation/Foundation.h>
22typedef struct _NSRange NSRange;
39 constexpr Range(uint32_t start, uint32_t end) : start_(
start), end_(
end) {}
42 constexpr explicit Range(uint32_t position) :
Range(position, position) {}
46 explicit Range(
const NSRange& range);
53 constexpr bool IsValid()
const {
return *
this != InvalidRange(); }
56 constexpr uint32_t
start()
const {
return start_; }
59 constexpr uint32_t
end()
const {
return end_; }
63 constexpr uint32_t
length()
const {
return GetMax() - GetMin(); }
77 return GetMin() == other.
GetMin() && GetMax() == other.
GetMax();
81 constexpr bool Intersects(
const Range& range)
const {
return Intersect(range).IsValid(); }
93 return IsValid() && range.
IsValid() && GetMin() >= range.
GetMin() && GetMax() <= range.
GetMax();
107 Range& operator=(
const NSRange& range);
111 NSRange ToNSRange()
const;
static void is_empty(skiatest::Reporter *reporter, const SkPath &p)
constexpr bool Intersects(const Range &range) const
constexpr Range Intersect(const Range &range) const
constexpr uint32_t GetMax() const
constexpr bool is_empty() const
constexpr bool IsBoundedBy(const Range &range) const
constexpr uint32_t GetMin() const
constexpr bool EqualsIgnoringDirection(const Range &other) const
constexpr bool operator!=(const Range &other) const
void set_start(uint32_t start)
constexpr bool operator==(const Range &other) const
constexpr uint32_t end() const
constexpr bool IsValid() const
constexpr uint32_t length() const
constexpr uint32_t start() const
constexpr Range(uint32_t position)
constexpr Range(uint32_t start, uint32_t end)
constexpr bool is_reversed() const
void set_end(uint32_t end)
constexpr bool Contains(const Range &range) const
static constexpr Range InvalidRange()
static float max(float r, float g, float b)
static float min(float r, float g, float b)
bool Contains(const Container &container, const Value &value)
std::ostream & operator<<(std::ostream &os, const Range &range)
static std::string ToString(CompilerBackend::Type type)