summaryrefslogtreecommitdiff
path: root/chromium/components/viz/common/quads/selection.h
blob: b27dd41700cbec5e78d07ed2bebe652858f57e00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2014 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 COMPONENTS_VIZ_COMMON_QUADS_SELECTION_H_
#define COMPONENTS_VIZ_COMMON_QUADS_SELECTION_H_

#include "base/strings/stringprintf.h"

namespace viz {

template <typename BoundType>
struct Selection {
  Selection() = default;
  ~Selection() = default;

  BoundType start, end;

  std::string ToString() const {
    return base::StringPrintf("Selection(%s, %s)", start.ToString().c_str(),
                              end.ToString().c_str());
  }
};

template <typename BoundType>
inline bool operator==(const Selection<BoundType>& lhs,
                       const Selection<BoundType>& rhs) {
  return lhs.start == rhs.start && lhs.end == rhs.end;
}

template <typename BoundType>
inline bool operator!=(const Selection<BoundType>& lhs,
                       const Selection<BoundType>& rhs) {
  return !(lhs == rhs);
}

}  // namespace viz

#endif  // COMPONENTS_VIZ_COMMON_QUADS_SELECTION_H_