libscid 0.1.0
Chess applications made easy.
Loading...
Searching...
No Matches
scid::database Namespace Reference

class StrRange - parse a string interpreting its content as 1 or 2 integers separated by whitespace. More...

Classes

class  Filter
 
struct  GameInfo
 
struct  GameInfoUpdate
 
class  HFilter
 
class  HFilterInverted
 class HFilterInverted - iterate through games excluded from a filter More...
 
class  Index
 
class  IndexEntry
 
class  NameBase
 This class stores the database's names (players, events, sites and rounds). More...
 
struct  patternT
 
class  Progress
 
struct  scidBaseT
 
class  StrRange
 
struct  TagRoster
 The Seven Tag Roster defined in the PGN standard is stored in the IndexEntry, but 5 are indexes that refer to a NameBase object. More...
 
struct  TreeNode
 

Typedefs

typedef unsigned short versionT
 
using EcoCode = std::uint16_t
 
using gamenumT = scid::core::uint
 
using idNumberT = std::uint32_t
 
typedef std::uint32_t matSigT
 
typedef scid::core::uint flagT
 
using nameT = unsigned
 

Enumerations

enum  fileModeT {
  FMODE_None = 0 , FMODE_ReadOnly , FMODE_WriteOnly , FMODE_Both ,
  FMODE_Create
}
 
enum  gameFlagT : std::uint32_t {
  GAME_FLAG_START = 0 , GAME_FLAG_PROMO , GAME_FLAG_UPROMO , GAME_FLAG_DELETE ,
  GAME_FLAG_WHITE_OP , GAME_FLAG_BLACK_OP , GAME_FLAG_MIDDLEGAME , GAME_FLAG_ENDGAME ,
  GAME_FLAG_NOVELTY , GAME_FLAG_PAWN , GAME_FLAG_TACTICS , GAME_FLAG_KSIDE ,
  GAME_FLAG_QSIDE , GAME_FLAG_BRILLIANCY , GAME_FLAG_BLUNDER , GAME_FLAG_USER ,
  GAME_FLAG_CUSTOM1 , GAME_FLAG_CUSTOM2 , GAME_FLAG_CUSTOM3 , GAME_FLAG_CUSTOM4 ,
  GAME_FLAG_CUSTOM5 , GAME_FLAG_CUSTOM6 , GAME_FLAG_COUNT
}
 
enum  filterOpT { FILTEROP_AND , FILTEROP_OR , FILTEROP_RESET }
 
enum  {
  NAME_PLAYER , NAME_EVENT , NAME_SITE , NAME_ROUND ,
  NUM_NAME_TYPES , NAME_INVALID = 99
}
 
enum  gameExactMatchT : int { GAME_EXACT_MATCH_Exact = 0 , GAME_EXACT_MATCH_Pawns , GAME_EXACT_MATCH_Fyles , GAME_EXACT_MATCH_Material }
 

Functions

std::uint32_t gameFlagMaskFromChar (char flag)
 
scid::core::uint gameFlagIndexFromChar (char flag)
 
std::uint32_t gameFlagMaskFromString (const char *flags)
 
scid::core::uint matsig_getCount (matSigT m, scid::core::pieceT p)
 
matSigT matsig_setCount (matSigT m, scid::core::pieceT p, scid::core::uint count)
 
std::string matsig_makeString (matSigT matsig)
 
bool matsig_isReachable (matSigT mStart, matSigT mTarget, bool promos, bool upromo)
 
bool matsig_isReachablePawns (matSigT mStart, matSigT mTarget)
 
matSigT matsig_Make (const scid::core::byte *materialCounts)
 
bool hpSig_PossibleMatch (scid::core::uint hpSig, const scid::core::byte *changeList)
 
bool hpSig_Prefix (const scid::core::byte *changeListA, const scid::core::byte *changeListB)
 
scid::core::uint hpSig_Final (const scid::core::byte *changeList)
 
scid::core::uint hpSig_AddPawn (scid::core::uint hpSig, scid::core::colorT color, scid::core::fyleT fyle)
 
scid::core::uint hpSig_ClearPawn (scid::core::uint hpSig, scid::core::colorT color, scid::core::fyleT fyle)
 
std::pair< std::uint16_t, std::uint16_t > hpSig_make (const scid::core::pieceT *board)
 Creates a 16-bits bitmap of the missing pawns in the home ranks.
 
bool hpSig_match (int hpSig, int nMoved, const scid::core::byte *changeList)
 
filterOpT strGetFilterOp (const char *str)
 
uint32_t strStartHash (const char *str)
 
char * strDuplicate (const char *str)
 
char * strAppend (char *target, const char *extra)
 
scid::core::uint strPad (char *target, const char *orig, int length, char pad)
 
const char * strFirstChar (const char *target, char matchChar)
 
const char * strLastChar (const char *target, char matchChar)
 
void strStrip (char *str, char ch)
 
const char * strTrimLeft (const char *target, const char *trimChars)
 
const char * strTrimLeft (const char *target)
 
scid::core::uint strTrimSuffix (char *target, char suffixChar)
 
void strTrimDate (char *str)
 
void strTrimMarkCodes (char *str)
 
void strTrimMarkup (char *str)
 
const char * strFirstWord (const char *str)
 
const char * strNextWord (const char *str)
 
const char * strPlural (scid::core::uint x)
 
bool strIsUnknownName (const char *str)
 
bool strIsSurnameOnly (const char *name)
 
bool strGetBoolean (const char *str)
 
int strGetInteger (const char *str)
 
uint32_t strGetUnsigned (const char *str)
 
int strCaseCompare (const char *str1, const char *str2)
 
int strCompareRound (const char *str1, const char *str2)
 
bool strEqual (const char *str1, const char *str2)
 
void strGetIntegers (const char *str, int *results, scid::core::uint nResults)
 
void strGetUnsigneds (const char *str, scid::core::uint *results, scid::core::uint nResults)
 
scid::core::resultT strGetResult (const char *str)
 
bool flag_Yes (flagT t)
 
bool flag_No (flagT t)
 
flagT strGetFlag (const char *str)
 
scid::core::squareT strGetSquare (const char *str)
 
scid::core::uint strTrimFileSuffix (char *target)
 
const char * strFileSuffix (const char *target)
 
int strUniqueExactMatch (const char *keyStr, const char **strTable, bool exact)
 
int strUniqueMatch (const char *keyStr, const char **strTable)
 
int strExactMatch (const char *keyStr, const char **strTable)
 
bool strContainsChar (const char *str, char ch)
 
int strCompare (const char *s1, const char *s2)
 
void strCopy (char *target, const char *original)
 
scid::core::uint strPrefix (const char *s1, const char *s2)
 
bool strIsPrefix (const char *prefix, const char *longStr)
 
bool strIsCasePrefix (const char *prefix, const char *longStr)
 
bool strIsAlphaPrefix (const char *prefix, const char *longStr)
 
bool strContains (const char *longStr, const char *keyStr)
 
bool strAlphaContains (const char *longStr, const char *keyStr)
 
scid::core::uint strLength (const char *str)
 
void strTrimRight (char *target, const char *trimChars, size_t nTrimCh)
 
void strTrimRight (char *target)
 

Variables

const versionT SCID_VERSION = 400
 
constexpr EcoCode ECO_CODE_NONE = 0
 
constexpr gamenumT INVALID_GAMEID = 0xffffffff
 
constexpr std::uint32_t GAME_FLAG_MASK_ALL = 0xffffffff
 
const scid::core::uint HPSIG_SIZE = 9
 
const scid::core::ratingT MAX_ELO = 4000
 
const scid::core::byte CUSTOM_FLAG_MASK [] = { 1, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5 }
 
const matSigT MASK_BY_PIECE [16]
 
const scid::core::uint SHIFT_BY_PIECE [16]
 
const matSigT MATSIG_Empty = 0
 
const matSigT MATSIG_StdStart
 
const scid::core::uint HPSIG_Empty = 0x0
 
const scid::core::uint HPSIG_StdStart = 0xFFFF
 
const flagT FLAG_EMPTY = 0
 
const flagT FLAG_YES = 1
 
const flagT FLAG_NO = 2
 
const flagT FLAG_BOTH = 3
 

Detailed Description

class StrRange - parse a string interpreting its content as 1 or 2 integers separated by whitespace.

The integers represent the min and max value of a range. If only one integer is provided it will represent both the min and max value.

Function Documentation

◆ hpSig_make()

std::pair< std::uint16_t, std::uint16_t > scid::database::hpSig_make ( const scid::core::pieceT *  board)
inline

Creates a 16-bits bitmap of the missing pawns in the home ranks.

Used to speed up the searches of positions with the same pawn structure.

Returns
a std::pair containing the bitmap and the number of moved pawns.

Variable Documentation

◆ MASK_BY_PIECE

const matSigT scid::database::MASK_BY_PIECE[16]
Initial value:
= {
0,
0,
MASK_WQ,
MASK_WR,
MASK_WB,
MASK_WN,
MASK_WP,
0, 0,
0,
MASK_BQ,
MASK_BR,
MASK_BB,
MASK_BN,
MASK_BP,
0
}

◆ MATSIG_StdStart

const matSigT scid::database::MATSIG_StdStart
Initial value:
=
((1 << SHIFT_WQ) | (1 << SHIFT_BQ) | (2 << SHIFT_WR) | (2 << SHIFT_BR) |
(2 << SHIFT_WB) | (2 << SHIFT_BB) | (2 << SHIFT_WN) | (2 << SHIFT_BN) |
(8 << SHIFT_WP) | (8 << SHIFT_BP))

◆ SHIFT_BY_PIECE

const scid::core::uint scid::database::SHIFT_BY_PIECE[16]
Initial value:
= {
0, 0,
SHIFT_WQ,
SHIFT_WR,
SHIFT_WB,
SHIFT_WN,
SHIFT_WP,
0, 0, 0,
SHIFT_BQ,
SHIFT_BR,
SHIFT_BB,
SHIFT_BN,
SHIFT_BP,
0
}