MCPcopy Create free account
hub / github.com/TeXworks/texworks / readEntry

Method readEntry

src/BibTeXFile.cpp:155–188  ·  view source on GitHub ↗

static

Source from the content-addressed store, hash-verified

153
154// static
155BibTeXFile::size_type BibTeXFile::readEntry(Entry & e, const QByteArray & content, const size_type startPos, const QTextCodec * codec)
156{
157 size_type curPos = content.indexOf('@', startPos);
158 if (curPos < 0)
159 return -1;
160 ++curPos;
161 size_type start = content.indexOf('{', curPos);
162 if (start < 0)
163 return -1;
164 e._type = codec->toUnicode(content.mid(curPos, start - curPos));
165
166 size_type end = findBlock(content, start);
167 if (end < 0) return -1;
168 ++start;
169 QByteArray block = content.mid(start, end - start);
170
171 switch (e.type()) {
172 case Entry::COMMENT:
173 e._key = codec->toUnicode(block);
174 break;
175 case Entry::PREAMBLE:
176 e._key = codec->toUnicode(block);
177 break;
178 case Entry::STRING:
179 // FIXME
180 parseFields(e, codec->toUnicode(block));
181 break;
182 case Entry::NORMAL:
183 parseEntry(e, codec->toUnicode(block));
184 break;
185 }
186
187 return end + 1;
188}
189
190//static
191void BibTeXFile::parseEntry(Entry & e, const QString & block)

Callers

nothing calls this directly

Calls 2

findBlockFunction · 0.85
typeMethod · 0.45

Tested by

no test coverage detected