MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / OrSetting

Class OrSetting

launcher/minecraft/MinecraftInstance.cpp:96–115  ·  view source on GitHub ↗

all of this because keeping things compatible with deprecated old settings if either of the settings {a, b} is true, this also resolves to true

Source from the content-addressed store, hash-verified

94// all of this because keeping things compatible with deprecated old settings
95// if either of the settings {a, b} is true, this also resolves to true
96class OrSetting : public Setting
97{
98 Q_OBJECT
99public:
100 OrSetting(QString id, std::shared_ptr<Setting> a, std::shared_ptr<Setting> b)
101 :Setting({id}, false), m_a(a), m_b(b)
102 {
103 }
104 virtual QVariant get() const
105 {
106 bool a = m_a->get().toBool();
107 bool b = m_b->get().toBool();
108 return a || b;
109 }
110 virtual void reset() {}
111 virtual void set(QVariant value) {}
112private:
113 std::shared_ptr<Setting> m_a;
114 std::shared_ptr<Setting> m_b;
115};
116
117MinecraftInstance::MinecraftInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr settings, const QString &rootDir)
118 : BaseInstance(globalSettings, settings, rootDir)

Callers

nothing calls this directly

Calls 1

SettingClass · 0.50

Tested by

no test coverage detected