Panda3D
 All Classes Functions Variables Enumerations
load_prc_file.h
1 // Filename: load_prc_file.h
2 // Created by: drose (22Oct04)
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 LOAD_PRC_FILE_H
16 #define LOAD_PRC_FILE_H
17 
18 #include "pandabase.h"
19 #include "filename.h"
20 
21 class ConfigPage;
22 class HashVal;
23 
24 BEGIN_PUBLISH
25 ////////////////////////////////////////////////////////////////////
26 // Function: load_prc_file
27 // Description: A convenience function for loading explicit prc files
28 // from a disk file or from within a multifile (via the
29 // virtual file system). Save the return value and pass
30 // it to unload_prc_file() if you ever want to unload
31 // this file later.
32 //
33 // The filename is first searched along the default prc
34 // search path, and then also along the model path, for
35 // convenience.
36 //
37 // This function is defined in putil instead of in dtool
38 // with the read of the prc stuff, so that it can take
39 // advantage of the virtual file system (which is
40 // defined in express), and the model path (which is in
41 // putil).
42 ////////////////////////////////////////////////////////////////////
43 EXPCL_PANDA_PUTIL ConfigPage *
44 load_prc_file(const Filename &filename);
45 
46 ////////////////////////////////////////////////////////////////////
47 // Function: load_prc_file_data
48 // Description: Another convenience function to load a prc file from
49 // an explicit string, which represents the contents of
50 // the prc file.
51 //
52 // The first parameter is an arbitrary name to assign to
53 // this in-memory prc file. Supply a filename if the
54 // data was read from a file, or use any other name that
55 // is meaningful to you. The name is only used when the
56 // set of loaded prc files is listed.
57 ////////////////////////////////////////////////////////////////////
58 EXPCL_PANDA_PUTIL ConfigPage *
59 load_prc_file_data(const string &name, const string &data);
60 
61 ////////////////////////////////////////////////////////////////////
62 // Function: unload_prc_file
63 // Description: Unloads (and deletes) a ConfigPage that represents a
64 // prc file that was previously loaded by
65 // load_prc_file(). Returns true if successful, false
66 // if the file was unknown.
67 //
68 // After this function has been called, the ConfigPage
69 // pointer is no longer valid and should not be used
70 // again.
71 ////////////////////////////////////////////////////////////////////
72 EXPCL_PANDA_PUTIL bool
73 unload_prc_file(ConfigPage *page);
74 
75 #ifdef HAVE_OPENSSL
76 
77 ////////////////////////////////////////////////////////////////////
78 // Function: hash_prc_variables
79 // Description: Fills HashVal with the hash from the current prc file
80 // state as reported by
81 // ConfigVariableManager::write_prc_variables().
82 ////////////////////////////////////////////////////////////////////
83 EXPCL_PANDA_PUTIL void
84 hash_prc_variables(HashVal &hash);
85 
86 #endif // HAVE_OPENSSL
87 
88 
89 END_PUBLISH
90 
91 #endif
Stores a 128-bit value that represents the hashed contents (typically MD5) of a file or buffer...
Definition: hashVal.h:32
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
A page of ConfigDeclarations that may be loaded or unloaded.
Definition: configPage.h:33