You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.3 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. #import "RTCIntervalRange+Private.h"
  11. #include "rtc_base/checks.h"
  12. @implementation RTCIntervalRange
  13. @synthesize min = _min;
  14. @synthesize max = _max;
  15. - (instancetype)init {
  16. return [self initWithMin:0 max:0];
  17. }
  18. - (instancetype)initWithMin:(NSInteger)min
  19. max:(NSInteger)max {
  20. RTC_DCHECK_LE(min, max);
  21. if (self = [super init]) {
  22. _min = min;
  23. _max = max;
  24. }
  25. return self;
  26. }
  27. - (instancetype)initWithNativeIntervalRange:(const rtc::IntervalRange &)config {
  28. return [self initWithMin:config.min() max:config.max()];
  29. }
  30. - (NSString *)description {
  31. return [NSString stringWithFormat:@"[%ld, %ld]", (long)_min, (long)_max];
  32. }
  33. #pragma mark - Private
  34. - (std::unique_ptr<rtc::IntervalRange>)nativeIntervalRange {
  35. std::unique_ptr<rtc::IntervalRange> nativeIntervalRange(
  36. new rtc::IntervalRange((int)_min, (int)_max));
  37. return nativeIntervalRange;
  38. }
  39. @end