openingBookConverter.h Source File

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
openingBookConverter.h
Go to the documentation of this file.
1 #ifndef _OPENING_BOOK_CONVERTER_H
2 #define _OPENING_BOOK_CONVERTER_H
3
4 #include <osl/record/opening/openingBook.h>
5
6 class OBState
7 {
8 int OBMoveIndex;
9 int nOBMove;
10 int blackWinCount;
11 int whiteWinCount;
12
13 public:
14 OBState(int startIndex, int nMove, int blackWin, int whiteWin) :
15 OBMoveIndex(startIndex), nOBMove(nMove),
16 blackWinCount(blackWin), whiteWinCount(whiteWin) {}
17 int getOBMoveIndex() const { return OBMoveIndex; }
18 int getNOBMove() const { return nOBMove; }
19 int getBlackWinCount() const { return blackWinCount; }
20 int getWhiteWinCount() const { return whiteWinCount; }
21 };
22
23 class OpeningBookConverter
24 {
25 osl::vector<OBState> states;
26 osl::vector<osl::record::opening::OBMove> moves;
27 public:
28 OpeningBookConverter(const char* filename);
29 ~OpeningBookConverter() {};
30 void write(const char* filename);
31 void writeInNewFormat(const char* filename);
32 void writeInNewEditFormat(const char* filename);
33 private:
34 int readInt(std::ifstream& ifs);
35 void writeInt(std::ofstream& ofs, int n);
36 void writeInNewFormat(std::ofstream& ofs);
37 };
38
39 #endif // _OPENING_BOOK_CONVERTER_H