tstpgn.cc
Go to the documentation of this file.
1 // cwchessboard -- A C++ chessboard tool set
2 //
3 //! @file tstpgn.cc A test application to test reading PGN files.
4 //
5 // Copyright (C) 2010, by
6 //
7 // Carlo Wood, Run on IRC <carlo@alinoe.com>
8 // RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt
9 // Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF 61
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 2 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 
24 #include "sys.h"
25 #include <giomm/init.h>
26 #include "ChessGame.h"
27 #include "PgnDatabase.h"
28 #include "debug.h"
29 
30 //char const* filename="/home/carlo/projects/cwchessboard/chessgames/ftp.cis.uab.edu/crafty/enormous.pgn";
31 //char const* filename="test.pgn";
32 //char const* filename="/home/carlo/chess/jin.log.pgn";
33 //char const* filename="/opt/large/backups/usr-src-20080707.tar";
34 char const* filename="/home/carlo/projects/cwchessboard/cwchessboard/torture.pgn";
35 
36 using namespace cwchess;
37 
38 Glib::RefPtr<Glib::MainLoop> main_loop;
39 
40 void open_finished(size_t len)
41 {
42  std::cout << "Total size read: " << len << '\n';
43  main_loop->quit();
44 }
45 
46 int main(int argc, char* argv[])
47 {
48  Debug(NAMESPACE_DEBUG::init());
49  if (!Glib::thread_supported())
50  Glib::thread_init();
51  Gio::init();
52 
53  char const* infile = filename;
54  if (argc > 1)
55  infile = argv[1];
56  Glib::RefPtr<pgn::Database> pgn_data_base = pgn::DatabaseSeekable::open(infile, sigc::ptr_fun(&open_finished));
57  main_loop = Glib::MainLoop::create(false);
58  main_loop->run();
59 }
A namespace for all chess related objects that are not related to the GUI.
Definition: Array.h:39
This file contains the declaration of class pgn::Database.
This file contains the declaration of class ChessGame.

Copyright © 2006 - 2010 Carlo Wood.  All rights reserved.