Panda3D
load_prc_file.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file load_prc_file.h
10  * @author drose
11  * @date 2004-10-22
12  */
13 
14 #ifndef LOAD_PRC_FILE_H
15 #define LOAD_PRC_FILE_H
16 
17 #include "pandabase.h"
18 #include "filename.h"
19 
20 class ConfigPage;
21 class HashVal;
22 
23 BEGIN_PUBLISH
24 /**
25  * A convenience function for loading explicit prc files from a disk file or
26  * from within a multifile (via the virtual file system). Save the return
27  * value and pass it to unload_prc_file() if you ever want to unload this file
28  * later.
29  *
30  * The filename is first searched along the default prc search path, and then
31  * also along the model path, for convenience.
32  *
33  * This function is defined in putil instead of in dtool with the read of the
34  * prc stuff, so that it can take advantage of the virtual file system (which
35  * is defined in express), and the model path (which is in putil).
36  */
37 EXPCL_PANDA_PUTIL ConfigPage *
38 load_prc_file(const Filename &filename);
39 
40 /**
41  * Another convenience function to load a prc file from an explicit string,
42  * which represents the contents of the prc file.
43  *
44  * The first parameter is an arbitrary name to assign to this in-memory prc
45  * file. Supply a filename if the data was read from a file, or use any other
46  * name that is meaningful to you. The name is only used when the set of
47  * loaded prc files is listed.
48  */
49 EXPCL_PANDA_PUTIL ConfigPage *
50 load_prc_file_data(const std::string &name, const std::string &data);
51 
52 /**
53  * Unloads (and deletes) a ConfigPage that represents a prc file that was
54  * previously loaded by load_prc_file(). Returns true if successful, false if
55  * the file was unknown.
56  *
57  * After this function has been called, the ConfigPage pointer is no longer
58  * valid and should not be used again.
59  */
60 EXPCL_PANDA_PUTIL bool
62 
63 #ifdef HAVE_OPENSSL
64 
65 /**
66  * Fills HashVal with the hash from the current prc file state as reported by
67  * ConfigVariableManager::write_prc_variables().
68  */
69 EXPCL_PANDA_PUTIL void
70 hash_prc_variables(HashVal &hash);
71 
72 #endif // HAVE_OPENSSL
73 
74 
75 END_PUBLISH
76 
77 #endif
EXPCL_PANDA_PUTIL ConfigPage * load_prc_file_data(const std::string &name, const std::string &data)
Another convenience function to load a prc file from an explicit string, which represents the content...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Stores a 128-bit value that represents the hashed contents (typically MD5) of a file or buffer.
Definition: hashVal.h:31
BEGIN_PUBLISH EXPCL_PANDA_PUTIL ConfigPage * load_prc_file(const Filename &filename)
A convenience function for loading explicit prc files from a disk file or from within a multifile (vi...
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
EXPCL_PANDA_PUTIL bool unload_prc_file(ConfigPage *page)
Unloads (and deletes) a ConfigPage that represents a prc file that was previously loaded by load_prc_...
A page of ConfigDeclarations that may be loaded or unloaded.
Definition: configPage.h:30