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

Method TokenString

src/ifcparse/IfcParse.cpp:218–247  ·  view source on GitHub ↗

Reads a std::string from the file at specified offset Omits whitespace and comments

Source from the content-addressed store, hash-verified

216// Omits whitespace and comments
217//
218void IfcSpfLexer::TokenString(size_t offset, std::string& buffer) {
219 buffer.clear();
220 auto local_stream = *this->stream;
221 local_stream.seek(offset);
222 while (!local_stream.eof()) {
223 char character = local_stream.peek();
224 if (!buffer.empty() && (character == '(' ||
225 character == ')' ||
226 character == '=' ||
227 character == ',' ||
228 character == ';' ||
229 character == '/')) {
230 break;
231 }
232 local_stream.increment();
233 if (character == ' ' ||
234 character == '\r' ||
235 character == '\n' ||
236 character == '\t') {
237 continue;
238 }
239 if (character == '\'') {
240 // todo, make decoder use local offset ptr
241 auto offset = local_stream.tell();
242 buffer = decoder_->get(offset);
243 break;
244 }
245 buffer.push_back(character);
246 }
247}
248
249//Note: according to STEP standard, there may be newlines in tokens
250/*

Callers 2

IfcParse.cppFile · 0.80
toStringMethod · 0.80

Calls 9

seekMethod · 0.80
eofMethod · 0.80
peekMethod · 0.80
incrementMethod · 0.80
tellMethod · 0.80
push_backMethod · 0.80
clearMethod · 0.45
emptyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected