ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationpthread-emulationqualifiedEnum
Last change
on this file since b1eeb3aa was
b1eeb3aa,
checked in by Jacob Prud'homme <jafprudhomme@…>, 3 years ago
|
Added default parse function signatures to header file
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | #pragma once |
---|
2 | |
---|
3 | struct config_entry { |
---|
4 | const char * key; |
---|
5 | void * variable; |
---|
6 | bool (*parse)(const char *, void *); |
---|
7 | }; |
---|
8 | |
---|
9 | static inline void ?{}( config_entry & this ) {} |
---|
10 | |
---|
11 | forall(T & | { bool parse(const char *, T & ); }) |
---|
12 | static inline void ?{}( config_entry & this, const char * key, T & variable ) { |
---|
13 | this.key = key; |
---|
14 | this.variable = (void *)&variable; |
---|
15 | this.parse = (bool (*)(const char *, void *))parse; |
---|
16 | } |
---|
17 | |
---|
18 | forall(T &) |
---|
19 | static inline void ?{}( config_entry & this, const char * key, T & variable, bool (*parse)(const char *, T &) ) { |
---|
20 | this.key = key; |
---|
21 | this.variable = (void *)&variable; |
---|
22 | this.parse = (bool (*)(const char *, void *))parse; |
---|
23 | } |
---|
24 | |
---|
25 | void parse_config( const char * config_file, config_entry entries[], size_t num_entries ); |
---|
26 | |
---|
27 | bool parse( const char *, const char * & ); |
---|
28 | bool parse( const char *, int & ); |
---|
29 | bool parse( const char *, unsigned & ); |
---|
30 | bool parse( const char *, unsigned long & ); |
---|
31 | bool parse( const char *, unsigned long long & ); |
---|
32 | bool parse( const char *, float & ); |
---|
33 | bool parse( const char *, double & ); |
---|
34 | |
---|
35 | // Local Variables: // |
---|
36 | // mode: c // |
---|
37 | // tab-width: 4 // |
---|
38 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.