OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/editing/state_machines/TextSegmentationMachineState.h" | 5 #include "core/editing/state_machines/TextSegmentationMachineState.h" |
6 | 6 |
| 7 #include <ostream> // NOLINT |
7 #include "wtf/Assertions.h" | 8 #include "wtf/Assertions.h" |
8 #include <ostream> // NOLINT | |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 std::ostream& operator<<(std::ostream& os, TextSegmentationMachineState state) { | 12 std::ostream& operator<<(std::ostream& os, TextSegmentationMachineState state) { |
13 static const char* const texts[] = { | 13 static const char* const texts[] = { |
14 "Invalid", "NeedMoreCodeUnit", "NeedFollowingCodeUnit", "Finished", | 14 "Invalid", "NeedMoreCodeUnit", "NeedFollowingCodeUnit", "Finished", |
15 }; | 15 }; |
16 | 16 |
17 const auto& it = std::begin(texts) + static_cast<size_t>(state); | 17 const auto& it = std::begin(texts) + static_cast<size_t>(state); |
18 DCHECK_GE(it, std::begin(texts)) << "Unknown state value"; | 18 DCHECK_GE(it, std::begin(texts)) << "Unknown state value"; |
19 DCHECK_LT(it, std::end(texts)) << "Unknown state value"; | 19 DCHECK_LT(it, std::end(texts)) << "Unknown state value"; |
20 return os << *it; | 20 return os << *it; |
21 } | 21 } |
22 | 22 |
23 } // namespace blink | 23 } // namespace blink |
OLD | NEW |