Closed alpha version 1.7.8.1: Fix build for Xcode.

This commit is contained in:
John Preston 2019-06-22 22:42:30 +02:00
parent d0cf39f8ed
commit 88b7387a40
3 changed files with 29 additions and 43 deletions

View File

@ -203,6 +203,9 @@ inline auto to_count() {\n\
});\n\
}\n\
\n\
template <typename P>\n\
using S = std::decay_t<decltype(std::declval<P>()(QString()))>;\n\
\n\
template <typename ...Tags>\n\
struct phrase;\n\
\n";
@ -222,9 +225,9 @@ struct phrase;\n\
tags.push_back("lngtag_" + tag);
const auto type1 = "lngtag_" + tag;
const auto arg1 = type1 + (isPluralTag ? " type" : "");
const auto producerType2 = (isPluralTag ? "rpl::producer<float64> " : "rpl::producer<T> ");
const auto producerType2 = (isPluralTag ? "rpl::producer<float64> " : "rpl::producer<S<P>> ");
const auto producerArg2 = producerType2 + tag + "__val";
const auto currentType2 = (isPluralTag ? "float64 " : "const T &");
const auto currentType2 = (isPluralTag ? "float64 " : "const S<P> &");
const auto currentArg2 = currentType2 + tag + "__val";
producerArgs.push_back(arg1 + ", " + producerArg2);
currentArgs.push_back(arg1 + ", " + currentArg2);
@ -241,17 +244,13 @@ struct phrase;\n\
header_->stream() << "\
template <>\n\
struct phrase<" << tags.join(", ") << "> {\n\
template <\n\
typename P = details::Identity,\n\
typename T = decltype(std::declval<P>()(QString()))>\n\
rpl::producer<T> operator()(" << producerArgs.join(", ") << ") const {\n\
template <typename P = details::Identity>\n\
rpl::producer<S<P>> operator()(" << producerArgs.join(", ") << ") const {\n\
return ::Lang::details::Producer<" << tags.join(", ") << ">::template Combine(" << values.join(", ") << ");\n\
}\n\
\n\
template <\n\
typename P = details::Identity,\n\
typename T = decltype(std::declval<P>()(QString()))>\n\
T operator()(now_t, " << currentArgs.join(", ") << ") const {\n\
template <typename P = details::Identity>\n\
S<P> operator()(now_t, " << currentArgs.join(", ") << ") const {\n\
return ::Lang::details::Producer<" << tags.join(", ") << ">::template Current(" << values.join(", ") << ");\n\
}\n\
\n\

View File

@ -312,7 +312,7 @@ public:
auto settingsValue() const {
return (_settings.current() & kSettingsUnknown)
? _settings.changes()
: _settings.value();
: (_settings.value() | rpl::type_erased());
}
enum LoadedStatus {

View File

@ -19,6 +19,9 @@ inline constexpr auto kPluralCount = 6;
template <typename Tag>
inline constexpr ushort TagValue();
template <typename P>
using S = std::decay_t<decltype(std::declval<P>()(QString()))>;
QString Current(ushort key);
rpl::producer<QString> Viewer(ushort key);
@ -71,11 +74,8 @@ struct ReplaceUnwrap<Tag, Tags...> {
template <typename ...Tags>
struct Producer {
template <
typename P,
typename T = decltype(std::declval<P>()(QString())),
typename ...Values>
static rpl::producer<T> Combine(ushort base, P p, Values &...values) {
template <typename P, typename ...Values>
static rpl::producer<S<P>> Combine(ushort base, P p, Values &...values) {
return rpl::combine(
Viewer(base),
std::move(values)...
@ -84,11 +84,8 @@ struct Producer {
});
}
template <
typename P,
typename T = decltype(std::declval<P>()(QString())),
typename ...Values>
static T Current(ushort base, P p, const Values &...values) {
template <typename P, typename ...Values>
static S<P> Current(ushort base, P p, const Values &...values) {
return ReplaceUnwrap<Tags...>::template Call(
p(Lang::details::Current(base)),
values...);
@ -97,28 +94,21 @@ struct Producer {
template <>
struct Producer<> {
template <
typename P,
typename T = decltype(std::declval<P>()(QString()))>
static rpl::producer<T> Combine(ushort base, P p) {
template <typename P>
static rpl::producer<S<P>> Combine(ushort base, P p) {
return Viewer(base) | rpl::map(std::move(p));
}
template <
typename P,
typename T = decltype(std::declval<P>()(QString()))>
static T Current(ushort base, P p) {
template <typename P>
static S<P> Current(ushort base, P p) {
return p(Lang::details::Current(base));
}
};
template <typename ...Tags>
struct Producer<lngtag_count, Tags...> {
template <
typename P,
typename T = decltype(std::declval<P>()(QString())),
typename ...Values>
static rpl::producer<T> Combine(
template <typename P, typename ...Values>
static rpl::producer<S<P>> Combine(
ushort base,
P p,
lngtag_count type,
@ -147,21 +137,18 @@ struct Producer<lngtag_count, Tags...> {
Unexpected("Lang shift value in Plural result.");
};
return ReplaceUnwrapTuple<7>(
ReplaceTag<T>::Call(
ReplaceTag<S<P>>::Call(
p(select()),
TagValue<lngtag_count>(),
StartReplacements<T>::Call(
StartReplacements<S<P>>::Call(
std::move(plural.replacement))),
tuple,
TagValue<Tags>()...);
});
}
template <
typename P,
typename T = decltype(std::declval<P>()(QString())),
typename ...Values>
static T Current(
template <typename P, typename ...Values>
static S<P> Current(
ushort base,
P p,
lngtag_count type,
@ -169,10 +156,10 @@ struct Producer<lngtag_count, Tags...> {
const Values &...values) {
auto plural = Plural(base, count, type);
return ReplaceUnwrap<Tags...>::template Call(
ReplaceTag<T>::Call(
ReplaceTag<S<P>>::Call(
p(Lang::details::Current(base + plural.keyShift)),
TagValue<lngtag_count>(),
StartReplacements<T>::Call(
StartReplacements<S<P>>::Call(
std::move(plural.replacement))),
values...);
}