Changeset 0f107e4 for libcfa/src/iostream.cfa
- Timestamp:
- Sep 2, 2023, 2:57:43 PM (14 months ago)
- Branches:
- master
- Children:
- 34c6e1e6
- Parents:
- 686912c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/iostream.cfa
r686912c r0f107e4 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 31 11:27:56202313 // Update Count : 15 4512 // Last Modified On : Sat Sep 2 14:42:01 2023 13 // Update Count : 1561 14 14 // 15 15 … … 922 922 ISTYPE_VOID_IMPL( long double _Complex & ) 923 923 924 // istype & ?|?( istype & is, const char fmt[] ) { 925 // fmt( is, fmt, "" ); 926 // return is; 927 // } // ?|? 928 929 // istype & ?|?( istype & is, char s[] ) { 930 // fmt( is, "%s", s ); 931 // return is; 932 // } // ?|? 933 // ISTYPE_VOID_IMPL( char * ) 924 istype & ?|?( istype & is, const char fmt[] ) { 925 fmt( is, fmt, "" ); 926 return is; 927 } // ?|? 928 ISTYPE_VOID_IMPL( const char * ) 934 929 935 930 // manipulators … … 962 957 963 958 forall( istype & | basic_istream( istype ) ) { 959 istype & ?|?( istype & is, _Istream_Cskip f ) { 960 // printf( "skip %s %d\n", f.scanset, f.wd ); 961 if ( f.scanset ) fmt( is, f.scanset, "" ); // no input arguments 962 else for ( f.wd ) fmt( is, "%*c" ); 963 return is; 964 } 965 ISTYPE_VOID_IMPL( _Istream_Cskip ) 966 964 967 istype & ?|?( istype & is, _Istream_Cstr f ) { 965 // skip966 if ( ! f.s ) {967 // printf( "skip %s %d\n", f.scanset, f.wd );968 if ( f.wd == -1 ) fmt( is, f.scanset, "" ); // no input arguments969 else for ( f.wd ) fmt( is, "%*c" );970 return is;971 } // if972 973 968 const char * scanset = f.scanset; 974 if ( f.flags.delimit ) scanset = f.delimit;// getline ?969 if ( f.flags.delimiter ) scanset = f.delimiter; // getline ? 975 970 976 971 size_t len = 0; … … 980 975 fmtstr[0] = '%'; 981 976 if ( f.flags.ignore ) { fmtstr[1] = '*'; start += 1; } 977 // no maximum width necessary because text ignored => width is read width 982 978 if ( f.wd != -1 ) { start += sprintf( &fmtstr[start], "%d", f.wd ); } 983 979 … … 1005 1001 throw (cstring_length){ &cstring_length_vt }; 1006 1002 1007 if ( f.flags.delimit ) { // getline ?1003 if ( f.flags.delimiter ) { // getline ? 1008 1004 if ( len == 0 ) f.s[0] = '\0'; // empty read => argument unchanged => set empty 1009 if ( ! eof( is ) ) fmt( is, "%*c" ); // ignore delimiter 1005 if ( ! eof( is ) ) { // ignore delimiter, may not be present because of width 1006 char delimiter; 1007 fmt( is, "%c", &delimiter ); 1008 if ( delimiter != f.delimiter[0] ) ungetc( is, delimiter ); 1009 } // if 1010 1010 } //if 1011 1011 return is;
Note: See TracChangeset
for help on using the changeset viewer.