source: libcfa/src/parseconfig.hfa @ 602e8d5

ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationpthread-emulationqualifiedEnum
Last change on this file since 602e8d5 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
3struct config_entry {
4        const char * key;
5        void * variable;
6        bool (*parse)(const char *, void *);
7};
8
9static inline void ?{}( config_entry & this ) {}
10
11forall(T & | { bool parse(const char *, T & ); })
12static 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
18forall(T &)
19static 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
25void parse_config( const char * config_file, config_entry entries[], size_t num_entries );
26
27bool parse( const char *, const char * & );
28bool parse( const char *, int & );
29bool parse( const char *, unsigned & );
30bool parse( const char *, unsigned long & );
31bool parse( const char *, unsigned long long & );
32bool parse( const char *, float & );
33bool 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.