|
|
|
@ -18,6 +18,7 @@
|
|
|
|
|
struct StringParameter {
|
|
|
|
|
uint64_t data; ///< The data of the parameter.
|
|
|
|
|
const char *string_view; ///< The string value, if it has any.
|
|
|
|
|
std::unique_ptr<std::string> string; ///< Copied string value, if it has any.
|
|
|
|
|
WChar type; ///< The #StringControlCode to interpret this data with when it's the first parameter, otherwise '\0'.
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -102,7 +103,8 @@ public:
|
|
|
|
|
const char *GetNextParameterString()
|
|
|
|
|
{
|
|
|
|
|
auto ptr = GetNextParameterPointer();
|
|
|
|
|
return ptr == nullptr ? nullptr : ptr->string_view;
|
|
|
|
|
if (ptr == nullptr) return nullptr;
|
|
|
|
|
return ptr->string != nullptr ? ptr->string->c_str() : ptr->string_view;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -147,6 +149,7 @@ public:
|
|
|
|
|
{
|
|
|
|
|
assert(n < this->parameters.size());
|
|
|
|
|
this->parameters[n].data = v;
|
|
|
|
|
this->parameters[n].string.reset();
|
|
|
|
|
this->parameters[n].string_view = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -154,16 +157,24 @@ public:
|
|
|
|
|
{
|
|
|
|
|
assert(n < this->parameters.size());
|
|
|
|
|
this->parameters[n].data = 0;
|
|
|
|
|
this->parameters[n].string.reset();
|
|
|
|
|
this->parameters[n].string_view = str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SetParam(size_t n, const std::string &str) { this->SetParam(n, str.c_str()); }
|
|
|
|
|
void SetParam(size_t n, std::string &&str) = delete; // block passing temporaries to SetDParam
|
|
|
|
|
|
|
|
|
|
void SetParam(size_t n, std::string &&str)
|
|
|
|
|
{
|
|
|
|
|
assert(n < this->parameters.size());
|
|
|
|
|
this->parameters[n].data = 0;
|
|
|
|
|
this->parameters[n].string = std::make_unique<std::string>(std::move(str));
|
|
|
|
|
this->parameters[n].string_view = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint64 GetParam(size_t n) const
|
|
|
|
|
{
|
|
|
|
|
assert(n < this->parameters.size());
|
|
|
|
|
assert(this->parameters[n].string_view == nullptr);
|
|
|
|
|
assert(this->parameters[n].string_view == nullptr && this->parameters[n].string == nullptr);
|
|
|
|
|
return this->parameters[n].data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -175,7 +186,8 @@ public:
|
|
|
|
|
const char *GetParamStr(size_t n) const
|
|
|
|
|
{
|
|
|
|
|
assert(n < this->parameters.size());
|
|
|
|
|
return this->parameters[n].string_view;
|
|
|
|
|
auto ¶m = this->parameters[n];
|
|
|
|
|
return param.string != nullptr ? param.string->c_str() : param.string_view;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|