@@ -86,6 +86,10 @@ bool operator<(const ScriptReader::DataVariant& lhs, const ScriptReader::DataVar
8686 return std::get<int >(lhs) < std::get<int >(rhs);
8787 }
8888 }
89+ if (std::holds_alternative<VersionInformation>(lhs))
90+ {
91+ return std::get<VersionInformation>(lhs) < std::get<VersionInformation>(rhs);
92+ }
8993 throw std::invalid_argument (" The comparison operator is only allowed for numeric values." );
9094}
9195
@@ -141,6 +145,10 @@ bool operator==(const ScriptReader::DataVariant& lhs, const ScriptReader::DataVa
141145 {
142146 return std::get<bool >(lhs) == std::get<bool >(rhs);
143147 }
148+ if (std::holds_alternative<VersionInformation>(lhs))
149+ {
150+ return std::get<VersionInformation>(lhs) == std::get<VersionInformation>(rhs);
151+ }
144152 throw std::runtime_error (" Unknown variant type passed to equality check. Please contact the developers." );
145153}
146154
@@ -224,6 +232,10 @@ void ScriptReader::replaceVariables(std::string& script_code, const DataDict& da
224232 {
225233 std::get<bool >(data.at (key)) ? replaced_value = " True" : replaced_value = " False" ;
226234 }
235+ else if (std::holds_alternative<VersionInformation>(data.at (key)))
236+ {
237+ replaced_value = std::get<VersionInformation>(data.at (key)).toString ();
238+ }
227239 else
228240 {
229241 // This is more of a reminder if we add types to the variant and forget to add it here.
@@ -341,6 +353,7 @@ bool ScriptReader::checkCondition(const std::string& condition, const DataDict&
341353 std::regex string_pattern (R"( ^['"]([^'"]+)?['"]$)" );
342354 std::regex number_pattern (R"( ^-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$)" );
343355 std::regex boolean_pattern (R"( ^(true|false|yes|no|on|off)$)" , std::regex::icase);
356+ std::regex version_pattern (R"( ^v(\d+\.\d+(\.\d+)?(-\d+)?)$)" );
344357 if (std::regex_search (value_str, match, string_pattern))
345358 {
346359 value = match[1 ]; // Extract the string content without quotes
@@ -353,6 +366,10 @@ bool ScriptReader::checkCondition(const std::string& condition, const DataDict&
353366 {
354367 value = parseBoolean (value_str);
355368 }
369+ else if (std::regex_search (value_str, match, version_pattern))
370+ {
371+ value = VersionInformation::fromString (match[1 ]);
372+ }
356373 else if (data.count (value_str))
357374 {
358375 value = data.at (value_str);
0 commit comments