File tree Expand file tree Collapse file tree 9 files changed +7
-28
lines changed Expand file tree Collapse file tree 9 files changed +7
-28
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ class Character : public BaseFixedWidthField< Width > {
48
48
value.reserve ( Width );
49
49
50
50
unsigned int position = 0 ;
51
- while ( position < Width && ! ( isNewLine ( iter ) || isEndOfFile ( iter ) ) ) {
51
+ while ( position < Width && ! isNewLine ( iter ) ) {
52
52
53
53
++position;
54
54
value.push_back ( *iter++ );
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ class Column : public BaseFixedWidthField< Width > {
40
40
static void read ( Iterator& iter, const Iterator& end ) {
41
41
42
42
unsigned int position = 0 ;
43
- while ( position < Width && ! ( isNewLine ( iter ) || isEndOfFile ( iter ) || iter >= end ) ) {
43
+ while ( position < Width && ! ( isNewLine ( iter ) || iter >= end ) ) {
44
44
45
45
++position;
46
46
++iter;
Original file line number Diff line number Diff line change @@ -35,10 +35,6 @@ class FreeFormatCharacter : public BaseField {
35
35
iter = std::find_if ( iter, end,
36
36
[] ( auto && value )
37
37
{ return ! std::isspace ( value ); } );
38
- if ( isEndOfFile ( iter ) ) {
39
-
40
- throw std::runtime_error ( " Cannot read valid string: end of file encountered" );
41
- }
42
38
43
39
auto temp = std::find_if ( iter, end,
44
40
[] ( auto && value )
Original file line number Diff line number Diff line change @@ -41,10 +41,6 @@ class FreeFormatInteger : public BaseField {
41
41
iter = std::find_if ( iter, end,
42
42
[] ( auto && value )
43
43
{ return ! std::isspace ( value ); } );
44
- if ( isEndOfFile ( iter ) ) {
45
-
46
- throw std::runtime_error ( " Cannot read valid integer: end of file encountered" );
47
- }
48
44
49
45
// we are using fast_float::from_chars instead of std::from_chars since
50
46
// not all standard c++ libraries implement the floating point version of
Original file line number Diff line number Diff line change @@ -41,10 +41,6 @@ class FreeFormatReal : public BaseField {
41
41
iter = std::find_if ( iter, end,
42
42
[] ( auto && value )
43
43
{ return ! std::isspace ( value ); } );
44
- if ( isEndOfFile ( iter ) ) {
45
-
46
- throw std::runtime_error ( " Cannot read valid real value: end of file encountered" );
47
- }
48
44
49
45
// we are using fast_float::from_chars_advanced instead of std::from_chars
50
46
// since not all standard c++ libraries implement the floating point version
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ class Integer : public BaseFixedWidthField< Width > {
48
48
Representation value = 0 ;
49
49
50
50
skipSpaces ( iter, position );
51
- if ( isNewLine ( iter ) || isEndOfFile ( iter ) || Width == position || iter >= end ) {
51
+ if ( isNewLine ( iter ) || Width == position || iter >= end ) {
52
52
53
53
return value;
54
54
}
@@ -77,7 +77,7 @@ class Integer : public BaseFixedWidthField< Width > {
77
77
skipSpaces ( iter, position );
78
78
if ( Width != position ) {
79
79
80
- if ( ! isNewLine ( iter ) && ! isEndOfFile ( iter ) ) {
80
+ if ( ! isNewLine ( iter ) ) {
81
81
82
82
throw std::runtime_error ( " cannot parse invalid integer number 3" );
83
83
}
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ class Real : public BaseFixedWidthField< Width > {
40
40
Representation value = 0.0 ;
41
41
42
42
skipSpaces ( iter, position );
43
- if ( isNewLine ( iter ) || isEndOfFile ( iter ) || Width == position || iter >= end ) {
43
+ if ( isNewLine ( iter ) || Width == position || iter >= end ) {
44
44
45
45
return value;
46
46
}
@@ -71,7 +71,7 @@ class Real : public BaseFixedWidthField< Width > {
71
71
skipSpaces ( iter, position );
72
72
if ( Width != position ) {
73
73
74
- if ( ! isNewLine ( iter ) && ! isEndOfFile ( iter ) ) {
74
+ if ( ! isNewLine ( iter ) ) {
75
75
76
76
throw std::runtime_error ( " cannot parse invalid real number 3" );
77
77
}
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ struct Record<> {
22
22
template < typename Iterator >
23
23
static void read ( Iterator& iter, const Iterator& end ) {
24
24
25
- while ( iter != end && ! ( isNewLine ( iter )|| isEndOfFile ( iter ) ) ) {
25
+ while ( iter != end && ! ( isNewLine ( iter ) ) ) {
26
26
27
27
++iter;
28
28
}
Original file line number Diff line number Diff line change @@ -69,15 +69,6 @@ bool isWhiteSpace( const Iterator& iter ) {
69
69
return std::isspace ( *iter );
70
70
}
71
71
72
- /* *
73
- * @brief Return whether or not a character is the end of file character
74
- */
75
- template < typename Iterator >
76
- constexpr bool isEndOfFile ( const Iterator& iter ) {
77
-
78
- return std::char_traits< char >::eof () == *iter;
79
- }
80
-
81
72
} // disco namespace
82
73
} // tools namespace
83
74
} // njoy namespace
You can’t perform that action at this time.
0 commit comments