Reformat the WebRTC code base
Running clang-format with chromium's style guide. The goal is n-fold: * providing consistency and readability (that's what code guidelines are for) * preventing noise with presubmit checks and git cl format * building on the previous point: making it easier to automatically fix format issues * you name it Please consider using git-hyper-blame to ignore this commit. Bug: webrtc:9340 Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87 Reviewed-on: https://webrtc-review.googlesource.com/81185 Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23660}
This commit is contained in:
@ -64,11 +64,13 @@ class Config {
|
||||
// Returned references are owned by this.
|
||||
//
|
||||
// Requires std::is_default_constructible<T>
|
||||
template<typename T> const T& Get() const;
|
||||
template <typename T>
|
||||
const T& Get() const;
|
||||
|
||||
// Set the option, deleting any previous instance of the same.
|
||||
// This instance gets ownership of the newly set value.
|
||||
template<typename T> void Set(T* value);
|
||||
template <typename T>
|
||||
void Set(T* value);
|
||||
|
||||
Config();
|
||||
~Config();
|
||||
@ -78,16 +80,14 @@ class Config {
|
||||
virtual ~BaseOption() {}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
struct Option : BaseOption {
|
||||
explicit Option(T* v): value(v) {}
|
||||
~Option() {
|
||||
delete value;
|
||||
}
|
||||
explicit Option(T* v) : value(v) {}
|
||||
~Option() { delete value; }
|
||||
T* value;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
static ConfigOptionID identifier() {
|
||||
return T::identifier;
|
||||
}
|
||||
@ -95,7 +95,7 @@ class Config {
|
||||
// Used to instantiate a default constructed object that doesn't needs to be
|
||||
// owned. This allows Get<T> to be implemented without requiring explicitly
|
||||
// locks.
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
static const T& default_value() {
|
||||
static const T* const def = new T();
|
||||
return *def;
|
||||
@ -109,7 +109,7 @@ class Config {
|
||||
void operator=(const Config&);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
const T& Config::Get() const {
|
||||
OptionMap::const_iterator it = options_.find(identifier<T>());
|
||||
if (it != options_.end()) {
|
||||
@ -121,7 +121,7 @@ const T& Config::Get() const {
|
||||
return default_value<T>();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
void Config::Set(T* value) {
|
||||
BaseOption*& it = options_[identifier<T>()];
|
||||
delete it;
|
||||
|
||||
Reference in New Issue
Block a user