From 210e17b0bb607af7887b606e6d92ed8a33e025f8 Mon Sep 17 00:00:00 2001 From: GPayne Date: Mon, 4 Mar 2024 15:37:21 -0700 Subject: [PATCH] Replaced std::getline usages with new ghoul::getline --- .../src/profile/additionalscriptsdialog.cpp | 3 +- .../launcher/src/profile/assettreemodel.cpp | 3 +- apps/OpenSpace/ext/sgct | 2 +- ext/ghoul | 2 +- include/openspace/network/messagestructures.h | 3 +- .../rendering/renderabledumeshes.cpp | 9 ++-- modules/exoplanets/exoplanetshelper.cpp | 5 ++- modules/exoplanets/exoplanetsmodule_lua.inl | 17 ++++---- .../tasks/exoplanetsdatapreparationtask.cpp | 29 ++++++------- .../rendering/renderablefieldlines.cpp | 3 +- .../renderablefieldlinessequence.cpp | 4 +- modules/fitsfilereader/src/fitsfilereader.cpp | 5 ++- modules/galaxy/rendering/renderablegalaxy.cpp | 7 ++-- .../src/globelabelscomponent.cpp | 19 +++++---- modules/iswa/rendering/datacygnet.cpp | 3 +- modules/iswa/rendering/iswakameleongroup.cpp | 3 +- modules/iswa/util/dataprocessortext.cpp | 13 +++--- modules/iswa/util/iswamanager.cpp | 9 ++-- modules/space/horizonsfile.cpp | 42 +++++++++---------- modules/space/kepler.cpp | 12 +++--- .../renderableconstellationbounds.cpp | 3 +- .../renderableconstellationlines.cpp | 12 +++--- .../renderableconstellationsbase.cpp | 4 +- .../space/rendering/renderablefluxnodes.cpp | 5 ++- .../space/tasks/generatedebrisvolumetask.cpp | 7 ++-- .../util/hongkangparser.cpp | 2 +- .../util/instrumenttimesparser.cpp | 3 +- .../util/labelparser.cpp | 5 ++- modules/sync/syncs/httpsynchronization.cpp | 3 +- modules/sync/syncs/urlsynchronization.cpp | 3 +- src/data/speckloader.cpp | 18 ++++---- src/engine/downloadmanager.cpp | 5 ++- src/interaction/sessionrecording.cpp | 5 ++- .../tasks/convertrecformattask.cpp | 5 ++- src/rendering/transferfunction.cpp | 3 +- src/util/versionchecker.cpp | 6 +-- 36 files changed, 154 insertions(+), 128 deletions(-) diff --git a/apps/OpenSpace/ext/launcher/src/profile/additionalscriptsdialog.cpp b/apps/OpenSpace/ext/launcher/src/profile/additionalscriptsdialog.cpp index 32638b74a5..6686846304 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/additionalscriptsdialog.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/additionalscriptsdialog.cpp @@ -26,6 +26,7 @@ #include "profile/line.h" #include "profile/scriptlogdialog.h" +#include #include #include #include @@ -93,7 +94,7 @@ void AdditionalScriptsDialog::parseScript() { std::istringstream iss(_textScripts->toPlainText().toStdString()); while (!iss.eof()) { std::string s; - std::getline(iss, s); + ghoul::getline(iss, s); additionalScripts.push_back(std::move(s)); } *_scripts = std::move(additionalScripts); diff --git a/apps/OpenSpace/ext/launcher/src/profile/assettreemodel.cpp b/apps/OpenSpace/ext/launcher/src/profile/assettreemodel.cpp index 50b24fd755..44bb986ef1 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/assettreemodel.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/assettreemodel.cpp @@ -25,6 +25,7 @@ #include "profile/assettreeitem.h" #include "profile/assettreemodel.h" #include "filesystemaccess.h" +#include #include #include @@ -58,7 +59,7 @@ namespace { } bool importGetNextLine(ImportElement& elem, std::istringstream& iss) { - std::getline(iss, elem.line); + ghoul::getline(iss, elem.line); const bool ok = iss.good(); if (!ok) { elem.line = ""; diff --git a/apps/OpenSpace/ext/sgct b/apps/OpenSpace/ext/sgct index 377de30963..3ace983eea 160000 --- a/apps/OpenSpace/ext/sgct +++ b/apps/OpenSpace/ext/sgct @@ -1 +1 @@ -Subproject commit 377de309631d8a1c9b53becd363db0dc8ee76ae6 +Subproject commit 3ace983eeaa235b3a105abb238b4d844244a427b diff --git a/ext/ghoul b/ext/ghoul index 2905908df8..f830834a74 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 2905908df8dc4f6fc025f4f73834819706b3afe0 +Subproject commit f830834a74e174f034a40778428eab1bfb04c85a diff --git a/include/openspace/network/messagestructures.h b/include/openspace/network/messagestructures.h index ff20ee9425..e13a3d7d9c 100644 --- a/include/openspace/network/messagestructures.h +++ b/include/openspace/network/messagestructures.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -468,7 +469,7 @@ struct ScriptMessage { std::string tmpReadbackScript; _script.erase(); for (int i = 0; i < numScriptLines; ++i) { - std::getline(iss, tmpReadbackScript); + ghoul::getline(iss, tmpReadbackScript); size_t start = tmpReadbackScript.find_first_not_of(" "); tmpReadbackScript = tmpReadbackScript.substr(start); _script.append(tmpReadbackScript); diff --git a/modules/digitaluniverse/rendering/renderabledumeshes.cpp b/modules/digitaluniverse/rendering/renderabledumeshes.cpp index 6037e07b95..784db02c3a 100644 --- a/modules/digitaluniverse/rendering/renderabledumeshes.cpp +++ b/modules/digitaluniverse/rendering/renderabledumeshes.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -482,7 +483,7 @@ bool RenderableDUMeshes::readSpeckFile() { // (signaled by the keywords 'datavar', 'texturevar', and 'texture') std::string line; while (true) { - std::getline(file, line); + ghoul::getline(file, line); if (file.eof()) { break; @@ -547,13 +548,13 @@ bool RenderableDUMeshes::readSpeckFile() { str >> dummy; } while (dummy != "{"); - std::getline(file, line); + ghoul::getline(file, line); std::stringstream dim(line); dim >> mesh.numU >> mesh.numV; // We can now read the vertices data: for (int l = 0; l < mesh.numU * mesh.numV; ++l) { - std::getline(file, line); + ghoul::getline(file, line); if (line.substr(0, 1) == "}") { break; } @@ -605,7 +606,7 @@ bool RenderableDUMeshes::readSpeckFile() { //} } - std::getline(file, line); + ghoul::getline(file, line); if (line.substr(0, 1) == "}") { _renderingMeshesMap.insert({ meshIndex++, mesh }); } diff --git a/modules/exoplanets/exoplanetshelper.cpp b/modules/exoplanets/exoplanetshelper.cpp index 130e1581e4..5176f23828 100644 --- a/modules/exoplanets/exoplanetshelper.cpp +++ b/modules/exoplanets/exoplanetshelper.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -72,7 +73,7 @@ glm::vec3 computeStarColor(float bv) { // Interpret the colormap cmap file std::string line; - while (std::getline(colorMap, line)) { + while (ghoul::getline(colorMap, line)) { if (line.empty() || (line[0] == '#')) { continue; } @@ -88,7 +89,7 @@ glm::vec3 computeStarColor(float bv) { const int t = static_cast(round(((bv + 0.4) / (2.0 + 0.4)) * (nValues - 1))); std::string color; for (int i = 0; i < t + 1; i++) { - std::getline(colorMap, color); + ghoul::getline(colorMap, color); } colorMap.close(); diff --git a/modules/exoplanets/exoplanetsmodule_lua.inl b/modules/exoplanets/exoplanetsmodule_lua.inl index 4d78edbf45..cb6acf6cca 100644 --- a/modules/exoplanets/exoplanetsmodule_lua.inl +++ b/modules/exoplanets/exoplanetsmodule_lua.inl @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -71,17 +72,17 @@ openspace::exoplanets::ExoplanetSystem findExoplanetSystemInData( // 3. read sizeof(exoplanet) bytes into an exoplanet object. ExoplanetDataEntry p; std::string line; - while (std::getline(lut, line)) { + while (ghoul::getline(lut, line)) { std::istringstream ss(line); std::string name; - std::getline(ss, name, ','); + ghoul::getline(ss, name, ','); if (name.substr(0, name.length() - 2) != starName) { continue; } std::string location_s; - std::getline(ss, location_s); + ghoul::getline(ss, location_s); long location = std::stol(location_s.c_str()); data.seekg(location); @@ -576,7 +577,7 @@ std::vector hostStarsWithSufficientData() { // Read number of lines int nExoplanets = 0; - while (std::getline(lookupTableFile, line)) { + while (ghoul::getline(lookupTableFile, line)) { ++nExoplanets; } lookupTableFile.clear(); @@ -584,17 +585,17 @@ std::vector hostStarsWithSufficientData() { names.reserve(nExoplanets); ExoplanetDataEntry p; - while (std::getline(lookupTableFile, line)) { + while (ghoul::getline(lookupTableFile, line)) { std::stringstream ss(line); std::string name; - std::getline(ss, name, ','); + ghoul::getline(ss, name, ','); // Remove the last two characters, that specify the planet name = name.substr(0, name.size() - 2); // Don't want to list systems where there is not enough data to visualize. // So, test if there is before adding the name to the list. std::string location_s; - std::getline(ss, location_s); + ghoul::getline(ss, location_s); long location = std::stol(location_s.c_str()); data.seekg(location); @@ -737,7 +738,7 @@ listOfExoplanetsDeprecated() // Parse the file line by line to compose system information std::string row; - while (std::getline(inputDataFile, row)) { + while (ghoul::getline(inputDataFile, row)) { PlanetData planetData = ExoplanetsDataPreparationTask::parseDataRow( row, columnNames, diff --git a/modules/exoplanets/tasks/exoplanetsdatapreparationtask.cpp b/modules/exoplanets/tasks/exoplanetsdatapreparationtask.cpp index 746b422d91..45e66d07fa 100644 --- a/modules/exoplanets/tasks/exoplanetsdatapreparationtask.cpp +++ b/modules/exoplanets/tasks/exoplanetsdatapreparationtask.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -146,7 +147,7 @@ void ExoplanetsDataPreparationTask::perform( // Read total number of items int total = 0; std::string row; - while (std::getline(inputDataFile, row)) { + while (ghoul::getline(inputDataFile, row)) { ++total; } inputDataFile.clear(); @@ -159,7 +160,7 @@ void ExoplanetsDataPreparationTask::perform( LINFO(fmt::format("Loading {} exoplanets", total)); int exoplanetCount = 0; - while (std::getline(inputDataFile, row)) { + while (ghoul::getline(inputDataFile, row)) { ++exoplanetCount; progressCallback(static_cast(exoplanetCount) / static_cast(total)); @@ -190,7 +191,7 @@ ExoplanetsDataPreparationTask::readFirstDataRow(std::ifstream& file) std::string line; // Read past any comments and empty lines - while (std::getline(file, line)) { + while (ghoul::getline(file, line)) { bool shouldSkip = line.empty() || line[0] == '#'; if (!shouldSkip) { break; @@ -201,7 +202,7 @@ ExoplanetsDataPreparationTask::readFirstDataRow(std::ifstream& file) std::vector columnNames; std::stringstream sStream(line); std::string colName; - while (std::getline(sStream, colName, ',')) { + while (ghoul::getline(sStream, colName, ',')) { columnNames.push_back(colName); } @@ -270,7 +271,7 @@ ExoplanetsDataPreparationTask::parseDataRow(std::string row, std::string name; std::string data; - while (std::getline(lineStream, data, ',')) { + while (ghoul::getline(lineStream, data, ',')) { const std::string& column = columnNames[columnIndex]; columnIndex++; @@ -457,7 +458,7 @@ glm::vec3 ExoplanetsDataPreparationTask::starPosition(const std::string& starNam } std::string line; - while (std::getline(exoplanetsFile, line)) { + while (ghoul::getline(exoplanetsFile, line)) { bool shouldSkipLine = ( line.empty() || line[0] == '#' || line.substr(0, 7) == "datavar" || line.substr(0, 10) == "texturevar" || line.substr(0, 7) == "texture" @@ -470,18 +471,18 @@ glm::vec3 ExoplanetsDataPreparationTask::starPosition(const std::string& starNam std::string data; std::string name; std::istringstream linestream(line); - std::getline(linestream, data, '#'); - std::getline(linestream, name); + ghoul::getline(linestream, data, '#'); + ghoul::getline(linestream, name); name.erase(0, 1); std::string coord; if (name == starName) { std::stringstream dataStream(data); - std::getline(dataStream, coord, ' '); + ghoul::getline(dataStream, coord, ' '); position[0] = std::stof(coord.c_str(), nullptr); - std::getline(dataStream, coord, ' '); + ghoul::getline(dataStream, coord, ' '); position[1] = std::stof(coord.c_str(), nullptr); - std::getline(dataStream, coord, ' '); + ghoul::getline(dataStream, coord, ' '); position[2] = std::stof(coord.c_str(), nullptr); break; } @@ -511,12 +512,12 @@ float ExoplanetsDataPreparationTask::bvFromTeff(float teff, float teffLower = 0.f; float teffUpper; std::string row; - while (std::getline(teffToBvFile, row)) { + while (ghoul::getline(teffToBvFile, row)) { std::istringstream lineStream(row); std::string teffString; - std::getline(lineStream, teffString, ','); + ghoul::getline(lineStream, teffString, ','); std::string bvString; - std::getline(lineStream, bvString); + ghoul::getline(lineStream, bvString); float teffCurrent = std::stof(teffString.c_str(), nullptr); float bvCurrent = std::stof(bvString.c_str(), nullptr); diff --git a/modules/fieldlines/rendering/renderablefieldlines.cpp b/modules/fieldlines/rendering/renderablefieldlines.cpp index 919310d3e6..914cf89a18 100644 --- a/modules/fieldlines/rendering/renderablefieldlines.cpp +++ b/modules/fieldlines/rendering/renderablefieldlines.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -372,7 +373,7 @@ void RenderableFieldlines::loadSeedPointsFromFile() { )); else { std::string line; - while (std::getline(seedFile, line)) { + while (ghoul::getline(seedFile, line)) { std::stringstream s(line); glm::vec3 point; diff --git a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp index a40f28615d..428e2917bd 100644 --- a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp +++ b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp @@ -877,7 +877,7 @@ std::unordered_map> LDEBUG(fmt::format("Reading seed points from file '{}'", seedFilePath)); std::string line; std::vector outVec; - while (std::getline(seedFile, line)) { + while (ghoul::getline(seedFile, line)) { std::stringstream ss(line); glm::vec3 point; ss >> point.x; @@ -916,7 +916,7 @@ std::vector std::istringstream ss(str.substr(2, str.size() - 4)); std::string magVar; size_t counter = 0; - while (std::getline(ss, magVar, ',')) { + while (ghoul::getline(ss, magVar, ',')) { magVar.erase( std::remove_if( magVar.begin(), diff --git a/modules/fitsfilereader/src/fitsfilereader.cpp b/modules/fitsfilereader/src/fitsfilereader.cpp index fa90651c72..c424ffb3bc 100644 --- a/modules/fitsfilereader/src/fitsfilereader.cpp +++ b/modules/fitsfilereader/src/fitsfilereader.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #ifdef WIN32 @@ -544,7 +545,7 @@ std::vector FitsFileReader::readSpeckFile(const std::filesystem::path& fi std::string line; while (true) { std::streampos position = fileStream.tellg(); - std::getline(fileStream, line); + ghoul::getline(fileStream, line); if (line.empty() || line[0] == '#') { continue; @@ -597,7 +598,7 @@ std::vector FitsFileReader::readSpeckFile(const std::filesystem::path& fi std::vector readValues(nValuesPerStar); nStars++; - std::getline(fileStream, line); + ghoul::getline(fileStream, line); std::stringstream str(line); // Read values. diff --git a/modules/galaxy/rendering/renderablegalaxy.cpp b/modules/galaxy/rendering/renderablegalaxy.cpp index 1e4b162861..b68fb72ece 100644 --- a/modules/galaxy/rendering/renderablegalaxy.cpp +++ b/modules/galaxy/rendering/renderablegalaxy.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -736,10 +737,10 @@ RenderableGalaxy::Result RenderableGalaxy::loadPointFile() { // Read header for OFF (Object File Format) std::string line; - std::getline(pointFile, line); + ghoul::getline(pointFile, line); // Read point count - std::getline(pointFile, line); + ghoul::getline(pointFile, line); std::istringstream iss(line); iss >> nPoints; @@ -752,7 +753,7 @@ RenderableGalaxy::Result RenderableGalaxy::loadPointFile() { ++i) { float x, y, z, r, g, b, a; - std::getline(pointFile, line); + ghoul::getline(pointFile, line); std::istringstream issp(line); issp >> x >> y >> z >> r >> g >> b >> a; diff --git a/modules/globebrowsing/src/globelabelscomponent.cpp b/modules/globebrowsing/src/globelabelscomponent.cpp index 0755f28901..d546937bfc 100644 --- a/modules/globebrowsing/src/globelabelscomponent.cpp +++ b/modules/globebrowsing/src/globelabelscomponent.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -359,14 +360,14 @@ bool GlobeLabelsComponent::readLabelsFile(const std::filesystem::path& file) { std::string sline; while (!csvLabelFile.eof()) { - std::getline(csvLabelFile, sline); + ghoul::getline(csvLabelFile, sline); if (sline.size() <= 10) { continue; } std::istringstream iss(sline); std::string token; - std::getline(iss, token, ','); + ghoul::getline(iss, token, ','); // First line is just the Header if (token == "Feature_Name") { @@ -392,18 +393,18 @@ bool GlobeLabelsComponent::readLabelsFile(const std::filesystem::path& file) { tokenChar++; } - std::getline(iss, token, ','); // Target is not used + ghoul::getline(iss, token, ','); // Target is not used - std::getline(iss, token, ','); // Diameter + ghoul::getline(iss, token, ','); // Diameter lEntry.diameter = std::stof(token); - std::getline(iss, token, ','); // Latitude + ghoul::getline(iss, token, ','); // Latitude lEntry.latitude = std::stof(token); - std::getline(iss, token, ','); // Longitude + ghoul::getline(iss, token, ','); // Longitude lEntry.longitude = std::stof(token); - std::getline(iss, token, ','); // Coord System + ghoul::getline(iss, token, ','); // Coord System std::string coordinateSystem(token); std::size_t found = coordinateSystem.find("West"); if (found != std::string::npos) { @@ -412,9 +413,9 @@ bool GlobeLabelsComponent::readLabelsFile(const std::filesystem::path& file) { // Clean white spaces std::istringstream issFeature(lEntry.feature); - std::getline(issFeature, token, '='); + ghoul::getline(issFeature, token, '='); if (token.empty()) { - std::getline(issFeature, token, '='); + ghoul::getline(issFeature, token, '='); } strncpy(lEntry.feature, token.c_str(), 255); diff --git a/modules/iswa/rendering/datacygnet.cpp b/modules/iswa/rendering/datacygnet.cpp index 5a63ce85a2..fcf4b46001 100644 --- a/modules/iswa/rendering/datacygnet.cpp +++ b/modules/iswa/rendering/datacygnet.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -279,7 +280,7 @@ void DataCygnet::readTransferFunctions(std::string tfPath) { if (tfFile.is_open()) { std::string line; - while (getline(tfFile, line)) { + while (ghoul::getline(tfFile, line)) { tfs.emplace_back(absPath(line).string()); } diff --git a/modules/iswa/rendering/iswakameleongroup.cpp b/modules/iswa/rendering/iswakameleongroup.cpp index dab593a60d..9da5ae9038 100644 --- a/modules/iswa/rendering/iswakameleongroup.cpp +++ b/modules/iswa/rendering/iswakameleongroup.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include namespace { @@ -109,7 +110,7 @@ void IswaKameleonGroup::readFieldlinePaths(const std::string& indexFile) { else { std::string line; std::string fileContent; - while (std::getline(seedFile, line)) { + while (ghoul::getline(seedFile, line)) { fileContent += line; } diff --git a/modules/iswa/util/dataprocessortext.cpp b/modules/iswa/util/dataprocessortext.cpp index 99c2ed623c..38330482b1 100644 --- a/modules/iswa/util/dataprocessortext.cpp +++ b/modules/iswa/util/dataprocessortext.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -51,21 +52,21 @@ std::vector DataProcessorText::readMetadata(const std::string& data std::vector options; std::string line; std::stringstream memorystream(data); - while (getline(memorystream, line)) { + while (ghoul::getline(memorystream, line)) { if (line.find(info) == 0) { line = line.substr(info.size()); std::stringstream ss(line); std::string token; - getline(ss, token, 'x'); + ghoul::getline(ss, token, 'x'); const int x = std::stoi(token); - getline(ss, token, '='); + ghoul::getline(ss, token, '='); const int y = std::stoi(token); dimensions = glm::size3_t(x, y, 1); - getline(memorystream, line); + ghoul::getline(memorystream, line); line = line.substr(1); //because of the # char ss = std::stringstream(line); @@ -98,7 +99,7 @@ void DataProcessorText::addDataValues(const std::string& data, std::vector> optionValues(numOptions); // for each data point - while (getline(memorystream, line)) { + while (ghoul::getline(memorystream, line)) { if (!line.empty() && line[0] == '#') { continue; } @@ -170,7 +171,7 @@ std::vector DataProcessorText::processData(const std::string& data, } int numValues = 0; - while (getline(memorystream, line)) { + while (ghoul::getline(memorystream, line)) { if (!line.empty() && line[0] == '#') { continue; } diff --git a/modules/iswa/util/iswamanager.cpp b/modules/iswa/util/iswamanager.cpp index 6b3d86d121..75dd5d3c46 100644 --- a/modules/iswa/util/iswamanager.cpp +++ b/modules/iswa/util/iswamanager.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -273,13 +274,13 @@ std::string IswaManager::iswaUrl(int id, double timestamp, const std::string& ty ss << SpiceManager::ref().dateFromEphemerisTime(timestamp);; std::string token; - std::getline(ss, token, ' '); + ghoul::getline(ss, token, ' '); url += token + "-"; - std::getline(ss, token, ' '); + ghoul::getline(ss, token, ' '); url = fmt::format("{}{}-", url, monthNumber(token)); - std::getline(ss, token, 'T'); + ghoul::getline(ss, token, 'T'); url += token + "%20"; - std::getline(ss, token, '.'); + ghoul::getline(ss, token, '.'); url += token; return url; diff --git a/modules/space/horizonsfile.cpp b/modules/space/horizonsfile.cpp index efb5036811..8e88399b8b 100644 --- a/modules/space/horizonsfile.cpp +++ b/modules/space/horizonsfile.cpp @@ -258,8 +258,8 @@ HorizonsResultCode isValidHorizonsFile(std::filesystem::path file) { // The line $$SOE indicates start of data. std::string line; bool foundTarget = false; - std::getline(fileStream, line); - std::getline(fileStream, line); // First line is just stars (*) no information, skip + ghoul::getline(fileStream, line); + ghoul::getline(fileStream, line); // First line is just stars (*) no information, skip // @CPP23 (malej, 2022-04-08) In all cases below, the string function contains // should be used instead of find @@ -338,7 +338,7 @@ HorizonsResultCode isValidHorizonsFile(std::filesystem::path file) { return HorizonsResultCode::ErrorNoTarget; } - std::getline(fileStream, line); + ghoul::getline(fileStream, line); } if (result != HorizonsResultCode::UnknownError) { @@ -505,14 +505,14 @@ HorizonsResult readHorizonsFile(std::filesystem::path file) { // X Y Z // " Before data starts, Observer table doesn't std::string line; - std::getline(fileStream, line); + ghoul::getline(fileStream, line); while (line[0] != '$') { if (line.starts_with("JDTDB")) { fileStream.close(); return readHorizonsVectorFile(file); } - std::getline(fileStream, line); + ghoul::getline(fileStream, line); } fileStream.close(); @@ -536,12 +536,12 @@ HorizonsResult readHorizonsVectorFile(std::filesystem::path file) { // the row marked by $$SOE (i.e. Start Of Ephemerides). std::string line; do { - std::getline(fileStream, line); + ghoul::getline(fileStream, line); } while (line[0] != '$'); // Read data line by line until $$EOE (i.e. End Of Ephemerides). // Skip the rest of the file. - std::getline(fileStream, line); // Skip the line with the $$EOE + ghoul::getline(fileStream, line); // Skip the line with the $$EOE while (line[0] != '$') { HorizonsKeyframe dataPoint; std::stringstream str1(line); @@ -555,7 +555,7 @@ HorizonsResult readHorizonsVectorFile(std::filesystem::path file) { str1 >> temp >> temp >> temp >> date >> time >> temp; // Get next line of same data point - std::getline(fileStream, line); + ghoul::getline(fileStream, line); if (!fileStream.good()) { LERROR(fmt::format("Malformed Horizons file '{}'", file)); return HorizonsResult(); @@ -581,7 +581,7 @@ HorizonsResult readHorizonsVectorFile(std::filesystem::path file) { dataPoint.position = pos; data.push_back(dataPoint); - std::getline(fileStream, line); + ghoul::getline(fileStream, line); } result.data = data; @@ -605,12 +605,12 @@ HorizonsResult readHorizonsObserverFile(std::filesystem::path file) { // the row marked by $$SOE (i.e. Start Of Ephemerides). std::string line; do { - std::getline(fileStream, line); + ghoul::getline(fileStream, line); } while (line[0] != '$'); // Read data line by line until $$EOE (i.e. End Of Ephemerides). // Skip the rest of the file. - std::getline(fileStream, line); // Skip the line with the $$EOE + ghoul::getline(fileStream, line); // Skip the line with the $$EOE while (line[0] != '$') { HorizonsKeyframe dataPoint; std::stringstream str(line); @@ -644,7 +644,7 @@ HorizonsResult readHorizonsObserverFile(std::filesystem::path file) { dataPoint.position = gPos; data.push_back(dataPoint); - std::getline(fileStream, line); + ghoul::getline(fileStream, line); } LWARNING( @@ -686,7 +686,7 @@ std::vector HorizonsFile::parseMatches(const std::string& startPhra break; } - std::getline(fileStream, line); + ghoul::getline(fileStream, line); } if (!fileStream.good()) { @@ -695,8 +695,8 @@ std::vector HorizonsFile::parseMatches(const std::string& startPhra } // There will be one empty line before the list of matches, skip - std::getline(fileStream, line); - std::getline(fileStream, line); + ghoul::getline(fileStream, line); + ghoul::getline(fileStream, line); while (fileStream.good()) { // End of matches or file if (line == " " || line.empty() || line.find(endPhrase) != std::string::npos) { @@ -705,7 +705,7 @@ std::vector HorizonsFile::parseMatches(const std::string& startPhra } matches.push_back(line); - std::getline(fileStream, line); + ghoul::getline(fileStream, line); } fileStream.close(); @@ -756,7 +756,7 @@ std::pair HorizonsFile::parseValidTimeRange( // Ignore everything until head of time range list std::string line; - std::getline(fileStream, line); + ghoul::getline(fileStream, line); while (fileStream.good()) { // Add the line with the start phrase first, to give context if (line.find(startPhrase) != std::string::npos) { @@ -768,7 +768,7 @@ std::pair HorizonsFile::parseValidTimeRange( break; } - std::getline(fileStream, line); + ghoul::getline(fileStream, line); } if (!fileStream.good()) { @@ -776,12 +776,12 @@ std::pair HorizonsFile::parseValidTimeRange( } // There will be one empty line before the list of time ranges, skip - std::getline(fileStream, line); + ghoul::getline(fileStream, line); // In the first file parse both start and end time // From the first line get the start time std::string startTime, endTime; - std::getline(fileStream, line); + ghoul::getline(fileStream, line); if (fileStream.good()) { std::stringstream str(line); @@ -845,7 +845,7 @@ std::pair HorizonsFile::parseValidTimeRange( return { "", "" }; } - std::getline(fileStream, line); + ghoul::getline(fileStream, line); } return { "", "" }; diff --git a/modules/space/kepler.cpp b/modules/space/kepler.cpp index 0e6ca11493..07c677134f 100644 --- a/modules/space/kepler.cpp +++ b/modules/space/kepler.cpp @@ -396,7 +396,7 @@ std::vector readTleFile(std::filesystem::path file) { int lineNum = 1; std::string header; - while (std::getline(f, header)) { + while (ghoul::getline(f, header)) { Parameters p; // Header @@ -419,7 +419,7 @@ std::vector readTleFile(std::filesystem::path file) { // 13 65-68 Element set number.Incremented when a new TLE is generated // 14 69-69 Checksum (modulo 10) std::string firstLine; - std::getline(f, firstLine); + ghoul::getline(f, firstLine); if (f.bad() || firstLine[0] != '1') { throw ghoul::RuntimeError(fmt::format( "Malformed TLE file '{}' at line {}", file, lineNum + 1 @@ -451,7 +451,7 @@ std::vector readTleFile(std::filesystem::path file) { // 9 64-68 Revolution number at epoch (revolutions) // 10 69-69 Checksum (modulo 10) std::string secondLine; - std::getline(f, secondLine); + ghoul::getline(f, secondLine); if (f.bad() || secondLine[0] != '2') { throw ghoul::RuntimeError(fmt::format( "Malformed TLE file '{}' at line {}", file, lineNum + 1 @@ -513,7 +513,7 @@ std::vector readOmmFile(std::filesystem::path file) { int lineNum = 1; std::optional current = std::nullopt; std::string line; - while (std::getline(f, line)) { + while (ghoul::getline(f, line)) { if (line.empty() || line == "\r") { continue; } @@ -604,7 +604,7 @@ std::vector readSbdbFile(std::filesystem::path file) { f.open(file); std::string line; - std::getline(f, line); + ghoul::getline(f, line); // Newer versions downloaded from the JPL SBDB website have " around variables line.erase(remove(line.begin(), line.end(), '\"'), line.end()); if (line != ExpectedHeader) { @@ -615,7 +615,7 @@ std::vector readSbdbFile(std::filesystem::path file) { } std::vector result; - while (std::getline(f, line)) { + while (ghoul::getline(f, line)) { constexpr double AuToKm = 1.496e8; std::vector parts = ghoul::tokenizeString(line, ','); diff --git a/modules/space/rendering/renderableconstellationbounds.cpp b/modules/space/rendering/renderableconstellationbounds.cpp index a495d303e1..2d873521f2 100644 --- a/modules/space/rendering/renderableconstellationbounds.cpp +++ b/modules/space/rendering/renderableconstellationbounds.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -238,7 +239,7 @@ bool RenderableConstellationBounds::loadVertexFile() { // a new constellation name, at which point the currentBound is stored away, a new, // empty ConstellationBound is created and set at the currentBound while (file.good()) { - std::getline(file, currentLine); + ghoul::getline(file, currentLine); if (currentLine.empty()) { continue; } diff --git a/modules/space/rendering/renderableconstellationlines.cpp b/modules/space/rendering/renderableconstellationlines.cpp index f8b2b5f013..3873ff0d0f 100644 --- a/modules/space/rendering/renderableconstellationlines.cpp +++ b/modules/space/rendering/renderableconstellationlines.cpp @@ -331,7 +331,7 @@ bool RenderableConstellationLines::readSpeckFile() { // (signaled by the keywords 'datavar', 'texturevar', and 'texture') std::string line; while (true) { - std::getline(file, line); + ghoul::getline(file, line); if (file.eof()) { break; @@ -377,7 +377,7 @@ bool RenderableConstellationLines::readSpeckFile() { str >> dummy; } while (dummy != "{"); - std::getline(file, line); + ghoul::getline(file, line); // Read the identifier std::stringstream id(line); @@ -385,7 +385,7 @@ bool RenderableConstellationLines::readSpeckFile() { id >> dummy; // id command dummy.clear(); - std::getline(id, identifier); // identifier + ghoul::getline(id, identifier); // identifier ghoul::trimWhitespace(identifier); std::string name = constellationFullName(identifier); if (!name.empty()) { @@ -393,13 +393,13 @@ bool RenderableConstellationLines::readSpeckFile() { } // Read the number of vertices - std::getline(file, line); + ghoul::getline(file, line); std::stringstream dim(line); dim >> constellationLine.numV; // We can now read the vertices data: for (int l = 0; l < constellationLine.numV; ++l) { - std::getline(file, line); + ghoul::getline(file, line); if (line.substr(0, 1) == "}") { break; } @@ -425,7 +425,7 @@ bool RenderableConstellationLines::readSpeckFile() { maxRadius = std::max(maxRadius, r); } - std::getline(file, line); + ghoul::getline(file, line); if (line.substr(0, 1) == "}") { _renderingConstellationsMap.insert({ lineIndex++, constellationLine }); } diff --git a/modules/space/rendering/renderableconstellationsbase.cpp b/modules/space/rendering/renderableconstellationsbase.cpp index 747db8bcd4..36c3914be5 100644 --- a/modules/space/rendering/renderableconstellationsbase.cpp +++ b/modules/space/rendering/renderableconstellationsbase.cpp @@ -161,7 +161,7 @@ void RenderableConstellationsBase::loadConstellationFile() { std::string line; while (file.good()) { - std::getline(file, line); + ghoul::getline(file, line); if (line.empty()) { continue; } @@ -171,7 +171,7 @@ void RenderableConstellationsBase::loadConstellationFile() { s >> abbreviation; std::string fullName; - std::getline(s, fullName); + ghoul::getline(s, fullName); ghoul::trimWhitespace(fullName); _namesTranslation[abbreviation] = fullName; } diff --git a/modules/space/rendering/renderablefluxnodes.cpp b/modules/space/rendering/renderablefluxnodes.cpp index 5b18355ae1..dbb7352711 100644 --- a/modules/space/rendering/renderablefluxnodes.cpp +++ b/modules/space/rendering/renderablefluxnodes.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -617,7 +618,7 @@ void RenderableFluxNodes::populateStartTimes() { std::string line; // gets only first line to "remove" header - std::getline(tfs, line); + ghoul::getline(tfs, line); std::stringstream s; s << line; @@ -627,7 +628,7 @@ void RenderableFluxNodes::populateStartTimes() { while (s >> columnName) { ++nColumns; } - while (std::getline(tfs, line)) { // for each line of data + while (ghoul::getline(tfs, line)) { // for each line of data std::istringstream iss(line); for (int i = 0; i < nColumns; ++i) { // for each column in line std::string columnValue; diff --git a/modules/space/tasks/generatedebrisvolumetask.cpp b/modules/space/tasks/generatedebrisvolumetask.cpp index 5c535ce4fc..bd7505702e 100644 --- a/modules/space/tasks/generatedebrisvolumetask.cpp +++ b/modules/space/tasks/generatedebrisvolumetask.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -266,11 +267,11 @@ std::vector readTLEFile(const std::string& filename){ std::string line = "-"; for (int i = 0; i < numberOfObjects; i++) { - std::getline(file, line); // get rid of title + ghoul::getline(file, line); // get rid of title KeplerParameters keplerElements; - std::getline(file, line); + ghoul::getline(file, line); if (line[0] == '1') { // First line // Field Columns Content @@ -296,7 +297,7 @@ std::vector readTLEFile(const std::string& filename){ )); } - std::getline(file, line); + ghoul::getline(file, line); if (line[0] == '2') { // Second line // Field Columns Content diff --git a/modules/spacecraftinstruments/util/hongkangparser.cpp b/modules/spacecraftinstruments/util/hongkangparser.cpp index 9024f434cc..ce9ffc4911 100644 --- a/modules/spacecraftinstruments/util/hongkangparser.cpp +++ b/modules/spacecraftinstruments/util/hongkangparser.cpp @@ -166,7 +166,7 @@ bool HongKangParser::create() { std::string line; while (!file.eof()) { - std::getline(file, line); + ghoul::getline(file, line); std::string event = line.substr(0, line.find_first_of(' ')); diff --git a/modules/spacecraftinstruments/util/instrumenttimesparser.cpp b/modules/spacecraftinstruments/util/instrumenttimesparser.cpp index 326f45a92d..0fbb09e41c 100644 --- a/modules/spacecraftinstruments/util/instrumenttimesparser.cpp +++ b/modules/spacecraftinstruments/util/instrumenttimesparser.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -94,7 +95,7 @@ bool InstrumentTimesParser::create() { std::smatch matches; TimeRange instrumentActiveTimeRange; bool successfulRead = true; - while (std::getline(inFile, line)) { + while (ghoul::getline(inFile, line)) { if (!std::regex_match(line, matches, _pattern)) { continue; } diff --git a/modules/spacecraftinstruments/util/labelparser.cpp b/modules/spacecraftinstruments/util/labelparser.cpp index b374ecbee5..c35957d68e 100644 --- a/modules/spacecraftinstruments/util/labelparser.cpp +++ b/modules/spacecraftinstruments/util/labelparser.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -175,7 +176,7 @@ bool LabelParser::create() { double stopTime = 0.0; std::string line; do { - std::getline(file, line); + ghoul::getline(file, line); line.erase(std::remove(line.begin(), line.end(), '"'), line.end()); line.erase(std::remove(line.begin(), line.end(), ' '), line.end()); @@ -227,7 +228,7 @@ bool LabelParser::create() { startTime = SpiceManager::ref().ephemerisTimeFromDate(start); count++; - std::getline(file, line); + ghoul::getline(file, line); line.erase(std::remove(line.begin(), line.end(), '"'), line.end()); line.erase(std::remove(line.begin(), line.end(), ' '), line.end()); line.erase(std::remove(line.begin(), line.end(), '\r'), line.end()); diff --git a/modules/sync/syncs/httpsynchronization.cpp b/modules/sync/syncs/httpsynchronization.cpp index 6c4c493d91..b05f26e327 100644 --- a/modules/sync/syncs/httpsynchronization.cpp +++ b/modules/sync/syncs/httpsynchronization.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -212,7 +213,7 @@ bool HttpSynchronization::isEachFileDownloaded() { //Optionally list of already synched files if (ossyncVersion == OssyncVersionNumber) { - std::getline(file >> std::ws, line); // Read synchronization status + ghoul::getline(file >> std::ws, line); // Read synchronization status if (line == SynchronizationToken) { return true; } diff --git a/modules/sync/syncs/urlsynchronization.cpp b/modules/sync/syncs/urlsynchronization.cpp index c919736fa2..db7387897f 100644 --- a/modules/sync/syncs/urlsynchronization.cpp +++ b/modules/sync/syncs/urlsynchronization.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -221,7 +222,7 @@ bool UrlSynchronization::isEachFileValid() { // Valid to: yyyy-mm-ddThr:mn:sc.xxx if (ossyncVersion == "1.0") { - std::getline(file >> std::ws, line); + ghoul::getline(file >> std::ws, line); std::string& fileIsValidToDate = line; double fileValidAsJ2000 = Time::convertTime(fileIsValidToDate); diff --git a/src/data/speckloader.cpp b/src/data/speckloader.cpp index dbe254135c..710c8873a3 100644 --- a/src/data/speckloader.cpp +++ b/src/data/speckloader.cpp @@ -86,7 +86,7 @@ Dataset loadSpeckFile(std::filesystem::path path, std::optional spe std::string line; // First phase: Loading the header information - while (std::getline(file, line)) { + while (ghoul::getline(file, line)) { currentLineNumber++; // Guard against wrong line endings (copying files from Windows to Mac) causes @@ -232,9 +232,9 @@ Dataset loadSpeckFile(std::filesystem::path path, std::optional spe ); // For the first line, we already loaded it and rejected it above, so if we do another - // std::getline, we'd miss the first data value line + // ghoul::getline, we'd miss the first data value line bool isFirst = true; - while (isFirst || std::getline(file, line)) { + while (isFirst || ghoul::getline(file, line)) { currentLineNumber++; isFirst = false; @@ -330,7 +330,7 @@ Dataset loadSpeckFile(std::filesystem::path path, std::optional spe } std::string rest; - std::getline(str, rest); + ghoul::getline(str, rest); if (!rest.empty()) { strip(rest); @@ -368,7 +368,7 @@ Labelset loadLabelFile(std::filesystem::path path) { std::string line; // First phase: Loading the header information - while (std::getline(file, line)) { + while (ghoul::getline(file, line)) { // Ignore empty line or commented-out lines if (line.empty() || line[0] == '#') { continue; @@ -408,9 +408,9 @@ Labelset loadLabelFile(std::filesystem::path path) { } // For the first line, we already loaded it and rejected it above, so if we do another - // std::getline, we'd miss the first data value line + // ghoul::getline, we'd miss the first data value line bool isFirst = true; - while (isFirst || std::getline(file, line)) { + while (isFirst || ghoul::getline(file, line)) { isFirst = false; // Ignore empty line or commented-out lines @@ -448,7 +448,7 @@ Labelset loadLabelFile(std::filesystem::path path) { str >> entry.position.x >> entry.position.y >> entry.position.z; std::string rest; - std::getline(str, rest); + ghoul::getline(str, rest); strip(rest); if (startsWith(rest, "id")) { @@ -502,7 +502,7 @@ ColorMap loadCmapFile(std::filesystem::path path) { int nColorLines = -1; std::string line; - while (std::getline(file, line)) { + while (ghoul::getline(file, line)) { // Ignore empty line or commented-out lines if (line.empty() || line[0] == '#') { continue; diff --git a/src/engine/downloadmanager.cpp b/src/engine/downloadmanager.cpp index 199688c40f..36f12f37ee 100644 --- a/src/engine/downloadmanager.cpp +++ b/src/engine/downloadmanager.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -261,8 +262,8 @@ std::future DownloadManager::fetchFile( if (res == CURLE_OK) { std::string extension = std::string(ct); std::stringstream ss(extension); - getline(ss, extension ,'/'); - getline(ss, extension); + ghoul::getline(ss, extension ,'/'); + ghoul::getline(ss, extension); file.format = extension; } else { diff --git a/src/interaction/sessionrecording.cpp b/src/interaction/sessionrecording.cpp index 9cb631505c..c9b295b497 100644 --- a/src/interaction/sessionrecording.cpp +++ b/src/interaction/sessionrecording.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -1111,7 +1112,7 @@ bool SessionRecording::playbackAddEntriesToTimeline() { } } else { - while (parsingStatusOk && std::getline(_playbackFile, _playbackLineParsing)) { + while (parsingStatusOk && ghoul::getline(_playbackFile, _playbackLineParsing)) { _playbackLineNum++; std::istringstream iss(_playbackLineParsing); @@ -2484,7 +2485,7 @@ bool SessionRecording::convertEntries(std::string& inFilename, } } else { - while (conversionStatusOk && std::getline(inStream, lineParsing)) { + while (conversionStatusOk && ghoul::getline(inStream, lineParsing)) { lineNum++; std::istringstream iss(lineParsing); diff --git a/src/interaction/tasks/convertrecformattask.cpp b/src/interaction/tasks/convertrecformattask.cpp index b5a95c70a9..86a05d5ea7 100644 --- a/src/interaction/tasks/convertrecformattask.cpp +++ b/src/interaction/tasks/convertrecformattask.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -126,7 +127,7 @@ void ConvertRecFormatTask::convert() { _iFile.open(_inFilePath, std::ifstream::in); //Throw out first line std::string throw_out; - std::getline(_iFile, throw_out); + ghoul::getline(_iFile, throw_out); _oFile.open(_outFilePath); } else if (_fileFormatType == SessionRecording::DataMode::Binary) { @@ -252,7 +253,7 @@ void ConvertRecFormatTask::convertToBinary() { _oFile.write(&tmpType, 1); _oFile.write("\n", 1); - while (std::getline(_iFile, lineContents)) { + while (ghoul::getline(_iFile, lineContents)) { lineNum++; std::istringstream iss(lineContents); diff --git a/src/rendering/transferfunction.cpp b/src/rendering/transferfunction.cpp index 5d663e9c80..ef6b657b2e 100644 --- a/src/rendering/transferfunction.cpp +++ b/src/rendering/transferfunction.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -110,7 +111,7 @@ void TransferFunction::setTextureFromTxt() { std::string line; - while (std::getline(in, line)) { + while (ghoul::getline(in, line)) { std::istringstream iss(line); std::string key; iss >> key; diff --git a/src/util/versionchecker.cpp b/src/util/versionchecker.cpp index df9a8d853c..dfd64f835a 100644 --- a/src/util/versionchecker.cpp +++ b/src/util/versionchecker.cpp @@ -83,11 +83,11 @@ void VersionChecker::cancel() { std::istringstream versionData(versionString); std::string token; - std::getline(versionData, token, '.'); + ghoul::getline(versionData, token, '.'); int major = std::atoi(token.c_str()); - std::getline(versionData, token, '.'); + ghoul::getline(versionData, token, '.'); int minor = std::atoi(token.c_str()); - std::getline(versionData, token, '.'); + ghoul::getline(versionData, token, '.'); int patch = std::atoi(token.c_str()); _latestVersion = { major, minor, patch };