Panda3D
dtool
src
dconfig
dconfig.h
1
// Filename: dconfig.h
2
// Created by: cary (14Jul98)
3
//
4
////////////////////////////////////////////////////////////////////
5
//
6
// PANDA 3D SOFTWARE
7
// Copyright (c) Carnegie Mellon University. All rights reserved.
8
//
9
// All use of this software is subject to the terms of the revised BSD
10
// license. You should have received a copy of this license along
11
// with this source code in a file named "LICENSE."
12
//
13
////////////////////////////////////////////////////////////////////
14
15
#ifndef DCONFIG_H
16
#define DCONFIG_H
17
18
#include "dtoolbase.h"
19
20
#include "config_dconfig.h"
21
#include "configVariableString.h"
22
#include "configVariableBool.h"
23
#include "configVariableInt.h"
24
#include "configVariableDouble.h"
25
#include "configVariableList.h"
26
#include "configFlags.h"
27
28
////////////////////////////////////////////////////////////////////
29
// Class : DConfig
30
// Description : This class emulates the old dconfig-style interface
31
// to our Panda config system. It exists only to
32
// provide backward-compatible support, and it is used
33
// primarily by Python code. For modern code, use the
34
// new ConfigVariable* interface instead of this
35
// deprecated interface.
36
////////////////////////////////////////////////////////////////////
37
class
EXPCL_DTOOLCONFIG
DConfig
{
38
PUBLISHED:
39
static
INLINE
bool
GetBool(
const
string
&sym,
bool
def =
false
);
40
static
INLINE
int
GetInt(
const
string
&sym,
int
def = 0);
41
static
INLINE
float
GetFloat(
const
string
&sym,
float
def = 0.);
42
static
INLINE
double
GetDouble(
const
string
&sym,
double
def = 0.);
43
static
INLINE
string
GetString(
const
string
&sym,
const
string
&def =
""
);
44
};
45
46
#include "dconfig.I"
47
48
49
// These macros are used in each directory to call an initialization
50
// function at static-init time. These macros may eventually be
51
// phased out in favor of a simpler interface that does not require
52
// static init.
53
54
// NOTE:
55
// Having a macro called Configure proved to be problematic with some
56
// DX9 headers. To avoid that in the future we provide a new family
57
// of macros prefixed by DTool and deprecate the old ones, to be
58
// removed from the codebase sometime in the future.
59
60
// This macro should appear in the config_*.h file.
61
62
#define ConfigureDecl(name, expcl, exptp)
63
#define DToolConfigureDecl(name, expcl, exptp)
64
65
// This macro defines the actual declaration of the object defined
66
// above; it should appear in the config_*.cxx file.
67
68
#define ConfigureDef(name) \
69
class StaticInitializer_ ## name { \
70
public: \
71
StaticInitializer_ ## name(); \
72
}; \
73
static StaticInitializer_ ## name name;
74
#define DToolConfigureDef(name) \
75
class StaticInitializer_ ## name { \
76
public: \
77
StaticInitializer_ ## name(); \
78
}; \
79
static StaticInitializer_ ## name name;
80
81
// This macro can be used in lieu of the above two when the Configure
82
// object does not need to be visible outside of the current C file.
83
84
#define Configure(name) ConfigureDef(name)
85
#define DToolConfigure(name) DToolConfigureDef(name)
86
87
// This one defines a block of code that will be executed at static
88
// init time. It must always be defined (in the C file), even if no
89
// code is to be executed.
90
91
#define ConfigureFn(name) \
92
StaticInitializer_ ## name::StaticInitializer_ ## name()
93
#define DToolConfigureFn(name) \
94
StaticInitializer_ ## name::StaticInitializer_ ## name()
95
96
#endif
/* __CONFIG_H__ */
DConfig
This class emulates the old dconfig-style interface to our Panda config system.
Definition:
dconfig.h:37
Generated on Wed May 17 2017 23:39:07 for Panda3D by
1.8.13