Scid
4.7.0
|
This class manages databases encoded in SCID format v4. More...
#include <codec_scid4.h>
Public Member Functions | |
Codec | getType () const final |
Returns the Codec type. More... | |
std::vector< std::string > | getFilenames () const final |
Returns the full path of the three files (index, namebase and gamefile) used by the database. More... | |
std::vector< std::pair< const char *, std::string > > | getExtraInfo () const final |
Returns a vector of tag pairs containing extra information about the database (type, description, autoload, etc..) More... | |
const byte * | getGameData (uint64_t offset, uint32_t length) final |
Fetches the data of a game (excluding index info), encoded in native format. More... | |
errorT | flush () final |
Writes all pending output to the files. More... | |
errorT | dyn_open (fileModeT, const char *, const Progress &, Index *, NameBase *) final |
Opens/Creates a database. More... | |
std::pair< errorT, uint64_t > | dyn_addGameData (const byte *src, size_t length) |
Stores the data into the .sg4 file. More... | |
std::pair< errorT, idNumberT > | dyn_addName (nameT nt, const char *name) |
Given a name (string), retrieve the corresponding ID. More... | |
errorT | dyn_addIndexEntry (const IndexEntry &ie) |
Add an IndexEntry to idx_. More... | |
errorT | dyn_saveIndexEntry (const IndexEntry &ie, gamenumT replaced) |
Replace an IndexEntry. More... | |
![]() | |
errorT | addGame (const IndexEntry *srcIe, const NameBase *srcNb, const byte *srcData, size_t dataLen) override |
Add a game to the database. More... | |
errorT | addGame (Game *game) override |
Add a game to the database. More... | |
errorT | saveGame (Game *game, gamenumT replaced) override |
Replaces a game in the database. More... | |
errorT | saveIndexEntry (const IndexEntry &ie, gamenumT replaced) override |
Replaces a game's IndexEntry (which contains the header data of a game). More... | |
std::pair< errorT, idNumberT > | addName (nameT nt, const char *name) override |
Adds a name (player, event, site or round) to the database. More... | |
![]() | |
virtual | ~ICodecDatabase () |
Additional Inherited Members | |
![]() | |
enum | Codec { MEMORY, SCID4, PGN } |
![]() | |
static std::pair< ICodecDatabase *, errorT > | open (Codec codec, fileModeT fMode, const char *filename, const Progress &progress, Index *idx, NameBase *nb) |
Creates a new object and calls the virtual function dyn_open(). More... | |
![]() | |
CodecNative () | |
![]() | |
Index * | idx_ |
NameBase * | nb_ |
ByteBuffer | bbuf_ |
This class manages databases encoded in SCID format v4.
Definition at line 35 of file codec_scid4.h.
Stores the data into the .sg4 file.
src | valid pointer to a buffer that contains the game data (encoded in native format). |
length | the length of the buffer src (in bytes). |
Definition at line 108 of file codec_scid4.h.
|
inline |
Add an IndexEntry to idx_.
ie | the IndexEntry object to add. |
Definition at line 160 of file codec_scid4.h.
Given a name (string), retrieve the corresponding ID.
The name is added to nb_ if do not already exists in the NameBase.
nt | nameT type of the name to retrieve. |
name | the name to retrieve. |
Definition at line 145 of file codec_scid4.h.
|
finalvirtual |
Opens/Creates a database.
This virtual function is called only once immediately after the class constructor.
fMode | a valid file mode. |
filename | the full path of the database to open. |
progress | a Progress object used for GUI communications. |
idx | valid pointer to the Index object for this database. |
nb | valid pointer to the NameBase object for this database. |
Implements ICodecDatabase.
Definition at line 361 of file codec_scid4.cpp.
|
inline |
Replace an IndexEntry.
ie | the IndexEntry with the new data. |
replaced | valid gamenumT of the game to be replaced. |
Definition at line 174 of file codec_scid4.h.
|
finalvirtual |
Writes all pending output to the files.
Implements ICodecDatabase.
Definition at line 397 of file codec_scid4.cpp.
|
inlinefinalvirtual |
Returns a vector of tag pairs containing extra information about the database (type, description, autoload, etc..)
Implements ICodecDatabase.
Definition at line 58 of file codec_scid4.h.
|
inlinefinalvirtual |
Returns the full path of the three files (index, namebase and gamefile) used by the database.
Implements ICodecDatabase.
Definition at line 55 of file codec_scid4.h.
|
inlinefinalvirtual |
Fetches the data of a game (excluding index info), encoded in native format.
offset | offset of the requested game. |
length | length of the game data (in bytes). |
Implements ICodecDatabase.
Definition at line 78 of file codec_scid4.h.
|
inlinefinalvirtual |