Scid
4.7.0
|
Manages memory databases that do not have associated files. More...
#include <codec_memory.h>
Public Member Functions | |
Codec | getType () const override |
Returns the Codec type. More... | |
std::vector< std::string > | getFilenames () const override |
Returns the full path of the files used by the database. More... | |
std::vector< std::pair< const char *, std::string > > | getExtraInfo () const override |
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) override |
Fetches the data of a game (excluding index info), encoded in native format. More... | |
errorT | flush () override |
Writes all pending output to the files. More... | |
errorT | dyn_open (fileModeT fMode, const char *, const Progress &, Index *idx, NameBase *nb) override |
Opens/Creates a database. More... | |
std::pair< errorT, uint64_t > | dyn_addGameData (const byte *src, size_t length) |
Stores the data of a game into memory. 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_ |
Manages memory databases that do not have associated files.
Every open database should have a native representation in memory: to satisfy this requirement non-native codecs should be derived from this class.
Definition at line 34 of file codec_memory.h.
Stores the data of a game into memory.
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 90 of file codec_memory.h.
|
inline |
Add an IndexEntry to idx_.
ie | the IndexEntry object to add. |
Definition at line 128 of file codec_memory.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 119 of file codec_memory.h.
|
inlineoverridevirtual |
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 68 of file codec_memory.h.
|
inline |
Replace an IndexEntry.
ie | the IndexEntry with the new data. |
replaced | valid gamenumT of the game to be replaced. |
Definition at line 142 of file codec_memory.h.
|
inlineoverridevirtual |
Writes all pending output to the files.
Implements ICodecDatabase.
Reimplemented in CodecPgn.
Definition at line 66 of file codec_memory.h.
|
inlineoverridevirtual |
Returns a vector of tag pairs containing extra information about the database (type, description, autoload, etc..)
Implements ICodecDatabase.
Definition at line 53 of file codec_memory.h.
|
inlineoverridevirtual |
Returns the full path of the files used by the database.
The order of the filenames must be consistent for objects of the same Codec type.
Implements ICodecDatabase.
Reimplemented in CodecPgn.
Definition at line 48 of file codec_memory.h.
|
inlineoverridevirtual |
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 59 of file codec_memory.h.
|
inlineoverridevirtual |
Returns the Codec type.
Implements ICodecDatabase.
Reimplemented in CodecPgn.
Definition at line 46 of file codec_memory.h.