Skip to content

Commit

Permalink
Suport ControlFlags with PollingControlProxy()
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Aug 20, 2021
1 parent 7e97541 commit 9fd7153
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions src/control/pollingcontrolproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,21 @@
/// It is basically a PIMPL version of a ControlDoublePrivate Shared pointer
class PollingControlProxy {
public:
PollingControlProxy() {
initialize(ConfigKey());
PollingControlProxy(ControlFlags flags = ControlFlag::None)
: PollingControlProxy(ConfigKey(), flags) {
}

PollingControlProxy(const QString& g, const QString& i) {
initialize(ConfigKey(g, i));
PollingControlProxy(const QString& g, const QString& i, ControlFlags flags = ControlFlag::None)
: PollingControlProxy(ConfigKey(g, i), flags) {
}

PollingControlProxy(const ConfigKey& key) {
initialize(key);
}

void initialize(const ConfigKey& key) {
// Don't bother looking up the control if key is NULL. Prevents log spew.
if (key.isValid()) {
m_pControl = ControlDoublePrivate::getControl(key, ControlFlag::None);
}

PollingControlProxy(const ConfigKey& key, ControlFlags flags = ControlFlag::None) {
m_pControl = ControlDoublePrivate::getControl(key, flags);
if (!m_pControl) {
DEBUG_ASSERT(flags & ControlFlag::AllowMissingOrInvalid);
m_pControl = ControlDoublePrivate::getDefaultControl();
}
DEBUG_ASSERT(m_pControl);
}

bool valid() const {
Expand Down

0 comments on commit 9fd7153

Please sign in to comment.