MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / findControlTyped

Method findControlTyped

forms/control.h:120–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118 bool isVisible() const { return Visible; };
119
120 template <typename T> sp<T> findControlTyped(const UString &name) const
121 {
122 auto c = this->findControl(name);
123 if (!c)
124 {
125 LogError("Failed to find control \"%s\" within form \"%s\"", name, this->Name);
126 return nullptr;
127 }
128 sp<T> typedControl = std::dynamic_pointer_cast<T>(c);
129 if (!typedControl)
130 {
131 LogError("Failed to cast control \"%s\" within form \"%s\" to type \"%s\"", name,
132 this->Name, typeid(T).name());
133 return nullptr;
134 }
135 return typedControl;
136 }
137
138 sp<Control> getParent() const;
139 sp<Form> getForm();

Callers

nothing calls this directly

Calls 1

findControlMethod · 0.95

Tested by

no test coverage detected