97 return &(entries_[g]);
145 return (Header.autoLoad <= Header.numGames) ? Header.autoLoad : Header.numGames;
153 Header.baseType = src.Header.
baseType;
154 Header.autoLoad = src.Header.
autoLoad;
155 std::memcpy(Header.description, src.Header.
description,
sizeof Header.description);
156 std::memcpy(Header.customFlagDesc, src.Header.
customFlagDesc,
sizeof Header.customFlagDesc);
157 Header.dirty_ =
true;
163 Header.dirty_ =
true;
170 Header.dirty_ =
true;
179 Header.dirty_ =
true;
184 Header.autoLoad = gnum;
185 Header.dirty_ =
true;
206 return &(entries_[g]);
218 if (FilePtr == 0)
return OK;
219 errorT errHeader = (Header.dirty_) ? WriteHeader() :
OK;
221 return (errHeader ==
OK) ? errSync : errHeader;
231 #endif // #ifdef SCID_INDEX_H
const char * GetCustomFlagDesc(byte c) const
errorT SetAutoLoad(gamenumT gnum)
const uint INDEX_HEADER_SIZE
const uint CUSTOM_FLAG_DESC_LENGTH
idNumberT GetSite() const
const errorT ERROR_FileWrite
std::array< std::vector< int >, NUM_NAME_TYPES > calcNameFreq(const NameBase &nb) const
Counts how many times every names contained in nb is used.
const char OLD_INDEX_SUFFIX[]
const errorT ERROR_BadArg
const uint SCID_DESC_LENGTH
idNumberT GetEvent() const
const IndexEntry * GetEntry(gamenumT g) const
gamenumT GetNumGames() const
Header getter functions.
gamenumT GetAutoLoad() const
This class manages databases encoded in SCID format v4.
This class stores the database's names (players, events, sites and rounds).
Index & operator=(const Index &)
errorT SetDescription(const char *str)
errorT flush()
flush() - writes all cached data to the file
idNumberT GetRound() const
idNumberT GetWhite() const
IndexEntry * FetchEntry(gamenumT g)
FetchEntry() - return a modifiable pointer to a game's IndexEntry.
int GetBadNameIdCount() const
GetBadNameIdCount() - return the number of invalid name handles.
idNumberT GetBlack() const
errorT copyHeaderInfo(const Index &src)
Header setter functions.
errorT Open(const char *filename, fileModeT fmode)
const char INDEX_SUFFIX[]
errorT Create(const char *filename)
errorT WriteEntry(const IndexEntry *ie, gamenumT idx)
WriteEntry() - modify a game in the Index.
char description[SCID_DESC_LENGTH+1]
Adds some helper functions to std::filebuf:
versionT GetVersion() const
const char * GetDescription() const
char customFlagDesc[CUSTOM_FLAG_MAX][CUSTOM_FLAG_DESC_LENGTH+1]
idNumberT GetNumNames(nameT nt) const
const uint OLD_INDEX_HEADER_SIZE
Extends the std:filebuf class with performance improvements.
const errorT ERROR_FileMode
errorT SetCustomFlagDesc(byte c, const char *str)
const uint CUSTOM_FLAG_MAX