mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 03:40:05 +00:00 
			
		
		
		
	GCC doesn't implement <format> yet, use fmt
This commit is contained in:
		
							parent
							
								
									593010acc2
								
							
						
					
					
						commit
						31db9a4315
					
				
					 12 changed files with 27 additions and 28 deletions
				
			
		|  | @ -4,7 +4,6 @@ | ||||||
| #include <scwx/common/sites.hpp> | #include <scwx/common/sites.hpp> | ||||||
| #include <scwx/util/logger.hpp> | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <format> |  | ||||||
| #include <shared_mutex> | #include <shared_mutex> | ||||||
| #include <unordered_map> | #include <unordered_map> | ||||||
| 
 | 
 | ||||||
|  | @ -118,18 +117,18 @@ std::string RadarSite::location_name() const | ||||||
| 
 | 
 | ||||||
|    if (p->country_ == "USA") |    if (p->country_ == "USA") | ||||||
|    { |    { | ||||||
|       locationName = std::format("{}, {}", p->place_, p->state_); |       locationName = fmt::format("{}, {}", p->place_, p->state_); | ||||||
|    } |    } | ||||||
|    else if (std::all_of(p->state_.cbegin(), |    else if (std::all_of(p->state_.cbegin(), | ||||||
|                         p->state_.cend(), |                         p->state_.cend(), | ||||||
|                         [](char c) { return std::isdigit(c); })) |                         [](char c) { return std::isdigit(c); })) | ||||||
|    { |    { | ||||||
|       locationName = std::format("{}, {}", p->place_, p->country_); |       locationName = fmt::format("{}, {}", p->place_, p->country_); | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       locationName = |       locationName = | ||||||
|          std::format("{}, {}, {}", p->place_, p->state_, p->country_); |          fmt::format("{}, {}, {}", p->place_, p->state_, p->country_); | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    return locationName; |    return locationName; | ||||||
|  |  | ||||||
|  | @ -254,14 +254,14 @@ std::string ProviderManager::name() const | ||||||
| 
 | 
 | ||||||
|    if (group_ == common::RadarProductGroup::Level3) |    if (group_ == common::RadarProductGroup::Level3) | ||||||
|    { |    { | ||||||
|       name = std::format("{}, {}, {}", |       name = fmt::format("{}, {}, {}", | ||||||
|                          radarId_, |                          radarId_, | ||||||
|                          common::GetRadarProductGroupName(group_), |                          common::GetRadarProductGroupName(group_), | ||||||
|                          product_); |                          product_); | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       name = std::format( |       name = fmt::format( | ||||||
|          "{}, {}", radarId_, common::GetRadarProductGroupName(group_)); |          "{}, {}", radarId_, common::GetRadarProductGroupName(group_)); | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -18,6 +18,7 @@ | ||||||
| #include <backends/imgui_impl_opengl3.h> | #include <backends/imgui_impl_opengl3.h> | ||||||
| #include <backends/imgui_impl_qt.hpp> | #include <backends/imgui_impl_qt.hpp> | ||||||
| #include <boost/uuid/random_generator.hpp> | #include <boost/uuid/random_generator.hpp> | ||||||
|  | #include <fmt/format.h> | ||||||
| #include <imgui.h> | #include <imgui.h> | ||||||
| #include <QApplication> | #include <QApplication> | ||||||
| #include <QColor> | #include <QColor> | ||||||
|  | @ -89,7 +90,7 @@ public: | ||||||
| 
 | 
 | ||||||
|       // Create ImGui Context
 |       // Create ImGui Context
 | ||||||
|       static size_t currentMapId_ {0u}; |       static size_t currentMapId_ {0u}; | ||||||
|       imGuiContextName_ = std::format("Map {}", ++currentMapId_); |       imGuiContextName_ = fmt::format("Map {}", ++currentMapId_); | ||||||
|       imGuiContext_ = |       imGuiContext_ = | ||||||
|          model::ImGuiContextModel::Instance().CreateContext(imGuiContextName_); |          model::ImGuiContextModel::Instance().CreateContext(imGuiContextName_); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -5,8 +5,6 @@ | ||||||
| #include <scwx/common/geographic.hpp> | #include <scwx/common/geographic.hpp> | ||||||
| #include <scwx/util/logger.hpp> | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <format> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace qt | namespace qt | ||||||
|  |  | ||||||
|  | @ -2,10 +2,10 @@ | ||||||
| #include <scwx/qt/settings/settings_variable.hpp> | #include <scwx/qt/settings/settings_variable.hpp> | ||||||
| #include <scwx/qt/util/color.hpp> | #include <scwx/qt/util/color.hpp> | ||||||
| 
 | 
 | ||||||
| #include <format> |  | ||||||
| #include <regex> | #include <regex> | ||||||
| 
 | 
 | ||||||
| #include <boost/gil.hpp> | #include <boost/gil.hpp> | ||||||
|  | #include <fmt/format.h> | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
|  | @ -74,8 +74,8 @@ public: | ||||||
|       for (auto& alert : kAlertColors_) |       for (auto& alert : kAlertColors_) | ||||||
|       { |       { | ||||||
|          std::string phenomenonCode = awips::GetPhenomenonCode(alert.first); |          std::string phenomenonCode = awips::GetPhenomenonCode(alert.first); | ||||||
|          std::string activeName     = std::format("{}-active", phenomenonCode); |          std::string activeName     = fmt::format("{}-active", phenomenonCode); | ||||||
|          std::string inactiveName = std::format("{}-inactive", phenomenonCode); |          std::string inactiveName = fmt::format("{}-inactive", phenomenonCode); | ||||||
| 
 | 
 | ||||||
|          auto activeResult = activeAlertColor_.emplace( |          auto activeResult = activeAlertColor_.emplace( | ||||||
|             alert.first, SettingsVariable<std::string> {activeName}); |             alert.first, SettingsVariable<std::string> {activeName}); | ||||||
|  |  | ||||||
|  | @ -1,8 +1,7 @@ | ||||||
| #include <scwx/qt/types/text_event_key.hpp> | #include <scwx/qt/types/text_event_key.hpp> | ||||||
| 
 | 
 | ||||||
| #include <format> |  | ||||||
| 
 |  | ||||||
| #include <boost/container_hash/hash.hpp> | #include <boost/container_hash/hash.hpp> | ||||||
|  | #include <fmt/format.h> | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
|  | @ -15,7 +14,7 @@ static const std::string logPrefix_ = "scwx::qt::types::text_event_key"; | ||||||
| 
 | 
 | ||||||
| std::string TextEventKey::ToFullString() const | std::string TextEventKey::ToFullString() const | ||||||
| { | { | ||||||
|    return std::format("{} {} {} {:04}", |    return fmt::format("{} {} {} {:04}", | ||||||
|                       officeId_, |                       officeId_, | ||||||
|                       awips::GetPhenomenonText(phenomenon_), |                       awips::GetPhenomenonText(phenomenon_), | ||||||
|                       awips::GetSignificanceText(significance_), |                       awips::GetSignificanceText(significance_), | ||||||
|  | @ -24,7 +23,7 @@ std::string TextEventKey::ToFullString() const | ||||||
| 
 | 
 | ||||||
| std::string TextEventKey::ToString() const | std::string TextEventKey::ToString() const | ||||||
| { | { | ||||||
|    return std::format("{}.{}.{}.{:04}", |    return fmt::format("{}.{}.{}.{:04}", | ||||||
|                       officeId_, |                       officeId_, | ||||||
|                       awips::GetPhenomenonCode(phenomenon_), |                       awips::GetPhenomenonCode(phenomenon_), | ||||||
|                       awips::GetSignificanceCode(significance_), |                       awips::GetSignificanceCode(significance_), | ||||||
|  |  | ||||||
|  | @ -6,6 +6,7 @@ | ||||||
| #include <imgui.h> | #include <imgui.h> | ||||||
| #include <backends/imgui_impl_opengl3.h> | #include <backends/imgui_impl_opengl3.h> | ||||||
| #include <backends/imgui_impl_qt.hpp> | #include <backends/imgui_impl_qt.hpp> | ||||||
|  | #include <fmt/format.h> | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
|  | @ -23,7 +24,7 @@ public: | ||||||
|    { |    { | ||||||
|       // Create ImGui Context
 |       // Create ImGui Context
 | ||||||
|       static size_t currentIndex_ {0u}; |       static size_t currentIndex_ {0u}; | ||||||
|       contextName_ = std::format("ImGui Debug {}", ++currentIndex_); |       contextName_ = fmt::format("ImGui Debug {}", ++currentIndex_); | ||||||
|       context_ = |       context_ = | ||||||
|          model::ImGuiContextModel::Instance().CreateContext(contextName_); |          model::ImGuiContextModel::Instance().CreateContext(contextName_); | ||||||
|       currentContext_ = context_; |       currentContext_ = context_; | ||||||
|  |  | ||||||
|  | @ -12,8 +12,7 @@ | ||||||
| #include <scwx/util/logger.hpp> | #include <scwx/util/logger.hpp> | ||||||
| #include <scwx/util/threads.hpp> | #include <scwx/util/threads.hpp> | ||||||
| 
 | 
 | ||||||
| #include <format> | #include <fmt/format.h> | ||||||
| 
 |  | ||||||
| #include <QColorDialog> | #include <QColorDialog> | ||||||
| #include <QFileDialog> | #include <QFileDialog> | ||||||
| #include <QToolButton> | #include <QToolButton> | ||||||
|  | @ -622,7 +621,7 @@ void SettingsDialogImpl::SetBackgroundColor(const std::string& value, | ||||||
|                                             QFrame*            frame) |                                             QFrame*            frame) | ||||||
| { | { | ||||||
|    frame->setStyleSheet( |    frame->setStyleSheet( | ||||||
|       QString::fromStdString(std::format("background-color: {}", value))); |       QString::fromStdString(fmt::format("background-color: {}", value))); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void SettingsDialogImpl::UpdateRadarDialogLocation(const std::string& id) | void SettingsDialogImpl::UpdateRadarDialogLocation(const std::string& id) | ||||||
|  | @ -676,7 +675,7 @@ void SettingsDialogImpl::ResetToDefault() | ||||||
| std::string SettingsDialogImpl::RadarSiteLabel( | std::string SettingsDialogImpl::RadarSiteLabel( | ||||||
|    std::shared_ptr<config::RadarSite>& radarSite) |    std::shared_ptr<config::RadarSite>& radarSite) | ||||||
| { | { | ||||||
|    return std::format("{} ({})", radarSite->id(), radarSite->location_name()); |    return fmt::format("{} ({})", radarSite->id(), radarSite->location_name()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| } // namespace ui
 | } // namespace ui
 | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| #include <scwx/qt/util/color.hpp> | #include <scwx/qt/util/color.hpp> | ||||||
| 
 | 
 | ||||||
| #include <format> | #include <fmt/format.h> | ||||||
| #include <QColor> | #include <QColor> | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
|  | @ -16,7 +16,7 @@ static const std::string logPrefix_ = "scwx::qt::util::color"; | ||||||
| 
 | 
 | ||||||
| std::string ToArgbString(const boost::gil::rgba8_pixel_t& color) | std::string ToArgbString(const boost::gil::rgba8_pixel_t& color) | ||||||
| { | { | ||||||
|    return std::format( |    return fmt::format( | ||||||
|       "#{:02x}{:02x}{:02x}{:02x}", color[3], color[0], color[1], color[2]); |       "#{:02x}{:02x}{:02x}{:02x}", color[3], color[0], color[1], color[2]); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -13,6 +13,7 @@ | ||||||
| #include <unordered_map> | #include <unordered_map> | ||||||
| 
 | 
 | ||||||
| #include <boost/timer/timer.hpp> | #include <boost/timer/timer.hpp> | ||||||
|  | #include <fmt/format.h> | ||||||
| #include <imgui.h> | #include <imgui.h> | ||||||
| #include <QFile> | #include <QFile> | ||||||
| #include <QFileInfo> | #include <QFileInfo> | ||||||
|  | @ -273,7 +274,7 @@ void FontImpl::CreateImGuiFont(QFile&                      fontFile, | ||||||
| 
 | 
 | ||||||
|       // Assign name to font
 |       // Assign name to font
 | ||||||
|       strncpy(fontConfig.Name, |       strncpy(fontConfig.Name, | ||||||
|               std::format("{}:{}", fileInfo.fileName().toStdString(), fontSize) |               fmt::format("{}:{}", fileInfo.fileName().toStdString(), fontSize) | ||||||
|                  .c_str(), |                  .c_str(), | ||||||
|               sizeof(fontConfig.Name)); |               sizeof(fontConfig.Name)); | ||||||
|       fontConfig.Name[sizeof(fontConfig.Name) - 1] = 0; |       fontConfig.Name[sizeof(fontConfig.Name) - 1] = 0; | ||||||
|  |  | ||||||
|  | @ -84,7 +84,7 @@ std::vector<std::string> Ugc::fips_ids() const | ||||||
|    { |    { | ||||||
|       for (auto& id : fipsIdList.second) |       for (auto& id : fipsIdList.second) | ||||||
|       { |       { | ||||||
|          fipsIds.push_back(std::format("{}{}{:03}", |          fipsIds.push_back(fmt::format("{}{}{:03}", | ||||||
|                                        fipsIdList.first, |                                        fipsIdList.first, | ||||||
|                                        ugcFormatMap_.left.at(p->format_), |                                        ugcFormatMap_.left.at(p->format_), | ||||||
|                                        id)); |                                        id)); | ||||||
|  |  | ||||||
|  | @ -1,9 +1,10 @@ | ||||||
| #include <scwx/common/geographic.hpp> | #include <scwx/common/geographic.hpp> | ||||||
| #include <scwx/common/characters.hpp> | #include <scwx/common/characters.hpp> | ||||||
| 
 | 
 | ||||||
| #include <format> |  | ||||||
| #include <numbers> | #include <numbers> | ||||||
| 
 | 
 | ||||||
|  | #include <fmt/format.h> | ||||||
|  | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace common | namespace common | ||||||
|  | @ -95,7 +96,7 @@ static std::string GetDegreeString(double             degrees, | ||||||
|    { |    { | ||||||
|    case DegreeStringType::Decimal: |    case DegreeStringType::Decimal: | ||||||
|       degreeString = |       degreeString = | ||||||
|          std::format("{:.6f}{}{}", degrees, Unicode::kDegree, suffix); |          fmt::format("{:.6f}{}{}", degrees, Unicode::kDegree, suffix); | ||||||
|       break; |       break; | ||||||
|    case DegreeStringType::DegreesMinutesSeconds: |    case DegreeStringType::DegreesMinutesSeconds: | ||||||
|    { |    { | ||||||
|  | @ -103,7 +104,7 @@ static std::string GetDegreeString(double             degrees, | ||||||
|       degrees      = (degrees - dd) * 60.0; |       degrees      = (degrees - dd) * 60.0; | ||||||
|       uint32_t mm  = static_cast<uint32_t>(degrees); |       uint32_t mm  = static_cast<uint32_t>(degrees); | ||||||
|       double   ss  = (degrees - mm) * 60.0; |       double   ss  = (degrees - mm) * 60.0; | ||||||
|       degreeString = std::format( |       degreeString = fmt::format( | ||||||
|          "{}{} {}' {:.2f}\"{}", dd, Unicode::kDegree, mm, ss, suffix); |          "{}{} {}' {:.2f}\"{}", dd, Unicode::kDegree, mm, ss, suffix); | ||||||
|       break; |       break; | ||||||
|    } |    } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat