| 1 | /*************************************************************************** |
| 2 | * Copyright (C) 2002-2003 Andi Peredri * |
| 3 | * [email protected] * |
| 4 | * Copyright (C) 2004-2007 Artur Wiebe * |
| 5 | * [email protected] * |
| 6 | * * |
| 7 | * This program is free software; you can redistribute it and/or modify * |
| 8 | * it under the terms of the GNU General Public License as published by * |
| 9 | * the Free Software Foundation; either version 2 of the License, or * |
| 10 | * (at your option) any later version. * |
| 11 | * * |
| 12 | * This program is distributed in the hope that it will be useful, * |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 15 | * GNU General Public License for more details. * |
| 16 | * * |
| 17 | * You should have received a copy of the GNU General Public License * |
| 18 | * along with this program; if not, write to the * |
| 19 | * Free Software Foundation, Inc., * |
| 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
| 21 | ***************************************************************************/ |
| 22 | #ifndef PDN_H |
| 23 | #define PDN_Hcxx . . $ `src/pdn.h:23:9`! |
| 24 | |
| 25 | |
| 26 | #include <QList> |
| 27 | #include <QWidget> |
| 28 | |
| 29 | |
| 30 | #define ENOTATIONcxx . . $ `src/pdn.h:30:9`! "1 2 3 4 5 6 7 8 9 1011121314151617181920212223242526272829303132" |
| 31 | //#define ENOTATION "32313029282726252423222120191817161514131211109 8 7 6 5 4 3 2 1 " |
| 32 | #define RNOTATIONcxx . . $ `src/pdn.h:32:9`! "B8D8F8H8A7C7E7G7B6D6F6H6A5C5E5G5B4D4F4H4A3C3E3G3B2D2F2H2A1C1E1G1" |
| 33 | |
| 34 | #define ENGLISHcxx . . $ `src/pdn.h:34:9`! 21 |
| 35 | #define RUSSIANcxx . . $ `src/pdn.h:35:9`! 25 |
| 36 | |
| 37 | |
| 38 | class PdnMovecxx . . $ PdnMove#; |
| 39 | class PdnGamecxx . . $ PdnGame#; |
| 40 | |
| 41 | |
| 42 | // Portable Draughts Notation Format File parser |
| 43 | class Pdncxx . . $ Pdn# |
| 44 | { |
| 45 | public: |
| 46 | Pdncxx . . $ Pdn#Pdn(49f6e7a06ebc5aa8).(); |
| 47 | virtual ~cxx . . $ Pdn#`~Pdn`(49f6e7a06ebc5aa8).Pdncxx . . $ Pdn#(); |
| 48 | |
| 49 | int countcxx . . $ Pdn#count(455f465bc33b4cdf).() const { return m_databasecxx . . $ Pdn#m_database..countcxx . . $ QList#count(455f465bc33b4cdf).(); } |
| 50 | PdnGamecxx . . $ PdnGame#* gamecxx . . $ Pdn#game(43bbca349f83a844).(int i) { return m_databasecxx . . $ Pdn#m_database..atcxx . . $ QList#at(e2681f9bb6b2f357).(i); } |
| 51 | PdnGamecxx . . $ PdnGame#* newGamecxx . . $ Pdn#newGame(7f8740dfe427848).(); |
| 52 | |
| 53 | void clearcxx . . $ Pdn#clear(49f6e7a06ebc5aa8).() { m_databasecxx . . $ Pdn#m_database..clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); } |
| 54 | // parent is needed to display a progress dialog. |
| 55 | bool opencxx . . $ Pdn#open(c44dbb032bc1e7d3).(const QStringcxx . . $ QString#& filename, QWidgetcxx . . $ QWidget#* parent, |
| 56 | const QStringcxx . . $ QString#& label, QStringcxx . . $ QString#& text_to_log); |
| 57 | bool savecxx . . $ Pdn#save(e1defb592416720d).(const QStringcxx . . $ QString#& filename); |
| 58 | |
| 59 | private: |
| 60 | QListcxx . . $ QList#<PdnGamecxx . . $ PdnGame#*> m_databasecxx . . $ Pdn#m_database.; |
| 61 | }; |
| 62 | |
| 63 | |
| 64 | /* |
| 65 | * m_first, m_second are mandatary. |
| 66 | * comments are optional. |
| 67 | */ |
| 68 | class PdnMovecxx . . $ PdnMove# |
| 69 | { |
| 70 | public: |
| 71 | PdnMovecxx . . $ PdnMove#PdnMove(7df51288a9ebd664).(QStringcxx . . $ QString# whole_line_of_move); |
| 72 | |
| 73 | QStringcxx . . $ QString# m_firstcxx . . $ PdnMove#m_first., m_comfirstcxx . . $ PdnMove#m_comfirst.; |
| 74 | QStringcxx . . $ QString# m_secondcxx . . $ PdnMove#m_second., m_comsecondcxx . . $ PdnMove#m_comsecond.; |
| 75 | }; |
| 76 | |
| 77 | |
| 78 | /* |
| 79 | * represents each game in a pdn-file. |
| 80 | */ |
| 81 | class PdnGamecxx . . $ PdnGame# |
| 82 | { |
| 83 | public: |
| 84 | PdnGamecxx . . $ PdnGame#PdnGame(7ae9d009a77e8cb0).(const QStringcxx . . $ QString#& game_string, QStringcxx . . $ QString#& text_to_log); |
| 85 | ~cxx . . $ PdnGame#`~PdnGame`(49f6e7a06ebc5aa8).PdnGamecxx . . $ PdnGame#(); |
| 86 | |
| 87 | enum Tagcxx . . $ PdnGame#Tag# { Datecxx . . $ PdnGame#Date., Sitecxx . . $ PdnGame#Site., Typecxx . . $ PdnGame#Type., Eventcxx . . $ PdnGame#Event., Roundcxx . . $ PdnGame#Round., Whitecxx . . $ PdnGame#White., Blackcxx . . $ PdnGame#Black.,Resultcxx . . $ PdnGame#Result. }; |
| 88 | |
| 89 | int itemcxx . . $ PdnGame#item(7ccb52b1bfe01045).(int i) const { return boardcxx . . $ PdnGame#board.[i]; } |
| 90 | void setItemcxx . . $ PdnGame#setItem(3e454b8ccf442868).(int i, int set) { boardcxx . . $ PdnGame#board.[i]=set; } |
| 91 | |
| 92 | bool isWhitecxx . . $ PdnGame#isWhite(50ce9a9e25b4a850).() const { return whitecxx . . $ PdnGame#white.; } |
| 93 | void setWhitecxx . . $ PdnGame#setWhite(b45ddcbc8423892c).(bool set) { whitecxx . . $ PdnGame#white.=set; } |
| 94 | |
| 95 | void setcxx . . $ PdnGame#set(843cca5850ba8ec7).(Tagcxx . . $ PdnGame#Tag# tag, const QStringcxx . . $ QString#& string); |
| 96 | QStringcxx . . $ QString# getcxx . . $ PdnGame#get(2bba888b79065846).(Tagcxx . . $ PdnGame#Tag# tag) const; |
| 97 | |
| 98 | int movesCountcxx . . $ PdnGame#movesCount(455f465bc33b4cdf).() const { return m_movescxx . . $ PdnGame#m_moves..countcxx . . $ QList#count(455f465bc33b4cdf).(); } |
| 99 | PdnMovecxx . . $ PdnMove#* getMovecxx . . $ PdnGame#getMove(13c520724813e2b0).(int i); |
| 100 | PdnMovecxx . . $ PdnMove#* addMovecxx . . $ PdnGame#addMove(bcf1b5f2e81ae2b0).(); |
| 101 | void clearMovescxx . . $ PdnGame#clearMoves(49f6e7a06ebc5aa8).() { m_movescxx . . $ PdnGame#m_moves..clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); } |
| 102 | |
| 103 | QStringcxx . . $ QString# toStringcxx . . $ PdnGame#toString(4365c3963150523e).(); |
| 104 | |
| 105 | private: |
| 106 | bool parsecxx . . $ PdnGame#parse(853723320e657e87).(const QStringcxx . . $ QString#& game_string, QStringcxx . . $ QString#& log_txt); |
| 107 | bool parsecxx . . $ PdnGame#parse(7bc58614ad8ebda3).(const QStringcxx . . $ QString#& string, bool side); |
| 108 | bool parse_movescxx . . $ PdnGame#parse_moves(e1defb592416720d).(const QStringcxx . . $ QString#& moves_line); |
| 109 | |
| 110 | private: |
| 111 | bool whitecxx . . $ PdnGame#white.; |
| 112 | int boardcxx . . $ PdnGame#board.[32]; |
| 113 | QStringcxx . . $ QString# pdnDatecxx . . $ PdnGame#pdnDate.; |
| 114 | QStringcxx . . $ QString# pdnSitecxx . . $ PdnGame#pdnSite.; |
| 115 | QStringcxx . . $ QString# pdnTypecxx . . $ PdnGame#pdnType.; |
| 116 | QStringcxx . . $ QString# pdnEventcxx . . $ PdnGame#pdnEvent.; |
| 117 | QStringcxx . . $ QString# pdnRoundcxx . . $ PdnGame#pdnRound.; |
| 118 | QStringcxx . . $ QString# pdnWhitecxx . . $ PdnGame#pdnWhite.; |
| 119 | QStringcxx . . $ QString# pdnBlackcxx . . $ PdnGame#pdnBlack.; |
| 120 | QStringcxx . . $ QString# pdnResultcxx . . $ PdnGame#pdnResult.; |
| 121 | QListcxx . . $ QList#<PdnMovecxx . . $ PdnMove#*> m_movescxx . . $ PdnGame#m_moves.; |
| 122 | }; |
| 123 | |
| 124 | |
| 125 | #endif |