Scid  4.6.5
Classes | Typedefs | Enumerations | Functions | Variables
misc.h File Reference
#include "common.h"
#include <string>
#include <cstring>
#include <stdio.h>
#include <ctype.h>
#include <cstdlib>
#include <vector>
#include <sstream>
Include dependency graph for misc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  StrRange
 class StrRange - parse a string interpreting its content as 1 or 2 integers separated by whitespace. More...
 
class  VectorBig< T, CHUNKSHIFT >
 class VectorBig - store data into chunks to avoid (or minimize) reallocations : is the base-2 logarithm of the number of T entries per chunk. More...
 
class  Progress
 
struct  Progress::Impl
 

Typedefs

typedef uint flagT
 

Enumerations

enum  filterOpT { FILTEROP_AND, FILTEROP_OR, FILTEROP_RESET }
 

Functions

std::string to_string (int val)
 
filterOpT strGetFilterOp (const char *str)
 
void eco_ToString (ecoT ecoCode, char *ecoStr, bool extensions=true)
 
void eco_ToBasicString (ecoT ecoCode, char *ecoStr)
 
void eco_ToExtendedString (ecoT ecoCode, char *ecoStr)
 
ecoT eco_FromString (const char *ecoStr)
 
ecoT eco_LastSubCode (ecoT ecoCode)
 
ecoT eco_BasicCode (ecoT ecoCode)
 
ecoT eco_Reduce (ecoT eco)
 ecoReduce() - maps eco to a smaller set : the eco value to convert (must be != 0) More...
 
uint32_t strStartHash (const char *str)
 
char * strDuplicate (const char *str)
 
void strCopyExclude (char *target, const char *original, const char *excludeChars)
 
char * strAppend (char *target, const char *extra)
 
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)
 
uint strTrimRight (char *target, const char *trimChars)
 
uint strTrimRight (char *target)
 
uint strTrimSuffix (char *target, char suffixChar)
 
void strTrimDate (char *str)
 
void strTrimMarkCodes (char *str)
 
void strTrimMarkup (char *str)
 
void strTrimSurname (char *str, uint initials)
 
void strTrimSurname (char *str)
 
const char * strFirstWord (const char *str)
 
const char * strNextWord (const char *str)
 
const char * strPlural (uint x)
 
bool strIsAllWhitespace (const char *str)
 
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, uint nResults)
 
void strGetUnsigneds (const char *str, uint *results, uint nResults)
 
resultT strGetResult (const char *str)
 
bool flag_Yes (flagT t)
 
bool flag_No (flagT t)
 
flagT strGetFlag (const char *str)
 
squareT strGetSquare (const char *str)
 
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)
 
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)
 
uint strLength (const char *str)
 
uint fileSize (const char *name, const char *suffix)
 
uint rawFileSize (const char *name)
 
uint gzipFileSize (const char *name)
 

Variables

const flagT FLAG_EMPTY = 0
 
const flagT FLAG_YES = 1
 
const flagT FLAG_NO = 2
 
const flagT FLAG_BOTH = 3
 

Typedef Documentation

typedef uint flagT

Definition at line 314 of file misc.h.

Enumeration Type Documentation

enum filterOpT
Enumerator
FILTEROP_AND 
FILTEROP_OR 
FILTEROP_RESET 

Definition at line 164 of file misc.h.

Function Documentation

ecoT eco_BasicCode ( ecoT  ecoCode)

Definition at line 143 of file misc.cpp.

ecoT eco_FromString ( const char *  ecoStr)

Definition at line 69 of file misc.cpp.

ecoT eco_LastSubCode ( ecoT  ecoCode)

Definition at line 176 of file misc.cpp.

ecoT eco_Reduce ( ecoT  eco)

ecoReduce() - maps eco to a smaller set : the eco value to convert (must be != 0)

Scid ECO subcodes use 131 values for each canonical ECO. For example A00 is divided in A00,A00a,A00a1,A00a2,A00a3,A00a4,A00b...A00z4 corresponding to eco values 1,2,3,4,5,6,7...131 (value 0 means no ECO). This functions will map subECOs like A00a1...A00a4 into A00a, reducing the 131 values to 27. The previous sequence will became 0,1,1,1,1,1,2...26

Definition at line 163 of file misc.cpp.

void eco_ToBasicString ( ecoT  ecoCode,
char *  ecoStr 
)
inline

Definition at line 183 of file misc.h.

void eco_ToExtendedString ( ecoT  ecoCode,
char *  ecoStr 
)
inline

Definition at line 186 of file misc.h.

void eco_ToString ( ecoT  ecoCode,
char *  ecoStr,
bool  extensions = true 
)

Definition at line 111 of file misc.cpp.

uint fileSize ( const char *  name,
const char *  suffix 
)

Definition at line 764 of file misc.cpp.

bool flag_No ( flagT  t)
inline

Definition at line 320 of file misc.h.

bool flag_Yes ( flagT  t)
inline

Definition at line 319 of file misc.h.

uint gzipFileSize ( const char *  name)

Definition at line 796 of file misc.cpp.

uint rawFileSize ( const char *  name)

Definition at line 781 of file misc.cpp.

bool strAlphaContains ( const char *  longStr,
const char *  keyStr 
)
inline

Definition at line 482 of file misc.h.

char* strAppend ( char *  target,
const char *  extra 
)

Definition at line 222 of file misc.cpp.

int strCaseCompare ( const char *  str1,
const char *  str2 
)
inline

Definition at line 281 of file misc.h.

int strCompare ( const char *  s1,
const char *  s2 
)
inline

Definition at line 361 of file misc.h.

int strCompareRound ( const char *  str1,
const char *  str2 
)
inline

Definition at line 296 of file misc.h.

bool strContains ( const char *  longStr,
const char *  keyStr 
)
inline

Definition at line 466 of file misc.h.

bool strContainsChar ( const char *  str,
char  ch 
)
inline

Definition at line 344 of file misc.h.

void strCopy ( char *  target,
const char *  original 
)
inline

Definition at line 379 of file misc.h.

void strCopyExclude ( char *  target,
const char *  original,
const char *  excludeChars 
)

Definition at line 196 of file misc.cpp.

char* strDuplicate ( const char *  str)

Definition at line 239 of file misc.cpp.

bool strEqual ( const char *  str1,
const char *  str2 
)
inline

Definition at line 305 of file misc.h.

int strExactMatch ( const char *  keyStr,
const char **  strTable 
)
inline

Definition at line 339 of file misc.h.

const char* strFileSuffix ( const char *  target)
inline

Definition at line 329 of file misc.h.

const char* strFirstChar ( const char *  target,
char  matchChar 
)

Definition at line 297 of file misc.cpp.

const char* strFirstWord ( const char *  str)

Definition at line 503 of file misc.cpp.

bool strGetBoolean ( const char *  str)

Definition at line 579 of file misc.cpp.

filterOpT strGetFilterOp ( const char *  str)
inline

Definition at line 166 of file misc.h.

flagT strGetFlag ( const char *  str)

Definition at line 666 of file misc.cpp.

int strGetInteger ( const char *  str)
inline

Definition at line 266 of file misc.h.

void strGetIntegers ( const char *  str,
int *  results,
uint  nResults 
)

Definition at line 618 of file misc.cpp.

resultT strGetResult ( const char *  str)

Definition at line 645 of file misc.cpp.

squareT strGetSquare ( const char *  str)

Definition at line 693 of file misc.cpp.

uint32_t strGetUnsigned ( const char *  str)
inline

Definition at line 276 of file misc.h.

void strGetUnsigneds ( const char *  str,
uint results,
uint  nResults 
)

Definition at line 632 of file misc.cpp.

bool strIsAllWhitespace ( const char *  str)

Definition at line 528 of file misc.cpp.

bool strIsAlphaPrefix ( const char *  prefix,
const char *  longStr 
)
inline

Definition at line 447 of file misc.h.

bool strIsCasePrefix ( const char *  prefix,
const char *  longStr 
)
inline

Definition at line 428 of file misc.h.

bool strIsPrefix ( const char *  prefix,
const char *  longStr 
)
inline

Definition at line 412 of file misc.h.

bool strIsSurnameOnly ( const char *  name)

Definition at line 556 of file misc.cpp.

bool strIsUnknownName ( const char *  str)

Definition at line 544 of file misc.cpp.

const char* strLastChar ( const char *  target,
char  matchChar 
)

Definition at line 314 of file misc.cpp.

uint strLength ( const char *  str)
inline

Definition at line 492 of file misc.h.

const char* strNextWord ( const char *  str)

Definition at line 516 of file misc.cpp.

uint strPad ( char *  target,
const char *  orig,
int  length,
char  pad 
)

Definition at line 268 of file misc.cpp.

const char* strPlural ( uint  x)
inline

Definition at line 248 of file misc.h.

uint strPrefix ( const char *  s1,
const char *  s2 
)
inline

Definition at line 395 of file misc.h.

uint32_t strStartHash ( const char *  str)
inline

Definition at line 200 of file misc.h.

void strStrip ( char *  str,
char  ch 
)

Definition at line 329 of file misc.cpp.

void strTrimDate ( char *  str)

Definition at line 389 of file misc.cpp.

uint strTrimFileSuffix ( char *  target)
inline

Definition at line 326 of file misc.h.

const char* strTrimLeft ( const char *  target,
const char *  trimChars 
)

Definition at line 347 of file misc.cpp.

const char* strTrimLeft ( const char *  target)
inline

Definition at line 229 of file misc.h.

void strTrimMarkCodes ( char *  str)

Definition at line 404 of file misc.cpp.

void strTrimMarkup ( char *  str)

Definition at line 448 of file misc.cpp.

uint strTrimRight ( char *  target,
const char *  trimChars 
)
inline

Definition at line 508 of file misc.h.

uint strTrimRight ( char *  target)
inline

Definition at line 233 of file misc.h.

uint strTrimSuffix ( char *  target,
char  suffixChar 
)

Definition at line 365 of file misc.cpp.

void strTrimSurname ( char *  str,
uint  initials 
)

Definition at line 472 of file misc.cpp.

void strTrimSurname ( char *  str)
inline

Definition at line 241 of file misc.h.

int strUniqueExactMatch ( const char *  keyStr,
const char **  strTable,
bool  exact 
)

Definition at line 718 of file misc.cpp.

int strUniqueMatch ( const char *  keyStr,
const char **  strTable 
)
inline

Definition at line 336 of file misc.h.

std::string to_string ( int  val)
inline

Definition at line 153 of file misc.h.

Variable Documentation

const flagT FLAG_BOTH = 3

Definition at line 318 of file misc.h.

const flagT FLAG_EMPTY = 0

Definition at line 315 of file misc.h.

const flagT FLAG_NO = 2

Definition at line 317 of file misc.h.

const flagT FLAG_YES = 1

Definition at line 316 of file misc.h.