MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / attachObserver

Method attachObserver

radiantcore/entity/KeyObserverMap.h:64–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62 SpawnArgs& _entity;
63
64 void attachObserver(const std::string& key, KeyObserver& observer)
65 {
66 if (EntityKeyValuePtr keyValue = _entity.getEntityKeyValue(key); keyValue) {
67 // Attach immediately if the entity already has such a (non-inherited)
68 // spawnarg. This will automatically send the current value.
69 keyValue->attach(observer);
70 }
71 else {
72 // No current value, call the observer with the inherited value or
73 // the empty string.
74 observer.onKeyValueChanged(_entity.getKeyValue(key));
75 }
76 }
77
78 void detachObserver(const std::string& key, KeyObserver& observer, bool sendEmptyValue)
79 {

Callers 1

KeyObserverMapMethod · 0.45

Calls 4

getEntityKeyValueMethod · 0.45
attachMethod · 0.45
onKeyValueChangedMethod · 0.45
getKeyValueMethod · 0.45

Tested by

no test coverage detected