Panda3D
dtool
src
prc
configPageManager.h
1
// Filename: configPageManager.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 CONFIGPAGEMANAGER_H
16
#define CONFIGPAGEMANAGER_H
17
18
#include "dtoolbase.h"
19
#include "configFlags.h"
20
#include "dSearchPath.h"
21
#include "globPattern.h"
22
#include "pnotify.h"
23
24
#include <vector>
25
26
class
ConfigPage
;
27
28
////////////////////////////////////////////////////////////////////
29
// Class : ConfigPageManager
30
// Description : A global object that maintains the set of ConfigPages
31
// everywhere in the world, and keeps them in sorted
32
// order.
33
////////////////////////////////////////////////////////////////////
34
class
EXPCL_DTOOLCONFIG
ConfigPageManager
:
public
ConfigFlags
{
35
protected
:
36
ConfigPageManager
();
37
~
ConfigPageManager
();
38
39
PUBLISHED:
40
INLINE
bool
loaded_implicit_pages()
const
;
41
INLINE
void
load_implicit_pages();
42
void
reload_implicit_pages();
43
44
INLINE
DSearchPath
&get_search_path();
45
46
INLINE
int
get_num_prc_patterns()
const
;
47
INLINE
string
get_prc_pattern(
int
n)
const
;
48
49
INLINE
int
get_num_prc_encrypted_patterns()
const
;
50
INLINE
string
get_prc_encrypted_pattern(
int
n)
const
;
51
52
INLINE
int
get_num_prc_executable_patterns()
const
;
53
INLINE
string
get_prc_executable_pattern(
int
n)
const
;
54
55
ConfigPage
*make_explicit_page(
const
string
&name);
56
bool
delete_explicit_page(
ConfigPage
*page);
57
58
INLINE
int
get_num_implicit_pages()
const
;
59
INLINE
ConfigPage
*get_implicit_page(
int
n)
const
;
60
61
INLINE
int
get_num_explicit_pages()
const
;
62
INLINE
ConfigPage
*get_explicit_page(
int
n)
const
;
63
64
void
output(ostream &out)
const
;
65
void
write(ostream &out)
const
;
66
67
static
ConfigPageManager
*get_global_ptr();
68
69
public
:
70
INLINE
void
mark_unsorted();
71
72
private
:
73
INLINE
void
check_sort_pages()
const
;
74
void
sort_pages();
75
76
bool
scan_auto_prc_dir(
Filename
&prc_dir)
const
;
77
bool
scan_up_from(
Filename
&result,
const
Filename
&dir,
78
const
Filename
&suffix)
const
;
79
80
void
config_initialized();
81
82
typedef
vector<ConfigPage *> Pages;
83
Pages _implicit_pages;
84
Pages _explicit_pages;
85
bool
_pages_sorted;
86
int
_next_page_seq;
87
88
bool
_loaded_implicit;
89
bool
_currently_loading;
90
91
DSearchPath
_search_path;
92
93
typedef
vector<GlobPattern> Globs;
94
Globs _prc_patterns;
95
Globs _prc_encrypted_patterns;
96
Globs _prc_executable_patterns;
97
98
// In load_implicit_pages(), we temporarily build up a list of
99
// potential config files to read and/or execute. We'll need some
100
// data structures to store that information.
101
enum
FileFlags {
102
FF_read = 0x001,
103
FF_execute = 0x002,
104
FF_decrypt = 0x004,
105
};
106
class
ConfigFile {
107
public
:
108
int
_file_flags;
109
Filename
_filename;
110
};
111
typedef
vector<ConfigFile> ConfigFiles;
112
113
static
ConfigPageManager
*_global_ptr;
114
};
115
116
INLINE ostream &operator << (ostream &out,
const
ConfigPageManager
&pageMgr);
117
118
#include "configPageManager.I"
119
120
#endif
ConfigFlags
This class is the base class of both ConfigVariable and ConfigVariableCore.
Definition:
configFlags.h:29
ConfigPageManager
A global object that maintains the set of ConfigPages everywhere in the world, and keeps them in sort...
Definition:
configPageManager.h:34
Filename
The name of a file, such as a texture file or an Egg file.
Definition:
filename.h:44
ConfigPage
A page of ConfigDeclarations that may be loaded or unloaded.
Definition:
configPage.h:33
DSearchPath
This class stores a list of directories that can be searched, in order, to locate a particular file...
Definition:
dSearchPath.h:32
Generated on Wed May 17 2017 23:39:31 for Panda3D by
1.8.13