Panda3D
Main Page
Classes
Files
File List
All
Classes
Functions
Variables
Enumerations
dtool
src
prc
configDeclaration.h
1
// Filename: configDeclaration.h
2
// Created by: drose (15Oct04)
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 CONFIGDECLARATION_H
16
#define CONFIGDECLARATION_H
17
18
#include "dtoolbase.h"
19
#include "configFlags.h"
20
#include "configPage.h"
21
#include "vector_string.h"
22
#include "numeric_types.h"
23
24
#include <vector>
25
26
class
ConfigVariableCore
;
27
28
////////////////////////////////////////////////////////////////////
29
// Class : ConfigDeclaration
30
// Description : A single declaration of a config variable, typically
31
// defined as one line in a .prc file,
32
// e.g. "show-frame-rate-meter 1". This is really just
33
// a pairing of a string name (actually, a
34
// ConfigVariableCore pointer) to a string value.
35
////////////////////////////////////////////////////////////////////
36
class
EXPCL_DTOOLCONFIG
ConfigDeclaration
:
public
ConfigFlags
{
37
private
:
38
ConfigDeclaration
(
ConfigPage
*page,
ConfigVariableCore
*variable,
39
const
string
&string_value,
int
decl_seq);
40
~
ConfigDeclaration
();
41
42
public
:
43
INLINE
bool
operator < (
const
ConfigDeclaration
&other)
const
;
44
45
PUBLISHED:
46
INLINE
ConfigPage
*get_page()
const
;
47
INLINE
ConfigVariableCore
*get_variable()
const
;
48
49
INLINE
const
string
&get_string_value()
const
;
50
INLINE
void
set_string_value(
const
string
&value);
51
52
INLINE
int
get_num_words()
const
;
53
54
INLINE
bool
has_string_word(
int
n)
const
;
55
INLINE
bool
has_bool_word(
int
n)
const
;
56
INLINE
bool
has_int_word(
int
n)
const
;
57
INLINE
bool
has_int64_word(
int
n)
const
;
58
INLINE
bool
has_double_word(
int
n)
const
;
59
60
INLINE
string
get_string_word(
int
n)
const
;
61
INLINE
bool
get_bool_word(
int
n)
const
;
62
INLINE
int
get_int_word(
int
n)
const
;
63
INLINE PN_int64 get_int64_word(
int
n)
const
;
64
INLINE
double
get_double_word(
int
n)
const
;
65
66
void
set_string_word(
int
n,
const
string
&value);
67
void
set_bool_word(
int
n,
bool
value);
68
void
set_int_word(
int
n,
int
value);
69
void
set_int64_word(
int
n, PN_int64 value);
70
void
set_double_word(
int
n,
double
value);
71
72
INLINE
int
get_decl_seq()
const
;
73
74
void
output(ostream &out)
const
;
75
void
write(ostream &out)
const
;
76
77
public
:
78
static
int
extract_words(
const
string
&str, vector_string &words);
79
static
string
downcase(
const
string
&s);
80
81
private
:
82
void
get_words();
83
void
check_bool_word(
int
n);
84
void
check_int_word(
int
n);
85
void
check_int64_word(
int
n);
86
void
check_double_word(
int
n);
87
88
private
:
89
ConfigPage
*_page;
90
ConfigVariableCore
*_variable;
91
string
_string_value;
92
int
_decl_seq;
93
94
enum
WordFlags {
95
F_checked_bool = 0x0001,
96
F_valid_bool = 0x0002,
97
F_checked_int = 0x0004,
98
F_valid_int = 0x0008,
99
F_checked_double = 0x0010,
100
F_valid_double = 0x0020,
101
F_checked_int64 = 0x0040,
102
F_valid_int64 = 0x0080,
103
};
104
105
class
Word {
106
public
:
107
string
_str;
108
bool
_bool;
109
int
_int;
110
PN_int64 _int_64;
111
double
_double;
112
short
_flags;
113
};
114
115
typedef
vector<Word> Words;
116
Words _words;
117
bool
_got_words;
118
119
friend
class
ConfigPage
;
120
};
121
122
INLINE ostream &operator << (ostream &out,
const
ConfigDeclaration
&decl);
123
124
#include "configDeclaration.I"
125
126
#endif
ConfigVariableCore
The internal definition of a ConfigVariable.
Definition:
configVariableCore.h:38
ConfigFlags
This class is the base class of both ConfigVariable and ConfigVariableCore.
Definition:
configFlags.h:29
ConfigPage
A page of ConfigDeclarations that may be loaded or unloaded.
Definition:
configPage.h:33
ConfigDeclaration
A single declaration of a config variable, typically defined as one line in a .prc file...
Definition:
configDeclaration.h:36
Generated on Mon Feb 1 2016 13:44:16 for Panda3D by
1.8.5