source: tspsg-svn/trunk/src/globals.h @ 96

Last change on this file since 96 was 96, checked in by laleppa, 15 years ago
  • Fixed some wrong defines that prevented successful compilation under *nix.
  • Renamed i18n to l10n to follow common standards.
  • Translation and documentation paths are now synchronized between .pro and source.
  • Moved some versioning information to .pro file.
  • Updated translations.
  • Property svn:keywords set to Id URL
File size: 3.2 KB
RevLine 
[67]1/*!
2 * \file globals.h
[87]3 * \author Copyright (C) 2007-2010 Lёppa <contacts[at]oleksii[dot]name>
[21]4 *
5 *  $Id: globals.h 96 2010-03-01 13:13:23Z laleppa $
6 *  $URL: https://tspsg.svn.sourceforge.net/svnroot/tspsg/trunk/src/globals.h $
7 *
[67]8 * \brief Contains TSPSG global defines.
9 *
10 *  <b>TSPSG: TSP Solver and Generator</b>
11 *
[21]12 *  This file is part of TSPSG.
13 *
14 *  TSPSG is free software: you can redistribute it and/or modify
15 *  it under the terms of the GNU General Public License as published by
16 *  the Free Software Foundation, either version 3 of the License, or
17 *  (at your option) any later version.
18 *
19 *  TSPSG is distributed in the hope that it will be useful,
20 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 *  GNU General Public License for more details.
23 *
24 *  You should have received a copy of the GNU General Public License
25 *  along with TSPSG.  If not, see <http://www.gnu.org/licenses/>.
26 */
27
[31]28#ifndef GLOBALS_H
29#define GLOBALS_H
[21]30
[31]31// INCLUDES
32#include <QtCore>
33#include <QtGui>
34
[42]35// Version info
36#include "version.h"
[54]37// OS and ARCH detection
[31]38#include "os.h"
[87]39// TSPSG Defaults
40#include "defaults.h"
[96]41#ifdef Q_OS_WIN32
42        // Vista/7 Eyecandy
43        #include "qtwin.h"
44#endif // Q_OS_WIN32
[31]45
46// DEFINES
[64]47//! Maximum available number of cities
[78]48#define MAX_NUM_CITIES 50
[64]49//! Maximum allowed value for random generation limits
[57]50#define MAX_RAND_VALUE 1000
51
52// Paths
[64]53/*!
[96]54 * \def PATH_L10N
[64]55 * \brief Bath to internationalization files.
56 */
[96]57#ifndef PATH_L10N
58        #define PATH_L10N "l10n"
59#endif // PATH_L10N
[64]60/*!
61 * \def PATH_DOCS
62 * \brief Bath to documentation files.
63 */
[96]64#ifndef PATH_DOCS
[57]65        #define PATH_DOCS "help"
[96]66#endif // PATH_DOCS
[57]67
[66]68//! TSPSG Task file signature - letters \c TSPT
[31]69#define TSPT quint32(0x54535054)
[64]70//! TSPSG Task file version
[31]71#define TSPT_VERSION quint8(1)
[64]72//! TSPSG Task file metadata version
[31]73#define TSPT_META_VERSION quint8(1)
[64]74//! TSPSG Task file metadata size in bytes (incl. version)
[31]75#define TSPT_META_SIZE 2
[66]76//! ZKomModRd Task file signature - letters \c ZK
[31]77#define ZKT quint16(0x5A4B)
[64]78//! ZKomModRd Task file version
[31]79#define ZKT_VERSION quint8(1)
80
[66]81/*!
82 * \def INFINITY
83 * \brief This value means infinity :-)
84 *
85 *  Some libraries already have \c INFINITY defined.
86 *  We need to redefine it for the \c INFINITY to always have the same value.
87 */
[64]88#ifdef INFINITY
89        #undef INFINITY
[27]90#endif
[64]91#define INFINITY 1.7E+308
92//! This string represents infinite value in the table
[42]93#define INFSTR "---"
[27]94
[81]95// FUNCTIONS
96/*!
[82]97 * \brief Checks whether \a x contains an integer value.
98 * \param x A value to check.
99 * \return \c true if \a x countains an integer, oherwise \c false.
[81]100 */
[89]101inline bool isInteger(double x)
[81]102{
[89]103double i;
[81]104        return (modf(x, &i) == 0.0);
105}
106
[64]107// Sanity checks
[57]108// Check that default number of cities is sane (<= MAX_NUM_CITIES)
[50]109#if DEF_NUM_CITIES > MAX_NUM_CITIES
110        #undef DEF_NUM_CITIES
111        #define DEF_NUM_CITIES MAX_NUM_CITIES
112#endif
[57]113// Check that maximum for random generation is sane (<= MAX_RAND_VALUE)
114#if DEF_RAND_MAX > MAX_RAND_VALUE
115        #undef DEF_RAND_MAX
116        #define DEF_RAND_MAX MAX_RAND_VALUE
117#endif
118// Check that DEF_RAND_MIN <= DEF_RAND_MAX
119#if DEF_RAND_MIN > DEF_RAND_MAX
120        #undef DEF_RAND_MIN
121        #define DEF_RAND_MIN DEF_RAND_MAX
122#endif
[50]123
[31]124#endif // GLOBALS_H
Note: See TracBrowser for help on using the repository browser.