blob: 32a2e47eed657bed87f5560fb9e9636831f3cc92 [file] [log] [blame]
Jonas Orelanded99dae2022-03-09 08:28:101/*
2 * Copyright 2019 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#ifndef API_WEBRTC_KEY_VALUE_CONFIG_H_
11#define API_WEBRTC_KEY_VALUE_CONFIG_H_
12
13#include <string>
14
15#include "absl/strings/string_view.h"
16#include "rtc_base/system/rtc_export.h"
17
18namespace webrtc {
19
20// An interface that provides a key-value mapping for configuring internal
21// details of WebRTC. Note that there's no guarantess that the meaning of a
22// particular key value mapping will be preserved over time and no announcements
23// will be made if they are changed. It's up to the library user to ensure that
24// the behavior does not break.
25class RTC_EXPORT WebRtcKeyValueConfig {
26 public:
27 virtual ~WebRtcKeyValueConfig() = default;
28 // The configured value for the given key. Defaults to an empty string.
29 virtual std::string Lookup(absl::string_view key) const = 0;
30
31 bool IsEnabled(absl::string_view key) const {
32 return Lookup(key).find("Enabled") == 0;
33 }
34
35 bool IsDisabled(absl::string_view key) const {
36 return Lookup(key).find("Disabled") == 0;
37 }
38};
39} // namespace webrtc
40
41#endif // API_WEBRTC_KEY_VALUE_CONFIG_H_