diff -r b8fa9171be6e -r c82a86ea87be src/misc.h --- a/src/misc.h Mon Jun 01 17:06:13 2015 +0300 +++ b/src/misc.h Fri Jun 05 18:33:51 2015 +0300 @@ -1,6 +1,6 @@ /* * ZCinema: Zandronum demo launcher - * Copyright (C) 2013 Santeri Piippo + * Copyright (C) 2013-2015 Teemu Piippo * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,38 +16,51 @@ * along with this program. If not, see . */ -#ifndef ZCINEMA_MISC_H -#define ZCINEMA_MISC_H - +#pragma once #include "types.h" uint32 makeByteID (uint8 a, uint8 b, uint8 c, uint8 d); -str binaryConfigName (str ver); -str basename (str path); -void addVersion (str name, bool isRelease, str binaryPath); -bool confirm (str text); - +QString basename (const QString& path); +void addVersion (const ZandronumVersion& version); +bool confirm (const QString& text); QList getVersions(); +// // ----------------------------------------------------------------------------- -// Templated clamp -template static inline T clamp (T a, T min, T max) { +// + +template +T clamp (T a, T min, T max) +{ return (a > max) ? max : (a < min) ? min : a; } -// Templated minimum -template static inline T min (T a, T b) { +// +// ----------------------------------------------------------------------------- +// + +template +T min (T a, T b) +{ return (a < b) ? a : b; } -// Templated maximum -template static inline T max (T a, T b) { +// +// ----------------------------------------------------------------------------- +// + +template +T max (T a, T b) +{ return (a > b) ? a : b; } -// Templated absolute value -template static inline T abs (T a) { - return (a >= 0) ? a : -a; -} +// +// ----------------------------------------------------------------------------- +// -#endif // ZCINEMA_MISC_H \ No newline at end of file +template +T abs (T a) +{ + return (a < 0) ? -a : a; +} \ No newline at end of file