My Project
Loading...
Searching...
No Matches
feResource.h
Go to the documentation of this file.
1#ifndef FERESOURCE_H
2#define FERESOURCE_H
3
4#include <sys/param.h>
5
6#define DIR_SEP '/'
7#define DIR_SEPP "/"
8
9#ifndef MAXPATHLEN
10#define MAXPATHLEN 1024
11#endif
12
13#ifdef __cplusplus
14#include "../factory/globaldefs.h"
15/*****************************************************************
16 *
17 * Resource management (feResources.cc)
18 *
19 *****************************************************************/
21
22typedef struct feResourceConfig_s
23{
24 const char* key; // key to identify resource
25 const char id; // char id to identify resource
26 feResourceType type; // type of Resource
27 const char* env; // env variable to look for
28 const char* fmt; // format string -- see below for epxlaination
29 char* value; // what it was set to: may be changed
32
34
35// returns value of Resource as read-only string, or NULL
36// if Resource not found
37// issues warning, if explicitely requested (warn > 0), or
38// if warn < 0 and Resource is gotten for the first time
39// Always quiet if warn == 0
40char* feResource(const char id, int warn = -1);
41char* feResource(const char* key, int warn = -1);
42
43char* feGetResource(const char id, int warn = -1);
44
45// char* feResourceDefault(const char id);
46// char* feResourceDefault(const char* key);
47
48
49// This needs to be called before the first call to feResource
50// Initializes Resources, SearchPath, and extends PATH
51void feInitResources(const char* argv0);
52// Re-inits resources, should be called after changing env. variables
54#endif /* end ifdef __cplusplus */
55
57
58const char fePathSep = ':' ;
59
60#endif
EXTERN_VAR char * feArgv0
Definition: feResource.h:56
feResourceType type
Definition: feResource.h:26
const char fePathSep
Definition: feResource.h:58
const char id
Definition: feResource.h:25
EXTERN_VAR feResourceConfig_s feResourceConfigs[]
Definition: feResource.h:33
void feReInitResources()
Definition: feResource.cc:185
char * feGetResource(const char id, int warn=-1)
Definition: feResource.cc:148
const char * key
Definition: feResource.h:24
const char * env
Definition: feResource.h:27
feResourceConfig_s * feResourceConfig
Definition: feResource.h:31
char * feResource(const char id, int warn=-1)
Definition: feResource.cc:143
void feInitResources(const char *argv0)
Definition: feResource.cc:163
const char * fmt
Definition: feResource.h:28
feResourceType
Definition: feResource.h:20
@ feResBinary
Definition: feResource.h:20
@ feResPath
Definition: feResource.h:20
@ feResDir
Definition: feResource.h:20
@ feResUrl
Definition: feResource.h:20
@ feResUndef
Definition: feResource.h:20
@ feResFile
Definition: feResource.h:20
#define EXTERN_VAR
Definition: globaldefs.h:6