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 > {
4848 value.reserve ( Width );
4949
5050 unsigned int position = 0 ;
51- while ( position < Width && ! ( isNewLine ( iter ) || isEndOfFile ( iter ) ) ) {
51+ while ( position < Width && ! isNewLine ( iter ) ) {
5252
5353 ++position;
5454 value.push_back ( *iter++ );
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ class Column : public BaseFixedWidthField< Width > {
4040 static void read ( Iterator& iter, const Iterator& end ) {
4141
4242 unsigned int position = 0 ;
43- while ( position < Width && ! ( isNewLine ( iter ) || isEndOfFile ( iter ) || iter >= end ) ) {
43+ while ( position < Width && ! ( isNewLine ( iter ) || iter >= end ) ) {
4444
4545 ++position;
4646 ++iter;
Original file line number Diff line number Diff line change @@ -35,10 +35,6 @@ class FreeFormatCharacter : public BaseField {
3535 iter = std::find_if ( iter, end,
3636 [] ( auto && value )
3737 { return ! std::isspace ( value ); } );
38- if ( isEndOfFile ( iter ) ) {
39-
40- throw std::runtime_error ( " Cannot read valid string: end of file encountered" );
41- }
4238
4339 auto temp = std::find_if ( iter, end,
4440 [] ( auto && value )
Original file line number Diff line number Diff line change @@ -41,10 +41,6 @@ class FreeFormatInteger : public BaseField {
4141 iter = std::find_if ( iter, end,
4242 [] ( auto && value )
4343 { return ! std::isspace ( value ); } );
44- if ( isEndOfFile ( iter ) ) {
45-
46- throw std::runtime_error ( " Cannot read valid integer: end of file encountered" );
47- }
4844
4945 // we are using fast_float::from_chars instead of std::from_chars since
5046 // 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 {
4141 iter = std::find_if ( iter, end,
4242 [] ( auto && value )
4343 { return ! std::isspace ( value ); } );
44- if ( isEndOfFile ( iter ) ) {
45-
46- throw std::runtime_error ( " Cannot read valid real value: end of file encountered" );
47- }
4844
4945 // we are using fast_float::from_chars_advanced instead of std::from_chars
5046 // 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 > {
4848 Representation value = 0 ;
4949
5050 skipSpaces ( iter, position );
51- if ( isNewLine ( iter ) || isEndOfFile ( iter ) || Width == position || iter >= end ) {
51+ if ( isNewLine ( iter ) || Width == position || iter >= end ) {
5252
5353 return value;
5454 }
@@ -77,7 +77,7 @@ class Integer : public BaseFixedWidthField< Width > {
7777 skipSpaces ( iter, position );
7878 if ( Width != position ) {
7979
80- if ( ! isNewLine ( iter ) && ! isEndOfFile ( iter ) ) {
80+ if ( ! isNewLine ( iter ) ) {
8181
8282 throw std::runtime_error ( " cannot parse invalid integer number 3" );
8383 }
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ class Real : public BaseFixedWidthField< Width > {
4040 Representation value = 0.0 ;
4141
4242 skipSpaces ( iter, position );
43- if ( isNewLine ( iter ) || isEndOfFile ( iter ) || Width == position || iter >= end ) {
43+ if ( isNewLine ( iter ) || Width == position || iter >= end ) {
4444
4545 return value;
4646 }
@@ -71,7 +71,7 @@ class Real : public BaseFixedWidthField< Width > {
7171 skipSpaces ( iter, position );
7272 if ( Width != position ) {
7373
74- if ( ! isNewLine ( iter ) && ! isEndOfFile ( iter ) ) {
74+ if ( ! isNewLine ( iter ) ) {
7575
7676 throw std::runtime_error ( " cannot parse invalid real number 3" );
7777 }
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ struct Record<> {
2222 template < typename Iterator >
2323 static void read ( Iterator& iter, const Iterator& end ) {
2424
25- while ( iter != end && ! ( isNewLine ( iter )|| isEndOfFile ( iter ) ) ) {
25+ while ( iter != end && ! ( isNewLine ( iter ) ) ) {
2626
2727 ++iter;
2828 }
Original file line number Diff line number Diff line change @@ -69,15 +69,6 @@ bool isWhiteSpace( const Iterator& iter ) {
6969 return std::isspace ( *iter );
7070}
7171
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-
8172} // disco namespace
8273} // tools namespace
8374} // njoy namespace
You can’t perform that action at this time.
0 commit comments