b62395b4ef7567468e5ab392130373052a566e4c
[pkgsrc.git] / comms / plptools / patches / patch-ah
1 $NetBSD: patch-ah,v 1.3 2006/02/02 15:03:19 joerg Exp $
2
3 --- lib/Enum.h.orig     2002-08-10 20:47:05.000000000 +0200
4 +++ lib/Enum.h
5 @@ -28,6 +28,7 @@
6  #endif
7  
8  #include <plpintl.h>
9 +#include <assert.h>
10  
11  #include <map>
12  #include <string>
13 @@ -257,7 +258,7 @@ public:
14      * XXX: throw OutOfRangeException ?
15      */
16      static E getValueFor(const std::string &s) {
17 -       return (E) staticData.stringRep.lookup(s.getCStr());
18 +       return (E) staticData.stringRep.lookup(s.c_str());
19      }
20  };
21  
22 @@ -295,6 +296,20 @@ public:
23   *
24   * @author Henner Zeller
25   */
26 +#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
27 +#define ENUM_DEFINITION(EnumName, initWith)                    \
28 +/**                                                            \
29 +  * The definition of the static variable holding the static   \
30 +  * data for this Enumeration wrapper.                         \
31 +  */                                                           \
32 +template <EnumName> Enum<EnumName>::sdata Enum<EnumName>::staticData;  \
33 +/**                                                            \
34 +  * actual definition of the constructor for the static data.  \
35 +  * This is called implicitly by the definition above.         \
36 +  */                                                           \
37 +Enum<EnumName>::sdata::sdata() :                               \
38 +name(#EnumName),defaultValue(initWith)
39 +#else
40  #define ENUM_DEFINITION(EnumName, initWith)                    \
41  /**                                                            \
42    * The definition of the static variable holding the static   \
43 @@ -307,6 +322,7 @@ Enum<EnumName>::sdata Enum<EnumName>::st
44    */                                                           \
45  Enum<EnumName>::sdata::sdata() :                               \
46  name(#EnumName),defaultValue(initWith)
47 +#endif
48  
49  /**
50   * Writes enumeration's string representation.