-rwxr-xr-x | libopie2/tools/regen.py | 52 |
1 files changed, 41 insertions, 11 deletions
diff --git a/libopie2/tools/regen.py b/libopie2/tools/regen.py index 2f7f418..9ad5352 100755 --- a/libopie2/tools/regen.py +++ b/libopie2/tools/regen.py | |||
@@ -22,7 +22,7 @@ print >>tablehfile,""" | |||
22 | /* | 22 | /* |
23 | * ioctl table - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> | 23 | * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #ifndef IOCTLMAP_H | 26 | #ifndef DEBUGMAPPER_H |
27 | #define IOCTLMAP_H | 27 | #define DEBUGMAPPER_H |
28 | 28 | ||
@@ -33,3 +33,12 @@ typedef QIntDict<QString> IntStringMap; | |||
33 | 33 | ||
34 | IntStringMap* constructIoctlMap(); | 34 | class DebugMapper |
35 | { | ||
36 | public: | ||
37 | DebugMapper(); | ||
38 | ~DebugMapper(); | ||
39 | |||
40 | const QString& map( int value ) const; | ||
41 | private: | ||
42 | IntStringMap _map; | ||
43 | }; | ||
35 | 44 | ||
@@ -40,3 +49,3 @@ print >>tablecfile,""" | |||
40 | /* | 49 | /* |
41 | * ioctl table - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> | 50 | * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> |
42 | */ | 51 | */ |
@@ -45,5 +54,5 @@ print >>tablecfile,""" | |||
45 | 54 | ||
46 | IntStringMap* constructIoctlMap() | 55 | DebugMapper::DebugMapper() |
47 | { | 56 | { |
48 | \tIntStringMap* map = new IntStringMap(); | 57 | qDebug( "DebugMapper::DebugMapper()" ); |
49 | 58 | ||
@@ -56,4 +65,3 @@ for line in result: | |||
56 | continue | 65 | continue |
57 | #print >>tablecfile, "\tqDebug( \"adding %s = %s\" );" % ( l[2], l[1] ) | 66 | print >>tablecfile, " _map.insert( %s, new QString(\"%s\") );" % ( l[2], l[1] ) |
58 | print >>tablecfile, "\tmap->insert( %s, new QString(\"%s\") );" % ( l[2], l[1] ) | ||
59 | 67 | ||
@@ -61,4 +69,26 @@ for line in result: | |||
61 | print >>tablecfile,""" | 69 | print >>tablecfile,""" |
62 | \treturn map; | ||
63 | }; | 70 | }; |
64 | """ \ No newline at end of file | 71 | |
72 | |||
73 | DebugMapper::~DebugMapper() | ||
74 | { | ||
75 | qDebug( "DebugMapper::~DebugMapper()" ); | ||
76 | } | ||
77 | |||
78 | |||
79 | const QString& DebugMapper::map( int value ) const | ||
80 | { | ||
81 | QString* result = _map[ value ]; | ||
82 | |||
83 | if ( !result ) | ||
84 | { | ||
85 | qDebug( "DebugMapper::map() - value not found." ); | ||
86 | return QString::null; | ||
87 | } | ||
88 | else | ||
89 | { | ||
90 | return *result; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | """ | ||