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

Method load

src/BibTeXFile.cpp:90–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90bool BibTeXFile::load(const QString & filename)
91{
92 QFile file(filename);
93 QByteArray content;
94 QTextCodec * codec = QTextCodec::codecForName("utf-8");
95 size_type curPos = 0;
96
97 _entries.clear();
98
99 if (!file.open(QFile::ReadOnly | QFile::Text))
100 return false;
101
102 content = file.readAll();
103 file.close();
104
105 // FIXME: Encoding detection
106 if (!codec)
107 return false;
108
109 do {
110 Entry e(this);
111 curPos = readEntry(e, content, curPos, codec);
112 if (curPos > 0) {
113 e.updateCache();
114 _entries.append(e);
115 }
116 // DEBUG
117 } while(curPos > 0);
118
119 return true;
120}
121
122template <class S, class C> BibTeXFile::size_type findBlock(const S & content, const BibTeXFile::size_type from, const C & startDelim, const C & endDelim, const C & escapeChar)
123{

Callers 2

foreachFunction · 0.45
reloadMethod · 0.45

Calls 3

updateCacheMethod · 0.80
clearMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected