Skip to content
Extraits de code Groupes Projets

Delete lua + Use OpenGL for MPV

Fermé Kubat a demandé de fusionner delete-lua vers master
7 fichiers
+ 26
168
Comparer les modifications
  • Côte à côte
  • En ligne
Fichiers
7
+ 0
63
#include "PreCompiledHeaders.hh"
#include "Lib/Script/ScriptOption.hh"
// OptionDeclaration
using namespace Vivy::Script;
ScriptOption::ScriptOption(const std::string &str) noexcept
: string(str)
, type(Type::String)
{
}
ScriptOption::ScriptOption(const std::string_view str) noexcept
: string(str)
, type(Type::String)
{
}
ScriptOption::ScriptOption(double n) noexcept
: number(n)
, type(Type::Number)
{
}
ScriptOption::ScriptOption(bool b) noexcept
: boolean(b)
, type(Type::Boolean)
{
}
std::string *
ScriptOption::getString() noexcept
{
return type == Type::String ? &string : nullptr;
}
double *
ScriptOption::getNumber() noexcept
{
return type == Type::Number ? &number : nullptr;
}
bool *
ScriptOption::getBoolean() noexcept
{
return type == Type::Boolean ? &boolean : nullptr;
}
std::string_view
ScriptOption::getSignature() const noexcept
{
static constexpr std::string_view signatureNumber = "Number";
static constexpr std::string_view signatureString = "String";
static constexpr std::string_view signatureBoolean = "Boolean";
switch (type) {
case Type::String: return signatureString;
case Type::Number: return signatureNumber;
case Type::Boolean: return signatureBoolean;
}
// Let the program crash
qFatal("UNREACHABLE");
}
Chargement en cours