MCPcopy Create free account
hub / github.com/cutechess/cutechess / read

Method read

projects/lib/src/openingbook.cpp:59–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59bool OpeningBook::read(const QString& filename)
60{
61 m_filename = filename;
62 QFile file(filename);
63 if (!file.open(QIODevice::ReadOnly))
64 return false;
65
66 if ((file.size() % entrySize()) != 0)
67 {
68 qWarning("Invalid size for opening book %s",
69 qUtf8Printable(filename));
70 return false;
71 }
72
73 if (m_mode == Disk)
74 return true;
75
76 m_map.clear();
77 QDataStream in(&file);
78 in >> this;
79
80 return !m_map.isEmpty();
81}
82
83bool OpeningBook::write(const QString& filename) const
84{

Callers 1

importMethod · 0.45

Calls 3

sizeMethod · 0.45
clearMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected