Refactored TurnTest.
[tagua/yd.git] / src / common.h
blob7e434aeba345a8635ce9daf5093f158a8fb847ed
1 /*
2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@sns.it>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 */
11 #ifndef COMMON_H
12 #define COMMON_H
14 #include <iosfwd>
15 class QString;
17 enum ErrorCode {
18 InvalidMove
21 struct null_deleter {
22 void operator()(void const *) const { }
25 //class ChessPiece;
27 template <typename T> class Grid;
28 template <typename T> class PointerGrid;
29 //typedef PointerGrid<ChessPiece> PieceGrid;
32 std::ostream &operator <<(std::ostream &os, const QString& s);
34 inline const char* wrap_cptr(const char* ptr) {
35 return ptr ? ptr : "[NULL]";
38 QString qPrintf(const char* fmt, ...);
40 QString prettyTypeName(const char* name);
42 inline void TRAP() {
43 #if defined(Q_CC_GNU)
44 __asm__ __volatile__("int $3\n\t");
45 #endif
48 #ifndef M_PI
49 #define M_PI 3.1415926
50 #endif
52 #define DEBUG_MSG(header, msg) (std::cerr << header << msg << "\n" \
53 << " in " << __PRETTY_FUNCTION__ << ", line " << __LINE__ << " of " << __FILE__ << std::endl)
54 #define ERROR(x) DEBUG_MSG("Error: ", x)
55 #define WARNING(x) DEBUG_MSG("Warning: ", x)
57 #endif // COMMON_H