summaryrefslogtreecommitdiff
path: root/comms/plptools/patches/patch-ah
blob: b62395b4ef7567468e5ab392130373052a566e4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
$NetBSD: patch-ah,v 1.3 2006/02/02 15:03:19 joerg Exp $

--- lib/Enum.h.orig	2002-08-10 20:47:05.000000000 +0200
+++ lib/Enum.h
@@ -28,6 +28,7 @@
 #endif
 
 #include <plpintl.h>
+#include <assert.h>
 
 #include <map>
 #include <string>
@@ -257,7 +258,7 @@ public:
     * XXX: throw OutOfRangeException ?
     */
     static E getValueFor(const std::string &s) {
-	return (E) staticData.stringRep.lookup(s.getCStr());
+	return (E) staticData.stringRep.lookup(s.c_str());
     }
 };
 
@@ -295,6 +296,20 @@ public:
  *
  * @author Henner Zeller
  */
+#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#define ENUM_DEFINITION(EnumName, initWith)			\
+/**								\
+  * The definition of the static variable holding the static	\
+  * data for this Enumeration wrapper.				\
+  */								\
+template <EnumName> Enum<EnumName>::sdata Enum<EnumName>::staticData;	\
+/**								\
+  * actual definition of the constructor for the static data.	\
+  * This is called implicitly by the definition above.		\
+  */								\
+Enum<EnumName>::sdata::sdata() :				\
+name(#EnumName),defaultValue(initWith)
+#else
 #define ENUM_DEFINITION(EnumName, initWith)			\
 /**								\
   * The definition of the static variable holding the static	\
@@ -307,6 +322,7 @@ Enum<EnumName>::sdata Enum<EnumName>::st
   */								\
 Enum<EnumName>::sdata::sdata() :				\
 name(#EnumName),defaultValue(initWith)
+#endif
 
 /**
  * Writes enumeration's string representation.