-----------------------------------------------------------------------
| 146 | } |
| 147 | //----------------------------------------------------------------------- |
| 148 | size_t DataStream::skipLine( const String &delim ) |
| 149 | { |
| 150 | char tmpBuf[OGRE_STREAM_TEMP_SIZE]; |
| 151 | size_t total = 0; |
| 152 | size_t readCount; |
| 153 | // Keep looping while not hitting delimiter |
| 154 | while( ( readCount = read( tmpBuf, OGRE_STREAM_TEMP_SIZE - 1 ) ) != 0 ) |
| 155 | { |
| 156 | // Terminate string |
| 157 | tmpBuf[readCount] = '\0'; |
| 158 | |
| 159 | // Find first delimiter |
| 160 | size_t pos = strcspn( tmpBuf, delim.c_str() ); |
| 161 | |
| 162 | if( pos < readCount ) |
| 163 | { |
| 164 | // Found terminator, reposition backwards |
| 165 | skip( (long)( pos + 1 - readCount ) ); |
| 166 | |
| 167 | total += pos + 1; |
| 168 | |
| 169 | // break out |
| 170 | break; |
| 171 | } |
| 172 | |
| 173 | total += readCount; |
| 174 | } |
| 175 | |
| 176 | return total; |
| 177 | } |
| 178 | //----------------------------------------------------------------------- |
| 179 | String DataStream::getAsString() |
| 180 | { |
no test coverage detected