Remove fmt::format and replace with std::format

This commit is contained in:
Alexander Bock
2024-03-24 20:19:14 +01:00
parent 9878bfc8f7
commit 3ba346a227
246 changed files with 1343 additions and 1300 deletions
@@ -141,7 +141,7 @@ void AsyncTileDataProvider::update() {
// Only allow resetting if there are no jobs currently running
if (_enqueuedTileRequests.empty()) {
performReset(ResetRawTileDataReader::Yes);
LINFO(fmt::format("Tile data reader '{}' reset successfully", _name));
LINFO(std::format("Tile data reader '{}' reset successfully", _name));
}
break;
case ResetMode::ShouldResetAllButRawTileDataReader:
@@ -150,7 +150,7 @@ void AsyncTileDataProvider::update() {
// Only allow resetting if there are no jobs currently running
if (_enqueuedTileRequests.empty()) {
performReset(ResetRawTileDataReader::No);
LINFO(fmt::format("Tile data reader '{}' reset successfully", _name));
LINFO(std::format("Tile data reader '{}' reset successfully", _name));
}
break;
case ResetMode::ShouldBeDeleted:
@@ -172,7 +172,7 @@ void AsyncTileDataProvider::reset() {
// we need to wait until _enqueuedTileRequests is empty before finishing up.
_resetMode = ResetMode::ShouldResetAll;
endEnqueuedJobs();
LINFO(fmt::format("Prepairing for resetting of tile reader '{}'", _name));
LINFO(std::format("Prepairing for resetting of tile reader '{}'", _name));
}
void AsyncTileDataProvider::prepareToBeDeleted() {
@@ -92,14 +92,14 @@ DashboardItemGlobeLocation::DashboardItemGlobeLocation(
auto updateFormatString = [this]() {
switch (_displayFormat.value()) {
case static_cast<int>(DisplayFormat::DecimalDegrees):
_formatString = fmt::format(
_formatString = std::format(
"Position: {{:03.{0}f}}, {{:03.{0}f}} "
"Altitude: {{:03.{0}f}} {{}}",
_significantDigits.value()
);
break;
case static_cast<int>(DisplayFormat::DegreeMinuteSeconds):
_formatString = fmt::format(
_formatString = std::format(
"Position: {{}}d {{}}' {{:03.{0}f}}\" {{}}, "
"{{}}d {{}}' {{:03.{0}f}}\" {{}} "
"Altitude: {{:03.{0}f}} {{}}",
@@ -157,9 +157,11 @@ void DashboardItemGlobeLocation::render(glm::vec2& penPosition) {
switch (_displayFormat.value()) {
case static_cast<int>(DisplayFormat::DecimalDegrees):
{
end = fmt::format_to(
// @CPP26(abock): This can be replaced with std::runtime_format
end = std::vformat_to(
_buffer.data(),
fmt::runtime(_formatString), lat, lon, dist.first, dist.second
_formatString,
std::make_format_args(lat, lon, dist.first, dist.second)
);
break;
}
@@ -184,12 +186,15 @@ void DashboardItemGlobeLocation::render(glm::vec2& penPosition) {
const double lonSec = lonMinRemainder * 60.f;
end = fmt::format_to(
// @CPP26(abock): This can be replaced with std::runtime_format
end = std::vformat_to(
_buffer.data(),
fmt::runtime(_formatString),
latDeg, latMin, latSec, isNorth ? "N" : "S",
lonDeg, lonMin, lonSec, isEast ? "E" : "W",
dist.first, dist.second
_formatString,
std::make_format_args(
latDeg, latMin, latSec, isNorth ? "N" : "S",
lonDeg, lonMin, lonSec, isEast ? "E" : "W",
dist.first, dist.second
)
);
break;
@@ -205,7 +210,7 @@ glm::vec2 DashboardItemGlobeLocation::size() const {
ZoneScoped;
return _font->boundingBox(
fmt::format("Position: {}, {} Altitude: {}", 1.f, 1.f, 1.f)
std::format("Position: {}, {} Altitude: {}", 1.f, 1.f, 1.f)
);
}
+2 -2
View File
@@ -140,13 +140,13 @@ void GdalWrapper::setGdalProxyConfiguration() {
const std::string proxy = address + ":" + std::to_string(port);
CPLSetConfigOption("GDAL_HTTP_PROXY", proxy.c_str());
LDEBUG(fmt::format("Using proxy server '{}'", proxy));
LDEBUG(std::format("Using proxy server '{}'", proxy));
if (!user.empty() && !password.empty()) {
const std::string userPwd = user + ":" + password;
CPLSetConfigOption("GDAL_HTTP_PROXYUSERPWD", userPwd.c_str());
CPLSetConfigOption("GDAL_HTTP_PROXYAUTH", auth.c_str());
LDEBUG(fmt::format("Using authentication method: {}", auth));
LDEBUG(std::format("Using authentication method: {}", auth));
}
}
}
@@ -368,7 +368,7 @@ GeoJsonComponent::GeoJsonComponent(const ghoul::Dictionary& dictionary,
_textureIsDirty = true;
}
else {
LERROR(fmt::format(
LERROR(std::format(
"Provided texture file does not exist: {}",
_defaultProperties.pointTexture.value()
));
@@ -594,7 +594,7 @@ void GeoJsonComponent::readFile() {
std::ifstream file(_geoJsonFile);
if (!file.good()) {
LERROR(fmt::format("Failed to open GeoJSON file: {}", _geoJsonFile.value()));
LERROR(std::format("Failed to open GeoJSON file: {}", _geoJsonFile.value()));
return;
}
@@ -617,7 +617,7 @@ void GeoJsonComponent::readFile() {
}
if (_geometryFeatures.empty()) {
LWARNING(fmt::format(
LWARNING(std::format(
"No GeoJson features could be successfully created for GeoJson layer "
"with identifier '{}'. Disabling layer.", identifier()
));
@@ -625,7 +625,7 @@ void GeoJsonComponent::readFile() {
}
}
catch (const geos::util::GEOSException& e) {
LERROR(fmt::format(
LERROR(std::format(
"Error creating GeoJson layer with identifier '{}'. Problem reading "
"GeoJson file '{}'. Error: {}", identifier(), _geoJsonFile.value(), e.what()
));
@@ -646,7 +646,7 @@ void GeoJsonComponent::parseSingleFeature(const geos::io::GeoJSONFeature& featur
std::vector<const geos::geom::Geometry*> geomsToAdd;
if (!geom) {
// Null geometry => no geometries to add
LWARNING(fmt::format(
LWARNING(std::format(
"Feature {} in GeoJson file '{}' is a null geometry and will not be loaded",
indexInFile, _geoJsonFile.value()
));
@@ -683,7 +683,7 @@ void GeoJsonComponent::parseSingleFeature(const geos::io::GeoJSONFeature& featur
// If there is already an owner with that name as an identifier, make a
// unique one
if (_featuresPropertyOwner.hasPropertySubOwner(identifier)) {
identifier = fmt::format("Feature{}-", index, identifier);
identifier = std::format("Feature{}-", index, identifier);
}
const properties::PropertyOwner::PropertyOwnerInfo info = {
@@ -698,7 +698,7 @@ void GeoJsonComponent::parseSingleFeature(const geos::io::GeoJSONFeature& featur
_featuresPropertyOwner.addPropertySubOwner(_features.back().get());
}
catch (const ghoul::RuntimeError& error) {
LERROR(fmt::format(
LERROR(std::format(
"Error creating GeoJson layer with identifier '{}'. Problem reading "
"feature {} in GeoJson file '{}'.",
identifier(), indexInFile, _geoJsonFile.value()
@@ -835,7 +835,7 @@ void GeoJsonComponent::flyToFeature(std::optional<int> index) const {
float lon = centroidLon + _latLongOffset.value().y;
global::scriptEngine->queueScript(
fmt::format(
std::format(
"openspace.globebrowsing.flyToGeo([[{}]], {}, {}, {})",
_globeNode.owner()->identifier(), lat, lon, d
),
@@ -846,7 +846,7 @@ void GeoJsonComponent::flyToFeature(std::optional<int> index) const {
void GeoJsonComponent::triggerDeletion() const {
global::scriptEngine->queueScript(
fmt::format(
std::format(
"openspace.globebrowsing.deleteGeoJson([[{}]], [[{}]])",
_globeNode.owner()->identifier(), _identifier
),
@@ -120,7 +120,7 @@ namespace {
// Should add some more information on which file the reading failed for
LERRORC(
"GeoJson",
fmt::format(
std::format(
"Failed reading color property. Expected 3 values, got {}",
val.size()
)
@@ -140,7 +140,7 @@ namespace {
if (!c) {
LERRORC(
"GeoJson",
fmt::format(
std::format(
"Failed reading color property. Did not find a hex color, got {}",
hex
)
@@ -532,7 +532,7 @@ GeoJsonOverrideProperties propsFromGeoJson(const geos::io::GeoJSONFeature& featu
result.pointTextureAnchor = GeoJsonProperties::PointTextureAnchor::Center;
}
else {
LERRORC("GeoJson", fmt::format(
LERRORC("GeoJson", std::format(
"Point texture anchor mode '{}' not supported", mode
));
}
@@ -554,7 +554,7 @@ GeoJsonOverrideProperties propsFromGeoJson(const geos::io::GeoJSONFeature& featu
// result.altitudeMode = GeoJsonProperties::AltitudeMode::ClampToGround;
//}
else {
LERRORC("GeoJson", fmt::format(
LERRORC("GeoJson", std::format(
"Altitude mode '{}' not supported", mode
));
}
@@ -587,7 +587,7 @@ GeoJsonOverrideProperties propsFromGeoJson(const geos::io::GeoJSONFeature& featu
}
catch (const geos::io::GeoJSONValue::GeoJSONTypeError&) {
// @TODO: Should add some more information on which file the reading failed
LERRORC("GeoJson", fmt::format(
LERRORC("GeoJson", std::format(
"Error reading GeoJson property '{}'. Value has wrong type", key
));
}
@@ -151,7 +151,7 @@ void GlobeGeometryFeature::updateTexture(bool isInitializeStep) {
_pointTexture->uploadToGpu();
}
else {
LERROR(fmt::format(
LERROR(std::format(
"Trying to use texture file that does not exist: {}", texturePath
));
}
@@ -235,7 +235,7 @@ void GlobeGeometryFeature::createFromSingleGeosGeometry(const geos::geom::Geomet
_type = GeometryType::Polygon;
}
catch (geos::util::IllegalStateException& e) {
throw ghoul::RuntimeError(fmt::format(
throw ghoul::RuntimeError(std::format(
"Non-simple (e.g. self-intersecting) polygons not supported yet. "
"GEOS error: {}", e.what()
));
@@ -244,7 +244,7 @@ void GlobeGeometryFeature::createFromSingleGeosGeometry(const geos::geom::Geomet
// https://www.sciencedirect.com/science/article/pii/S0304397520304199
}
catch (geos::util::GEOSException& e) {
throw ghoul::RuntimeError(fmt::format(
throw ghoul::RuntimeError(std::format(
"Unknown geos error: {}", e.what()
));
}
@@ -282,7 +282,7 @@ void GlobeGeometryFeature::createFromSingleGeosGeometry(const geos::geom::Geomet
_key = *_properties.overrideValues.name;
}
else {
_key = fmt::format("Feature {} - {}", index, geo->getGeometryType());
_key = std::format("Feature {} - {}", index, geo->getGeometryType());
}
}
@@ -376,7 +376,7 @@ bool GlobeLabelsComponent::loadLabelsData(const std::filesystem::path& file) {
const bool hasCachedFile = std::filesystem::is_regular_file(cachedFile);
if (hasCachedFile) {
LINFO(fmt::format(
LINFO(std::format(
"Cached file '{}' used for labels file '{}'", cachedFile, file
));
@@ -391,9 +391,9 @@ bool GlobeLabelsComponent::loadLabelsData(const std::filesystem::path& file) {
}
}
else {
LINFO(fmt::format("Cache for labels file '{}' not found", file));
LINFO(std::format("Cache for labels file '{}' not found", file));
}
LINFO(fmt::format("Loading labels file '{}'", file));
LINFO(std::format("Loading labels file '{}'", file));
const bool success = readLabelsFile(file);
if (success) {
@@ -406,7 +406,7 @@ bool GlobeLabelsComponent::readLabelsFile(const std::filesystem::path& file) {
try {
std::fstream csvLabelFile(file);
if (!csvLabelFile.good()) {
LERROR(fmt::format("Failed to open labels file '{}'", file));
LERROR(std::format("Failed to open labels file '{}'", file));
return false;
}
if (!csvLabelFile.is_open()) {
@@ -491,7 +491,7 @@ bool GlobeLabelsComponent::readLabelsFile(const std::filesystem::path& file) {
return true;
}
catch (const std::fstream::failure& e) {
LERROR(fmt::format("Failed reading labels file '{}'", file));
LERROR(std::format("Failed reading labels file '{}'", file));
LERROR(e.what());
return false;
}
@@ -500,7 +500,7 @@ bool GlobeLabelsComponent::readLabelsFile(const std::filesystem::path& file) {
bool GlobeLabelsComponent::loadCachedFile(const std::filesystem::path& file) {
std::ifstream fileStream(file, std::ifstream::binary);
if (!fileStream.good()) {
LERROR(fmt::format("Error opening file '{}' for loading cache file", file));
LERROR(std::format("Error opening file '{}' for loading cache file", file));
return false;
}
@@ -530,7 +530,7 @@ bool GlobeLabelsComponent::loadCachedFile(const std::filesystem::path& file) {
bool GlobeLabelsComponent::saveCachedFile(const std::filesystem::path& file) const {
std::ofstream fileStream = std::ofstream(file, std::ofstream::binary);
if (!fileStream.good()) {
LERROR(fmt::format("Error opening file '{}' for save cache file", file));
LERROR(std::format("Error opening file '{}' for save cache file", file));
return false;
}
fileStream.write(reinterpret_cast<const char*>(&CurrentCacheVersion), sizeof(int8_t));
+1 -1
View File
@@ -230,7 +230,7 @@ glm::dmat3 GlobeRotation::matrix(const UpdateData&) const {
if (!_globeNode) {
LERRORC(
"GlobeRotation",
fmt::format("Could not find globe '{}'", _globe.value())
std::format("Could not find globe '{}'", _globe.value())
);
return _matrix;
}
@@ -225,7 +225,7 @@ glm::dvec3 GlobeTranslation::position(const UpdateData&) const {
if (!_attachedNode) {
LERRORC(
"GlobeRotation",
fmt::format("Could not find attached node '{}'", _globe.value())
std::format("Could not find attached node '{}'", _globe.value())
);
return _position;
}
+2 -2
View File
@@ -116,7 +116,7 @@ void GPULayerGroup::bind(ghoul::opengl::ProgramObject& p, const LayerGroup& laye
GPULayer& gal = _gpuActiveLayers[i];
auto& galuc = gal.uniformCache;
const Layer& al = *activeLayers[i];
const std::string name = fmt::format("{}[{}].", layerGroup.identifier(), i);
const std::string name = std::format("{}[{}].", layerGroup.identifier(), i);
if (layerGroup.isHeightLayer()) {
gal.isHeightLayer = true;
@@ -152,7 +152,7 @@ void GPULayerGroup::bind(ghoul::opengl::ProgramObject& p, const LayerGroup& laye
for (size_t j = 0; j < gal.gpuChunkTiles.size(); j++) {
GPULayer::GPUChunkTile& t = gal.gpuChunkTiles[j];
auto& tuc = t.uniformCache;
const std::string n = fmt::format("{}pile.chunkTile{}.", name, j);
const std::string n = std::format("{}pile.chunkTile{}.", name, j);
tuc.texture = p.uniformLocation(n + "textureSampler");
tuc.uvOffset = p.uniformLocation(n + "uvTransform.uvOffset");
+2 -2
View File
@@ -210,7 +210,7 @@ constexpr openspace::globebrowsing::layers::Layer::ID from_string(std::string_vi
return it->id;
}
else {
throw ghoul::RuntimeError(fmt::format(
throw ghoul::RuntimeError(std::format(
"Could not find Layer of type '{}'", string
));
}
@@ -231,7 +231,7 @@ constexpr openspace::globebrowsing::layers::Group::ID from_string(std::string_vi
return it->id;
}
else {
throw ghoul::RuntimeError(fmt::format(
throw ghoul::RuntimeError(std::format(
"Could not find Group of type '{}'", string
));
}
+1 -1
View File
@@ -72,7 +72,7 @@ void LayerManager::initialize(const ghoul::Dictionary& layerGroupsDict) {
_layerGroups[static_cast<int>(id)]->setLayersFromDict(d);
}
else {
LWARNINGC("LayerManager", fmt::format("Unknown layer group '{}'", group));
LWARNINGC("LayerManager", std::format("Unknown layer group '{}'", group));
}
}
@@ -111,7 +111,7 @@ GDALDataType toGDALDataType(GLenum glType) {
default:
LERRORC(
"GDALRawTileDataReader",
fmt::format(
std::format(
"OpenGL data type unknown to GDAL: {}", static_cast<int>(glType)
)
);
@@ -282,7 +282,7 @@ std::optional<std::string> RawTileDataReader::mrfCache() {
for (std::string_view fmt : Unsupported) {
if (_datasetFilePath.ends_with(fmt)) {
LWARNING(fmt::format(
LWARNING(std::format(
"Unsupported file format for MRF caching: '{}', Dataset: '{}'",
fmt, _datasetFilePath
));
@@ -294,7 +294,7 @@ std::optional<std::string> RawTileDataReader::mrfCache() {
const std::string datasetIdentifier =
std::to_string(std::hash<std::string>{}(_datasetFilePath));
const std::string path = fmt::format("{}/{}/{}/",
const std::string path = std::format("{}/{}/{}/",
mod.mrfCacheLocation(), _cacheProperties.path, datasetIdentifier);
const std::string root = absPath(path).string();
std::string mrf = root + datasetIdentifier + ".mrf";
@@ -304,7 +304,7 @@ std::optional<std::string> RawTileDataReader::mrfCache() {
if (!std::filesystem::create_directories(root, ec)) {
// Already existing directories causes a 'failure' but no error
if (ec) {
LWARNING(fmt::format(
LWARNING(std::format(
"Failed to create directories for cache at: '{}'. "
"Error Code: '{}', message: {}",
root, std::to_string(ec.value()), ec.message()
@@ -319,7 +319,7 @@ std::optional<std::string> RawTileDataReader::mrfCache() {
GDALOpen(_datasetFilePath.c_str(), GA_ReadOnly)
);
if (!src) {
LWARNING(fmt::format(
LWARNING(std::format(
"Failed to load dataset '{}'. GDAL error: {}",
_datasetFilePath, CPLGetLastErrorMsg()
));
@@ -356,7 +356,7 @@ std::optional<std::string> RawTileDataReader::mrfCache() {
driver->CreateCopy(mrf.c_str(), src, false, createOpts, nullptr, nullptr)
);
if (!dst) {
LWARNING(fmt::format(
LWARNING(std::format(
"Failed to create MRF Caching dataset dataset '{}'. GDAL error: {}",
mrf, CPLGetLastErrorMsg()
));
@@ -397,7 +397,7 @@ void RawTileDataReader::initialize() {
ZoneScopedN("GDALOpen");
_dataset = static_cast<GDALDataset*>(GDALOpen(content.c_str(), GA_ReadOnly));
if (!_dataset) {
throw ghoul::RuntimeError(fmt::format(
throw ghoul::RuntimeError(std::format(
"Failed to load dataset '{}'. GDAL error: {}",
_datasetFilePath, CPLGetLastErrorMsg()
));
+11 -11
View File
@@ -866,7 +866,7 @@ void RenderableGlobe::renderSecondary(const RenderData& data, RendererTasks&) {
_globeLabelsComponent.draw(data);
}
catch (const ghoul::opengl::TextureUnit::TextureUnitError& e) {
LERROR(fmt::format("Error on drawing globe labels '{}'", e.message));
LERROR(std::format("Error on drawing globe labels '{}'", e.message));
}
if (_geoJsonManager.isReady()) {
@@ -1726,21 +1726,21 @@ void RenderableGlobe::recompileShaders() {
// lastLayerIndex must be at least 0 for the shader to compile,
// the layer type is inactivated by setting use to false
shaderDictionary.setValue(
fmt::format("lastLayerIndex{}", layers::Groups[i].identifier),
std::format("lastLayerIndex{}", layers::Groups[i].identifier),
glm::max(preprocessingData.layeredTextureInfo[i].lastLayerIdx, 0)
);
shaderDictionary.setValue(
fmt::format("use{}", layers::Groups[i].identifier),
std::format("use{}", layers::Groups[i].identifier),
preprocessingData.layeredTextureInfo[i].lastLayerIdx >= 0
);
shaderDictionary.setValue(
fmt::format("blend{}", layers::Groups[i].identifier),
std::format("blend{}", layers::Groups[i].identifier),
preprocessingData.layeredTextureInfo[i].layerBlendingEnabled
);
// This is to avoid errors from shader preprocessor
shaderDictionary.setValue(
fmt::format("{}0LayerType", layers::Groups[i].identifier),
std::format("{}0LayerType", layers::Groups[i].identifier),
0
);
@@ -2198,17 +2198,17 @@ void RenderableGlobe::calculateEclipseShadows(ghoul::opengl::ProgramObject& prog
constexpr std::string_view NameSource = "shadowDataArray[{}].sourceCasterVec";
constexpr std::string_view NamePos = "shadowDataArray[{}].casterPositionVec";
programObject.setUniform(fmt::format(NameIsShadowing, counter), sd.isShadowing);
programObject.setUniform(std::format(NameIsShadowing, counter), sd.isShadowing);
if (sd.isShadowing) {
programObject.setUniform(fmt::format(NameXp, counter), sd.xp);
programObject.setUniform(fmt::format(NameXu, counter), sd.xu);
programObject.setUniform(fmt::format(NameRc, counter), sd.rc);
programObject.setUniform(std::format(NameXp, counter), sd.xp);
programObject.setUniform(std::format(NameXu, counter), sd.xu);
programObject.setUniform(std::format(NameRc, counter), sd.rc);
programObject.setUniform(
fmt::format(NameSource, counter), sd.sourceCasterVec
std::format(NameSource, counter), sd.sourceCasterVec
);
programObject.setUniform(
fmt::format(NamePos, counter), sd.casterPositionVec
std::format(NamePos, counter), sd.casterPositionVec
);
}
counter++;
+6 -6
View File
@@ -665,7 +665,7 @@ void RingsComponent::loadTexture() {
if (texture) {
LDEBUGC(
"RingsComponent",
fmt::format("Loaded texture from '{}'", absPath(_texturePath))
std::format("Loaded texture from '{}'", absPath(_texturePath))
);
_texture = std::move(texture);
@@ -688,7 +688,7 @@ void RingsComponent::loadTexture() {
if (textureForwards) {
LDEBUGC(
"RingsComponent",
fmt::format(
std::format(
"Loaded forwards scattering texture from '{}'",
absPath(_textureFwrdPath)
)
@@ -715,7 +715,7 @@ void RingsComponent::loadTexture() {
if (textureBackwards) {
LDEBUGC(
"RingsComponent",
fmt::format(
std::format(
"Loaded backwards scattering texture from '{}'",
absPath(_textureBckwrdPath)
)
@@ -742,7 +742,7 @@ void RingsComponent::loadTexture() {
if (textureUnlit) {
LDEBUGC(
"RingsComponent",
fmt::format("Loaded unlit texture from '{}'", absPath(_textureUnlitPath))
std::format("Loaded unlit texture from '{}'", absPath(_textureUnlitPath))
);
_textureUnlit = std::move(textureUnlit);
@@ -765,7 +765,7 @@ void RingsComponent::loadTexture() {
if (textureColor) {
LDEBUGC(
"RingsComponent",
fmt::format("Loaded color texture from '{}'", absPath(_textureColorPath))
std::format("Loaded color texture from '{}'", absPath(_textureColorPath))
);
_textureColor = std::move(textureColor);
@@ -788,7 +788,7 @@ void RingsComponent::loadTexture() {
if (textureTransparency) {
LDEBUGC(
"RingsComponent",
fmt::format("Loaded unlit texture from '{}'", absPath(_textureUnlitPath))
std::format("Loaded unlit texture from '{}'", absPath(_textureUnlitPath))
);
_textureTransparency = std::move(textureTransparency);
@@ -534,7 +534,7 @@ void ShadowComponent::saveDepthBuffer() const {
for (int i = 0; i < _shadowDepthTextureWidth; i++) {
for (int j = 0; j < _shadowDepthTextureHeight; j++, k++) {
const unsigned int val = static_cast<unsigned int>(buffer[k]);
ppmFile << fmt::format("{0} {0} {0} ", val);
ppmFile << std::format("{0} {0} {0} ", val);
}
ppmFile << '\n';
}
@@ -130,7 +130,7 @@ DefaultTileProvider::DefaultTileProvider(const ghoul::Dictionary& dictionary)
const Parameters p = codegen::bake<Parameters>(dictionary);
name = p.name.value_or("Name unspecified");
const std::string _loggerCat = fmt::format("DefaultTileProvider ({})", name);
const std::string _loggerCat = std::format("DefaultTileProvider ({})", name);
// 1. Get required Keys
_filePath = p.filePath;
@@ -162,7 +162,7 @@ DefaultTileProvider::DefaultTileProvider(const ghoul::Dictionary& dictionary)
std::string identifier = p.identifier.value_or("unspecified");
std::string enclosing = p.globeName.value_or("unspecified");
std::string path = fmt::format("{}/{}/{}/", enclosing, layerGroup, identifier);
std::string path = std::format("{}/{}/{}/", enclosing, layerGroup, identifier);
const GlobeBrowsingModule& mod = *global::moduleEngine->module<GlobeBrowsingModule>();
bool enabled = mod.isMRFCachingEnabled();
@@ -85,7 +85,7 @@ void SingleImageProvider::reset() {
_tileTexture = ghoul::io::TextureReader::ref().loadTexture(_filePath, 2);
if (!_tileTexture) {
throw ghoul::RuntimeError(
fmt::format("Unable to load texture '{}'", _filePath.value())
std::format("Unable to load texture '{}'", _filePath.value())
);
}
@@ -94,7 +94,7 @@ Tile SizeReferenceTileProvider::tile(const TileIndex& tileIndex) {
unit = "m";
}
const std::string text = fmt::format("{:.0f} {:s}", tileLongitudalLength, unit);
const std::string text = std::format("{:.0f} {:s}", tileLongitudalLength, unit);
const glm::vec2 textPosition = glm::vec2(
0.f,
aboveEquator ?
@@ -217,13 +217,13 @@ TemporalTileProvider::TemporalTileProvider(const ghoul::Dictionary& dictionary)
_prototyped.temporalResolution = p.prototyped->temporalResolution;
}
catch (const ghoul::RuntimeError& e) {
throw ghoul::RuntimeError(fmt::format(
throw ghoul::RuntimeError(std::format(
"Could not create time quantizer for Temporal GDAL dataset: {}", e.message
));
}
if (p.prototyped->timeFormat.size() >= 64) {
throw ghoul::RuntimeError(fmt::format(
throw ghoul::RuntimeError(std::format(
"Time format string '{}' too large. Maximum length of 64 is allowed",
p.prototyped->timeFormat
));
@@ -257,7 +257,7 @@ TemporalTileProvider::TemporalTileProvider(const ghoul::Dictionary& dictionary)
// unfortunately. Luckily, Spice understands DOY date formats, so
// we can specify those directly and noone would use a DOY and a DOM
// time string in the same format string, right? Right?!
date = fmt::format(
date = std::format(
"{}-{}T{}:{}:{}",
tm.tm_year + 1900,
tm.tm_yday,
@@ -267,7 +267,7 @@ TemporalTileProvider::TemporalTileProvider(const ghoul::Dictionary& dictionary)
);
}
else {
date = fmt::format(
date = std::format(
"{}-{}-{} {}:{}:{}",
tm.tm_year + 1900,
tm.tm_mon + 1,
@@ -294,7 +294,7 @@ TemporalTileProvider::TemporalTileProvider(const ghoul::Dictionary& dictionary)
);
if (_folder.files.empty()) {
throw ghoul::RuntimeError(fmt::format(
throw ghoul::RuntimeError(std::format(
"Error loading layer '{}'. Folder '{}' does not contain any files that "
"matched the time format",
_identifier, _folder.folder
@@ -59,7 +59,7 @@ TileIndexTileProvider::TileIndexTileProvider(const ghoul::Dictionary& dictionary
Tile TileIndexTileProvider::tile(const TileIndex& tileIndex) {
ZoneScoped;
const std::string text = fmt::format(
const std::string text = std::format(
"level: {}\nx: {}\ny: {}", tileIndex.level, tileIndex.x, tileIndex.y
);
const glm::vec2 position = glm::vec2(
+13 -13
View File
@@ -169,7 +169,7 @@ void DateTime::setTime(std::string_view input) {
}
std::string DateTime::ISO8601() const {
return fmt::format(
return std::format(
"{:0>4}-{:0>2}-{:0>2}T{:0>2}:{:0>2}:{:0>2}",
_year, _month, _day, _hour, _minute, _second
);
@@ -178,7 +178,7 @@ std::string DateTime::ISO8601() const {
double DateTime::J2000() const {
char Buffer[20];
std::memset(Buffer, 0, 20);
fmt::format_to(
std::format_to(
Buffer,
"{:0>4}-{:0>2}-{:0>2}T{:0>2}:{:0>2}:{:0>2}",
_year, _month, _day, _hour, _minute, _second
@@ -226,7 +226,7 @@ void DateTime::incrementOnce(int value, char unit) {
_year += value;
break;
default:
throw ghoul::RuntimeError(fmt::format(
throw ghoul::RuntimeError(std::format(
"Invalid unit in incrementOnce '{}'. Expected 'y', 'M', 'd', 'h', or 'm'",
unit
));
@@ -387,13 +387,13 @@ void TimeQuantizer::verifyStartTimeRestrictions() {
dayUpperLimit = 31;
}
if (_start.day() < 1 || _start.day() > dayUpperLimit) {
throw ghoul::RuntimeError(fmt::format(
throw ghoul::RuntimeError(std::format(
"Invalid start day value of {} for {}, valid days are 1 - {}",
_start.day(), helpfulDescription, dayUpperLimit
));
}
if (_start.hour() != 0 || _start.minute() != 0 || _start.second() != 0) {
throw ghoul::RuntimeError(fmt::format(
throw ghoul::RuntimeError(std::format(
"Invalid start time value of {}:{}:{}, time must be 00:00:00",
_start.hour(), _start.minute(), _start.second()
));
@@ -406,7 +406,7 @@ void TimeQuantizer::verifyResolutionRestrictions(const int value, const char uni
break;
case 'M':
if (value < 1 || value > 6) {
throw ghoul::RuntimeError(fmt::format(
throw ghoul::RuntimeError(std::format(
"Invalid resolution count of {} for (M)onth option. Valid counts are "
"1, 2, 3, 4, or 6", value
));
@@ -414,7 +414,7 @@ void TimeQuantizer::verifyResolutionRestrictions(const int value, const char uni
break;
case 'd':
if (value < 1 || value > 28) {
throw ghoul::RuntimeError(fmt::format(
throw ghoul::RuntimeError(std::format(
"Invalid resolution count of {} for (d)ay option. Valid counts are "
"1 - 28", value
));
@@ -422,7 +422,7 @@ void TimeQuantizer::verifyResolutionRestrictions(const int value, const char uni
break;
case 'h':
if ((value < 1 || value > 4) && value != 6 && value != 12) {
throw ghoul::RuntimeError(fmt::format(
throw ghoul::RuntimeError(std::format(
"Invalid resolution count of {} for (h)our option. Valid counts are "
"1, 2, 3, 4, 6, or 12", value
));
@@ -430,14 +430,14 @@ void TimeQuantizer::verifyResolutionRestrictions(const int value, const char uni
break;
case 'm':
if (value != 15 && value != 30) {
throw ghoul::RuntimeError(fmt::format(
throw ghoul::RuntimeError(std::format(
"Invalid resolution count of {} for (m)inute option. Valid counts "
"are 15 or 30", value
));
}
break;
default:
throw ghoul::RuntimeError(fmt::format(
throw ghoul::RuntimeError(std::format(
"Invalid unit format '{}'. Expected 'y', 'M', 'd', 'h', or 'm'", unit
));
}
@@ -469,7 +469,7 @@ double TimeQuantizer::computeSecondsFromResolution(const int valueIn, const char
break;
default:
throw ghoul::RuntimeError(fmt::format(
throw ghoul::RuntimeError(std::format(
"Invalid resolution unit format '{}'. Expected 'y', 'M', 'd', 'h', 'm', "
"or 's'", unit
));
@@ -531,7 +531,7 @@ bool TimeQuantizer::quantize(Time& t, bool clamp) {
}
char Buffer[20];
std::memset(Buffer, 0, 20);
fmt::format_to(
std::format_to(
Buffer,
"{:0>4}-{:0>2}-{:0>2}T{:0>2}:{:0>2}:{:0>2}",
quantized.year(), quantized.month(), quantized.day(),
@@ -615,7 +615,7 @@ void TimeQuantizer::doFirstApproximation(DateTime& quantized, const DateTime& un
}
break;
default:
throw ghoul::RuntimeError(fmt::format(
throw ghoul::RuntimeError(std::format(
"Invalid unit '{}'. Expected 'y', 'M', 'd', 'h', or 'm'", unit
));
}