mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-23 20:50:59 -05:00
Replaced std::getline usages with new ghoul::getline
This commit is contained in:
@@ -86,7 +86,7 @@ Dataset loadSpeckFile(std::filesystem::path path, std::optional<DataMapping> 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<DataMapping> 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<DataMapping> 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;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/misc/assert.h>
|
||||
#include <ghoul/misc/stringhelper.h>
|
||||
#include <ghoul/misc/thread.h>
|
||||
#include <curl/curl.h>
|
||||
#include <chrono>
|
||||
@@ -261,8 +262,8 @@ std::future<DownloadManager::MemoryFile> 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 {
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#include <ghoul/glm.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/misc/profiling.h>
|
||||
#include <ghoul/misc/stringhelper.h>
|
||||
#include <algorithm>
|
||||
#include <filesystem>
|
||||
#include <iomanip>
|
||||
@@ -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);
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <ghoul/filesystem/file.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/misc/stringhelper.h>
|
||||
#include <filesystem>
|
||||
#include <iomanip>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
@@ -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);
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <ghoul/filesystem/file.h>
|
||||
#include <ghoul/io/texture/texturereader.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/misc/stringhelper.h>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
#include <iterator>
|
||||
#include <filesystem>
|
||||
@@ -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;
|
||||
|
||||
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user