-rw-r--r-- | pwmanager/pwmanager/globalstuff.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pwmanager/pwmanager/globalstuff.h b/pwmanager/pwmanager/globalstuff.h index 428ce95..4f70f68 100644 --- a/pwmanager/pwmanager/globalstuff.h +++ b/pwmanager/pwmanager/globalstuff.h | |||
@@ -1,134 +1,134 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2003, 2004 by Michael Buesch * | 3 | * copyright (C) 2003, 2004 by Michael Buesch * |
4 | * email: mbuesch@freenet.de * | 4 | * email: mbuesch@freenet.de * |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #ifndef __GLOBALSTUFF_H | 20 | #ifndef __GLOBALSTUFF_H |
21 | #define __GLOBALSTUFF_H | 21 | #define __GLOBALSTUFF_H |
22 | 22 | ||
23 | #ifndef PWM_EMBEDDED | 23 | #ifndef PWM_EMBEDDED |
24 | #include "config.h" | 24 | #include "config.h" |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #include "compiler.h" | 27 | #include "compiler.h" |
28 | 28 | ||
29 | //US BUG: the following code caused compile errors with certain gcccompilers (2.95). | 29 | //US BUG: the following code caused compile errors with certain gcccompilers (2.95). |
30 | // Because of that I replaced it with a Qt version, which should do the same. | 30 | // Because of that I replaced it with a Qt version, which should do the same. |
31 | #include <string> | 31 | #include <string> |
32 | 32 | ||
33 | #ifndef PWM_EMBEDDED | 33 | #ifndef PWM_EMBEDDED |
34 | #include <sstream> | 34 | #include <sstream> |
35 | #else | 35 | #else |
36 | #include <qstring.h> | 36 | #include <qstring.h> |
37 | #include <qtextstream.h> | 37 | #include <qtextstream.h> |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #ifndef CONFIG_KEYCARD | 40 | #ifndef CONFIG_KEYCARD |
41 | class QWidget; | 41 | class QWidget; |
42 | void no_keycard_support_msg_box(QWidget *parentWidget); | 42 | void no_keycard_support_msg_box(QWidget *parentWidget); |
43 | #endif // CONFIG_KEYCARD | 43 | #endif // CONFIG_KEYCARD |
44 | 44 | ||
45 | #ifdef PROG_NAME | 45 | #ifdef PROG_NAME |
46 | # undef PROG_NAME | 46 | # undef PROG_NAME |
47 | #endif | 47 | #endif |
48 | #define PROG_NAME"PwManager" | 48 | #define PROG_NAME"PwManager-MicroKDE" |
49 | 49 | ||
50 | #ifdef PACKAGE_NAME | 50 | #ifdef PACKAGE_NAME |
51 | # undef PACKAGE_NAME | 51 | # undef PACKAGE_NAME |
52 | #endif | 52 | #endif |
53 | #define PACKAGE_NAME"pwmanager" | 53 | #define PACKAGE_NAME"pwmanager-microkde" |
54 | 54 | ||
55 | #ifdef PACKAGE_VER | 55 | #ifdef PACKAGE_VER |
56 | # undef PACKAGE_VER | 56 | # undef PACKAGE_VER |
57 | #endif | 57 | #endif |
58 | #define PACKAGE_VER"1.0.1" | 58 | #define PACKAGE_VER"1.0.1" |
59 | 59 | ||
60 | #ifdef CONFIG_DEBUG | 60 | #ifdef CONFIG_DEBUG |
61 | # define PWM_DEBUG | 61 | # define PWM_DEBUG |
62 | #else | 62 | #else |
63 | # undef PWM_DEBUG | 63 | # undef PWM_DEBUG |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | #ifdef QT_MAKE_VERSION | 66 | #ifdef QT_MAKE_VERSION |
67 | # undef QT_MAKE_VERSION | 67 | # undef QT_MAKE_VERSION |
68 | #endif | 68 | #endif |
69 | #define QT_MAKE_VERSION(a,b,c)(((a) << 16) | ((b) << 8) | (c)) | 69 | #define QT_MAKE_VERSION(a,b,c)(((a) << 16) | ((b) << 8) | (c)) |
70 | 70 | ||
71 | /** remove "unused parameter" warnings */ | 71 | /** remove "unused parameter" warnings */ |
72 | #ifdef PARAM_UNUSED | 72 | #ifdef PARAM_UNUSED |
73 | # undef PARAM_UNUSED | 73 | # undef PARAM_UNUSED |
74 | #endif | 74 | #endif |
75 | #define PARAM_UNUSED(x)(void)x | 75 | #define PARAM_UNUSED(x)(void)x |
76 | 76 | ||
77 | /** return the number of elements in an array */ | 77 | /** return the number of elements in an array */ |
78 | #ifdef array_size | 78 | #ifdef array_size |
79 | # undef array_size | 79 | # undef array_size |
80 | #endif | 80 | #endif |
81 | #define array_size(x)(sizeof(x) / sizeof((x)[0])) | 81 | #define array_size(x)(sizeof(x) / sizeof((x)[0])) |
82 | 82 | ||
83 | //US BUG: the following code caused compile errors with certain gcccompilers (2.95). | 83 | //US BUG: the following code caused compile errors with certain gcccompilers (2.95). |
84 | // Because of that I replaced it with a Qt version, which should do the same. | 84 | // Because of that I replaced it with a Qt version, which should do the same. |
85 | #ifndef PWM_EMBEDDED | 85 | #ifndef PWM_EMBEDDED |
86 | /** convert something to string using ostringstream */ | 86 | /** convert something to string using ostringstream */ |
87 | template <class T> inline | 87 | template <class T> inline |
88 | std::string tostr(const T &t) | 88 | std::string tostr(const T &t) |
89 | { | 89 | { |
90 | std::ostringstream s; | 90 | std::ostringstream s; |
91 | s << t; | 91 | s << t; |
92 | return s.str(); | 92 | return s.str(); |
93 | } | 93 | } |
94 | #else | 94 | #else |
95 | /** convert something to string using ostringstream */ | 95 | /** convert something to string using ostringstream */ |
96 | template <class T> inline | 96 | template <class T> inline |
97 | std::string tostr(const T &t) | 97 | std::string tostr(const T &t) |
98 | { | 98 | { |
99 | QString result; | 99 | QString result; |
100 | QTextOStream(&result) << t; | 100 | QTextOStream(&result) << t; |
101 | return result.latin1(); | 101 | return result.latin1(); |
102 | } | 102 | } |
103 | #endif | 103 | #endif |
104 | 104 | ||
105 | /** delete the memory and NULL the pointer */ | 105 | /** delete the memory and NULL the pointer */ |
106 | template<class T> inline | 106 | template<class T> inline |
107 | void delete_and_null(T *&p) | 107 | void delete_and_null(T *&p) |
108 | { | 108 | { |
109 | delete p; | 109 | delete p; |
110 | p = 0; | 110 | p = 0; |
111 | } | 111 | } |
112 | /** delete the memory if the pointer isn't a NULL pointer */ | 112 | /** delete the memory if the pointer isn't a NULL pointer */ |
113 | template<class T> inline | 113 | template<class T> inline |
114 | void delete_ifnot_null(T *&p) | 114 | void delete_ifnot_null(T *&p) |
115 | { | 115 | { |
116 | if (p) | 116 | if (p) |
117 | delete_and_null(p); | 117 | delete_and_null(p); |
118 | } | 118 | } |
119 | 119 | ||
120 | template<class T> inline | 120 | template<class T> inline |
121 | void delete_and_null_array(T *&p) | 121 | void delete_and_null_array(T *&p) |
122 | { | 122 | { |
123 | delete [] p; | 123 | delete [] p; |
124 | p = 0; | 124 | p = 0; |
125 | } | 125 | } |
126 | 126 | ||
127 | template<class T> inline | 127 | template<class T> inline |
128 | void delete_ifnot_null_array(T *&p) | 128 | void delete_ifnot_null_array(T *&p) |
129 | { | 129 | { |
130 | if (p) | 130 | if (p) |
131 | delete_and_null_array(p); | 131 | delete_and_null_array(p); |
132 | } | 132 | } |
133 | 133 | ||
134 | #endif // GLOBALSTUFF_H | 134 | #endif // GLOBALSTUFF_H |