MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / Next

Method Next

src/ifcparse/IfcParse.cpp:159–212  ·  view source on GitHub ↗

Returns the offset of the current Token and moves cursor to next

Source from the content-addressed store, hash-verified

157// Returns the offset of the current Token and moves cursor to next
158//
159Token IfcSpfLexer::Next() {
160
161 if (stream->eof()) {
162 return Token{};
163 }
164
165 while ((skipWhitespace() != 0U) || (skipComment() != 0U)) {
166 }
167
168 if (stream->eof()) {
169 return Token{};
170 }
171
172 auto& str = GetTempString();
173 auto pos = stream->tell();
174 char character = stream->read();
175
176 // If the cursor is at [()=,;$*] we know token consists of single char
177 if (character == '(' ||
178 character == ')' ||
179 character == '=' ||
180 character == ',' ||
181 character == ';' ||
182 character == '$' ||
183 character == '*')
184 {
185 return OperatorTokenPtr(this, pos, character);
186 }
187
188 if (character == '\'') {
189 // If a string is encountered defer processing to the IfcCharacterDecoder
190 str = *decoder_;
191 } else {
192 str.assign(&character, 1);
193
194 while (!stream->eof()) {
195 // Read character and increment pointer if not starting a new token
196 character = stream->peek();
197 if (character == '(' ||
198 character == ')' ||
199 character == '=' ||
200 character == ',' ||
201 character == ';' ||
202 character == '/') {
203 break;
204 }
205 if (!(character == ' ' || character == '\r' || character == '\n' || character == '\t')) {
206 str.push_back(character);
207 }
208 stream->increment();
209 }
210 }
211 return GeneralTokenPtr(this, pos, str);
212}
213
214//
215// Reads a std::string from the file at specified offset

Callers 15

SetObjectMethod · 0.45
SetObjectMethod · 0.45
occt_joinFunction · 0.45
face_infoMethod · 0.45
is_obscured_Method · 0.45
addMethod · 0.45
writeMethod · 0.45
writeMethod · 0.45
edge_from_compoundFunction · 0.45
box_from_compoundFunction · 0.45
draw_hlrMethod · 0.45
yield_subshapesFunction · 0.45

Calls 7

eofMethod · 0.80
tellMethod · 0.80
peekMethod · 0.80
push_backMethod · 0.80
incrementMethod · 0.80
readMethod · 0.45
assignMethod · 0.45

Tested by

no test coverage detected