OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #import "RTCIntervalRange+Private.h" |
| 12 |
| 13 #include "webrtc/rtc_base/checks.h" |
| 14 |
| 15 @implementation RTCIntervalRange |
| 16 |
| 17 @synthesize min = _min; |
| 18 @synthesize max = _max; |
| 19 |
| 20 - (instancetype)init { |
| 21 return [self initWithMin:0 max:0]; |
| 22 } |
| 23 |
| 24 - (instancetype)initWithMin:(NSInteger)min |
| 25 max:(NSInteger)max { |
| 26 RTC_DCHECK_LE(min, max); |
| 27 if (self = [super init]) { |
| 28 _min = min; |
| 29 _max = max; |
| 30 } |
| 31 return self; |
| 32 } |
| 33 |
| 34 - (instancetype)initWithNativeIntervalRange:(const rtc::IntervalRange &)config { |
| 35 return [self initWithMin:config.min() max:config.max()]; |
| 36 } |
| 37 |
| 38 - (NSString *)description { |
| 39 return [NSString stringWithFormat:@"[%ld, %ld]", (long)_min, (long)_max]; |
| 40 } |
| 41 |
| 42 #pragma mark - Private |
| 43 |
| 44 - (std::unique_ptr<rtc::IntervalRange>)nativeIntervalRange { |
| 45 std::unique_ptr<rtc::IntervalRange> nativeIntervalRange( |
| 46 new rtc::IntervalRange((int)_min, (int)_max)); |
| 47 return nativeIntervalRange; |
| 48 } |
| 49 |
| 50 @end |
OLD | NEW |