Rough PGN save support.
[tagua/yd.git] / src / common.h
blob1357fa4ec0ce67b9651c59a2a15f19fb8382942f
1 /*
2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
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 #include "export.h"
18 class QString;
20 enum ErrorCode {
21 InvalidMove
24 struct null_deleter {
25 void operator()(void const *) const { }
28 //class ChessPiece;
30 template <typename T> class Grid;
31 template <typename T> class PointerGrid;
32 //typedef PointerGrid<ChessPiece> PieceGrid;
35 TAGUA_EXPORT std::ostream &operator <<(std::ostream &os, const QString& s);
37 inline const char* wrap_cptr(const char* ptr) {
38 return ptr ? ptr : "[NULL]";
41 QString qPrintf(const char* fmt, ...);
43 TAGUA_EXPORT QString prettyTypeName(const char* name);
45 inline void TRAP() {
46 #if defined(Q_CC_GNU)
47 __asm__ __volatile__("int $3\n\t");
48 #endif
51 #ifndef M_PI
52 #define M_PI 3.1415926
53 #endif
55 #define DEBUG_MSG(header, msg) (std::cerr << header << msg << "\n" \
56 << " in " << __PRETTY_FUNCTION__ << ", line " << __LINE__ << " of " << __FILE__ << std::endl)
57 #define ERROR(x) DEBUG_MSG("Error: ", x)
58 #define WARNING(x) DEBUG_MSG("Warning: ", x)
60 #endif // COMMON_H