Skip to content

Commit

Permalink
Retrieve the entire provided string with >> operators
Browse files Browse the repository at this point in the history
  • Loading branch information
cbentejac committed Jan 31, 2024
1 parent ad531c8 commit d84f565
Show file tree
Hide file tree
Showing 32 changed files with 45 additions and 87 deletions.
3 changes: 1 addition & 2 deletions src/aliceVision/calibration/patternDetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ namespace calibration {

std::istream& operator>>(std::istream& stream, Pattern& pattern)
{
std::string token;
stream >> token;
std::string token(std::istreambuf_iterator<char>(stream), {});
boost::to_upper(token);

if (token == "CHESSBOARD")
Expand Down
3 changes: 1 addition & 2 deletions src/aliceVision/camera/IntrinsicInitMode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ inline std::ostream& operator<<(std::ostream& os, const EInitMode initMode)

inline std::istream& operator>>(std::istream& in, EInitMode& initMode)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
initMode = EInitMode_stringToEnum(token);
return in;
}
Expand Down
3 changes: 1 addition & 2 deletions src/aliceVision/camera/cameraCommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ inline std::ostream& operator<<(std::ostream& os, EINTRINSIC e) { return os << E

inline std::istream& operator>>(std::istream& in, EINTRINSIC& e)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
e = EINTRINSIC_stringToEnum(token);
return in;
}
Expand Down
9 changes: 3 additions & 6 deletions src/aliceVision/feature/ImageDescriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ std::ostream& operator<<(std::ostream& os, EImageDescriberPreset p) { return os

std::istream& operator>>(std::istream& in, EImageDescriberPreset& p)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
p = EImageDescriberPreset_stringToEnum(token);
return in;
}
Expand Down Expand Up @@ -122,8 +121,7 @@ std::ostream& operator<<(std::ostream& os, EFeatureQuality p) { return os << EFe

std::istream& operator>>(std::istream& in, EFeatureQuality& p)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
p = EFeatureQuality_stringToEnum(token);
return in;
}
Expand Down Expand Up @@ -180,8 +178,7 @@ std::ostream& operator<<(std::ostream& os, EFeatureConstrastFiltering p) { retur

std::istream& operator>>(std::istream& in, EFeatureConstrastFiltering& p)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
p = EFeatureConstrastFiltering_stringToEnum(token);
return in;
}
Expand Down
3 changes: 1 addition & 2 deletions src/aliceVision/hdr/brackets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ inline std::ostream& operator<<(std::ostream& os, ECalibrationMethod calibration

inline std::istream& operator>>(std::istream& in, ECalibrationMethod& calibrationMethod)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
calibrationMethod = ECalibrationMethod_stringToEnum(token);
return in;
}
Expand Down
3 changes: 1 addition & 2 deletions src/aliceVision/hdr/rgbCurve.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ inline std::ostream& operator<<(std::ostream& os, const EFunctionType functionTy

inline std::istream& operator>>(std::istream& in, EFunctionType& functionType)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
functionType = EFunctionType_stringToEnum(token);
return in;
}
Expand Down
15 changes: 5 additions & 10 deletions src/aliceVision/image/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ std::ostream& operator<<(std::ostream& os, EImageFileType imageFileType) { retur

std::istream& operator>>(std::istream& in, EImageFileType& imageFileType)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
imageFileType = EImageFileType_stringToEnum(token);
return in;
}
Expand Down Expand Up @@ -278,8 +277,7 @@ std::ostream& operator<<(std::ostream& os, EStorageDataType dataType) { return o

std::istream& operator>>(std::istream& in, EStorageDataType& dataType)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
dataType = EStorageDataType_stringToEnum(token);
return in;
}
Expand Down Expand Up @@ -360,8 +358,7 @@ std::ostream& operator<<(std::ostream& os, EImageExrCompression exrCompression)

std::istream& operator>>(std::istream& in, EImageExrCompression& exrCompression)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
exrCompression = EImageExrCompression_stringToEnum(token);
return in;
}
Expand Down Expand Up @@ -402,8 +399,7 @@ std::ostream& operator<<(std::ostream& os, EImageQuality imageQuality) { return

std::istream& operator>>(std::istream& in, EImageQuality& imageQuality)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
imageQuality = EImageQuality_stringToEnum(token);
return in;
}
Expand Down Expand Up @@ -474,8 +470,7 @@ std::ostream& operator<<(std::ostream& os, ERawColorInterpretation rawColorInter

std::istream& operator>>(std::istream& in, ERawColorInterpretation& rawColorInterpretation)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
rawColorInterpretation = ERawColorInterpretation_stringToEnum(token);
return in;
}
Expand Down
3 changes: 1 addition & 2 deletions src/aliceVision/imageMatching/ImageMatching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ std::ostream& operator<<(std::ostream& os, EImageMatchingMethod m) { return os <

std::istream& operator>>(std::istream& in, EImageMatchingMethod& m)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
m = EImageMatchingMethod_stringToEnum(token);
return in;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ inline std::ostream& operator<<(std::ostream& os, const EGeometricFilterType geo

inline std::istream& operator>>(std::istream& in, EGeometricFilterType& geometricFilterType)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
geometricFilterType = EGeometricFilterType_stringToEnum(token);
return in;
}
Expand Down
3 changes: 1 addition & 2 deletions src/aliceVision/mesh/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ EFileType EFileType_stringToEnum(const std::string& meshFileType)
std::ostream& operator<<(std::ostream& os, EFileType meshFileType) { return os << EFileType_enumToString(meshFileType); }
std::istream& operator>>(std::istream& in, EFileType& meshFileType)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
meshFileType = EFileType_stringToEnum(token);
return in;
}
Expand Down
3 changes: 1 addition & 2 deletions src/aliceVision/mesh/Texturing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ std::string EBumpMappingType_enumToString(EBumpMappingType type)
std::ostream& operator<<(std::ostream& os, EBumpMappingType bumpMappingType) { return os << EBumpMappingType_enumToString(bumpMappingType); }
std::istream& operator>>(std::istream& in, EBumpMappingType& bumpMappingType)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
bumpMappingType = EBumpMappingType_stringToEnum(token);
return in;
}
Expand Down
3 changes: 1 addition & 2 deletions src/aliceVision/robustEstimation/estimators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ inline std::ostream& operator<<(std::ostream& os, ERobustEstimator e) { return o

inline std::istream& operator>>(std::istream& in, ERobustEstimator& estimatorType)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
estimatorType = robustEstimation::ERobustEstimator_stringToEnum(token);
return in;
}
Expand Down
3 changes: 1 addition & 2 deletions src/aliceVision/sfm/bundle/BundleAdjustment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ inline std::ostream& operator<<(std::ostream& os, EFeatureConstraint m) { return

inline std::istream& operator>>(std::istream& in, EFeatureConstraint& m)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
m = ESfMobservationConstraint_stringToEnum(token);
return in;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ inline std::ostream& operator<<(std::ostream& os, ERotationAveragingMethod e) {

inline std::istream& operator>>(std::istream& in, ERotationAveragingMethod& rotationType)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
rotationType = ERotationAveragingMethod_stringToEnum(token);
return in;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ inline std::ostream& operator<<(std::ostream& os, ETranslationAveragingMethod e)

inline std::istream& operator>>(std::istream& in, ETranslationAveragingMethod& translationType)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
translationType = ETranslationAveragingMethod_stringToEnum(token);
return in;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ inline std::ostream& operator<<(std::ostream& os, ERelativeRotationMethod rotati

inline std::istream& operator>>(std::istream& in, ERelativeRotationMethod& rotationMethod)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
rotationMethod = ERelativeRotationMethod_stringToEnum(token);
return in;
}
Expand Down
3 changes: 1 addition & 2 deletions src/aliceVision/sfm/utils/alignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ namespace sfm {

std::istream& operator>>(std::istream& in, MarkerWithCoord& marker)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
std::vector<std::string> markerCoord;
boost::split(markerCoord, token, boost::algorithm::is_any_of(":="));
if (markerCoord.size() != 2)
Expand Down
3 changes: 1 addition & 2 deletions src/aliceVision/sfmDataIO/viewIO.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ inline std::ostream& operator<<(std::ostream& os, EViewIdMethod s) { return os <

inline std::istream& operator>>(std::istream& in, EViewIdMethod& s)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
s = EViewIdMethod_stringToEnum(token);
return in;
}
Expand Down
3 changes: 1 addition & 2 deletions src/aliceVision/system/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ std::ostream& operator<<(std::ostream& os, EVerboseLevel verboseLevel)

std::istream& operator>>(std::istream& in, EVerboseLevel& verboseLevel)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
verboseLevel = EVerboseLevel_stringToEnum(token);
return in;
}
Expand Down
3 changes: 1 addition & 2 deletions src/software/export/main_exportUSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ std::ostream& operator<<(std::ostream& os, EUSDFileType usdFileType) { return os

std::istream& operator>>(std::istream& in, EUSDFileType& usdFileType)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
usdFileType = EUSDFileType_stringToEnum(token);
return in;
}
Expand Down
3 changes: 1 addition & 2 deletions src/software/pipeline/main_cameraInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ inline std::ostream& operator<<(std::ostream& os, EGroupCameraFallback s) { retu

inline std::istream& operator>>(std::istream& in, EGroupCameraFallback& s)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
s = EGroupCameraFallback_stringToEnum(token);
return in;
}
Expand Down
3 changes: 1 addition & 2 deletions src/software/pipeline/main_imageMasking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ inline std::ostream& operator<<(std::ostream& os, EAlgorithm s) { return os << E

inline std::istream& operator>>(std::istream& in, EAlgorithm& s)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
s = EAlgorithm_stringToEnum(token);
return in;
}
Expand Down
3 changes: 1 addition & 2 deletions src/software/pipeline/main_meshFiltering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ std::ostream& operator<<(std::ostream& os, const ESubsetType subsetType)

std::istream& operator>>(std::istream& in, ESubsetType& subsetType)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
subsetType = ESubsetType_stringToEnum(token);
return in;
}
Expand Down
15 changes: 6 additions & 9 deletions src/software/pipeline/main_meshing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ EPartitioningMode EPartitioning_stringToEnum(const std::string& s)

inline std::istream& operator>>(std::istream& in, EPartitioningMode& out_mode)
{
std::string s;
in >> s;
out_mode = EPartitioning_stringToEnum(s);
std::string token(std::istreambuf_iterator<char>(in), {});
out_mode = EPartitioning_stringToEnum(token);
return in;
}

Expand All @@ -78,9 +77,8 @@ ERepartitionMode ERepartitionMode_stringToEnum(const std::string& s)

inline std::istream& operator>>(std::istream& in, ERepartitionMode& out_mode)
{
std::string s;
in >> s;
out_mode = ERepartitionMode_stringToEnum(s);
std::string token(std::istreambuf_iterator<char>(in), {});
out_mode = ERepartitionMode_stringToEnum(token);
return in;
}

Expand Down Expand Up @@ -259,11 +257,10 @@ struct BoundingBox

inline std::istream& operator>>(std::istream& in, BoundingBox& out_bbox)
{
std::string s;
in >> s;
std::string token(std::istreambuf_iterator<char>(in), {});

std::vector<std::string> dataStr;
boost::split(dataStr, s, boost::is_any_of(","));
boost::split(dataStr, token, boost::is_any_of(","));
if (dataStr.size() != 9)
{
throw std::runtime_error("Invalid number of values for bounding box.");
Expand Down
3 changes: 1 addition & 2 deletions src/software/utils/main_imageProcessing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,7 @@ inline std::ostream& operator<<(std::ostream& os, EImageFormat e) { return os <<

inline std::istream& operator>>(std::istream& in, EImageFormat& e)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
e = EImageFormat_stringToEnum(token);
return in;
}
Expand Down
9 changes: 3 additions & 6 deletions src/software/utils/main_lightingEstimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ inline std::ostream& operator<<(std::ostream& os, EAlbedoEstimation v) { return

inline std::istream& operator>>(std::istream& in, EAlbedoEstimation& v)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
v = EAlbedoEstimation_stringToEnum(token);
return in;
}
Expand Down Expand Up @@ -142,8 +141,7 @@ inline std::ostream& operator<<(std::ostream& os, ELightingEstimationMode v) { r

inline std::istream& operator>>(std::istream& in, ELightingEstimationMode& v)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
v = ELightingEstimationMode_stringToEnum(token);
return in;
}
Expand Down Expand Up @@ -182,8 +180,7 @@ inline std::ostream& operator<<(std::ostream& os, ELightingColor v) { return os

inline std::istream& operator>>(std::istream& in, ELightingColor& v)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
v = ELightingColor_stringToEnum(token);
return in;
}
Expand Down
3 changes: 1 addition & 2 deletions src/software/utils/main_mergeMeshes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ std::ostream& operator<<(std::ostream& os, const EOperationType operationType)

std::istream& operator>>(std::istream& in, EOperationType& operationType)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
operationType = EOperationType_stringToEnum(token);
return in;
}
Expand Down
3 changes: 1 addition & 2 deletions src/software/utils/main_sfmAlignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ EAlignmentMethod EAlignmentMethod_stringToEnum(const std::string& alignmentMetho

inline std::istream& operator>>(std::istream& in, EAlignmentMethod& alignment)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
alignment = EAlignmentMethod_stringToEnum(token);
return in;
}
Expand Down
3 changes: 1 addition & 2 deletions src/software/utils/main_sfmDistances.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ EObject EObject_stringToEnum(const std::string& alignmentMethod)

inline std::istream& operator>>(std::istream& in, EObject& alignment)
{
std::string token;
in >> token;
std::string token(std::istreambuf_iterator<char>(in), {});
alignment = EObject_stringToEnum(token);
return in;
}
Expand Down
Loading

0 comments on commit d84f565

Please sign in to comment.