Add CMake project, GCC support (#540)
This is extract from #211 that enables compilation with GCC. With #211 now in the state of bitrot, I would rather try approaching it in smaller steps that can be hopefully merged quicker, even if it does not provide full support for all the features #211 provided. This will _compile_ correctly with my (@janisozaur) GCC, but clang is more picky about flexible array members and refuses to compile it yet. I will extract remaining parts of #211 in future PRs. I marked @fwcd as author, as he did most of the work in #211.
This commit is contained in:
committed by
Matt Cooley
parent
98f1da2e9d
commit
fe30c7cabc
@@ -191,7 +191,7 @@ void CurrencyDataLoader::LoadData()
|
||||
if (!LoadFinished())
|
||||
{
|
||||
create_task([this]() -> task<bool> {
|
||||
vector<function<task<bool>()>> loadFunctions = {
|
||||
vector<function<future<bool>()>> loadFunctions = {
|
||||
[this]() { return TryLoadDataFromCacheAsync(); },
|
||||
[this]() { return TryLoadDataFromWebAsync(); },
|
||||
};
|
||||
@@ -307,7 +307,7 @@ pair<wstring, wstring> CurrencyDataLoader::GetCurrencyRatioEquality(_In_ const U
|
||||
}
|
||||
|
||||
#pragma optimize("", off) // Turn off optimizations to work around DevDiv 393321
|
||||
task<bool> CurrencyDataLoader::TryLoadDataFromCacheAsync()
|
||||
future<bool> CurrencyDataLoader::TryLoadDataFromCacheAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -349,7 +349,7 @@ task<bool> CurrencyDataLoader::TryLoadDataFromCacheAsync()
|
||||
}
|
||||
}
|
||||
|
||||
task<bool> CurrencyDataLoader::TryFinishLoadFromCacheAsync()
|
||||
future<bool> CurrencyDataLoader::TryFinishLoadFromCacheAsync()
|
||||
{
|
||||
auto localSettings = ApplicationData::Current->LocalSettings;
|
||||
if (localSettings == nullptr)
|
||||
@@ -386,7 +386,7 @@ task<bool> CurrencyDataLoader::TryFinishLoadFromCacheAsync()
|
||||
co_return true;
|
||||
}
|
||||
|
||||
task<bool> CurrencyDataLoader::TryLoadDataFromWebAsync()
|
||||
future<bool> CurrencyDataLoader::TryLoadDataFromWebAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -459,7 +459,7 @@ task<bool> CurrencyDataLoader::TryLoadDataFromWebAsync()
|
||||
}
|
||||
}
|
||||
|
||||
task<bool> CurrencyDataLoader::TryLoadDataFromWebOverrideAsync()
|
||||
future<bool> CurrencyDataLoader::TryLoadDataFromWebOverrideAsync()
|
||||
{
|
||||
m_meteredOverrideSet = true;
|
||||
bool didLoad = co_await TryLoadDataFromWebAsync();
|
||||
|
@@ -76,9 +76,9 @@ namespace CalculatorApp
|
||||
GetCurrencyRatioEquality(_In_ const UnitConversionManager::Unit& unit1, _In_ const UnitConversionManager::Unit& unit2) override;
|
||||
std::wstring GetCurrencyTimestamp() override;
|
||||
|
||||
concurrency::task<bool> TryLoadDataFromCacheAsync() override;
|
||||
concurrency::task<bool> TryLoadDataFromWebAsync() override;
|
||||
concurrency::task<bool> TryLoadDataFromWebOverrideAsync() override;
|
||||
std::future<bool> TryLoadDataFromCacheAsync() override;
|
||||
std::future<bool> TryLoadDataFromWebAsync() override;
|
||||
std::future<bool> TryLoadDataFromWebOverrideAsync() override;
|
||||
// ICurrencyConverterDataLoader
|
||||
|
||||
void OnNetworkBehaviorChanged(CalculatorApp::NetworkAccessBehavior newBehavior);
|
||||
@@ -87,7 +87,7 @@ namespace CalculatorApp
|
||||
void ResetLoadStatus();
|
||||
void NotifyDataLoadFinished(bool didLoad);
|
||||
|
||||
concurrency::task<bool> TryFinishLoadFromCacheAsync();
|
||||
std::future<bool> TryFinishLoadFromCacheAsync();
|
||||
|
||||
bool TryParseWebResponses(
|
||||
_In_ Platform::String ^ staticDataJson,
|
||||
|
@@ -675,7 +675,7 @@ void UnitConverterViewModel::RefreshCurrencyRatios()
|
||||
String ^ announcement = AppResourceProvider::GetInstance().GetResourceString(UnitConverterResourceKeys::UpdatingCurrencyRates);
|
||||
Announcement = CalculatorAnnouncement::GetUpdateCurrencyRatesAnnouncement(announcement);
|
||||
|
||||
auto refreshTask = create_task(m_model->RefreshCurrencyRatios());
|
||||
auto refreshTask = create_task([this] { return m_model->RefreshCurrencyRatios().get(); });
|
||||
refreshTask.then(
|
||||
[this](const pair<bool, wstring>& refreshResult) {
|
||||
bool didLoad = refreshResult.first;
|
||||
|
Reference in New Issue
Block a user