MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / skipLine

Method skipLine

OgreMain/src/OgreDataStream.cpp:148–177  ·  view source on GitHub ↗

-----------------------------------------------------------------------

Source from the content-addressed store, hash-verified

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 {

Callers 1

parseScriptMethod · 0.80

Calls 4

skipFunction · 0.85
readFunction · 0.70
c_strMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected