Panda3D
|
00001 // Filename: load_prc_file.h 00002 // Created by: drose (22Oct04) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef LOAD_PRC_FILE_H 00016 #define LOAD_PRC_FILE_H 00017 00018 #include "pandabase.h" 00019 #include "filename.h" 00020 00021 class ConfigPage; 00022 class HashVal; 00023 00024 BEGIN_PUBLISH 00025 //////////////////////////////////////////////////////////////////// 00026 // Function: load_prc_file 00027 // Description: A convenience function for loading explicit prc files 00028 // from a disk file or from within a multifile (via the 00029 // virtual file system). Save the return value and pass 00030 // it to unload_prc_file() if you ever want to unload 00031 // this file later. 00032 // 00033 // The filename is first searched along the default prc 00034 // search path, and then also along the model path, for 00035 // convenience. 00036 // 00037 // This function is defined in putil instead of in dtool 00038 // with the read of the prc stuff, so that it can take 00039 // advantage of the virtual file system (which is 00040 // defined in express), and the model path (which is in 00041 // putil). 00042 //////////////////////////////////////////////////////////////////// 00043 EXPCL_PANDA_PUTIL ConfigPage * 00044 load_prc_file(const Filename &filename); 00045 00046 //////////////////////////////////////////////////////////////////// 00047 // Function: load_prc_file_data 00048 // Description: Another convenience function to load a prc file from 00049 // an explicit string, which represents the contents of 00050 // the prc file. 00051 // 00052 // The first parameter is an arbitrary name to assign to 00053 // this in-memory prc file. Supply a filename if the 00054 // data was read from a file, or use any other name that 00055 // is meaningful to you. The name is only used when the 00056 // set of loaded prc files is listed. 00057 //////////////////////////////////////////////////////////////////// 00058 EXPCL_PANDA_PUTIL ConfigPage * 00059 load_prc_file_data(const string &name, const string &data); 00060 00061 //////////////////////////////////////////////////////////////////// 00062 // Function: unload_prc_file 00063 // Description: Unloads (and deletes) a ConfigPage that represents a 00064 // prc file that was previously loaded by 00065 // load_prc_file(). Returns true if successful, false 00066 // if the file was unknown. 00067 // 00068 // After this function has been called, the ConfigPage 00069 // pointer is no longer valid and should not be used 00070 // again. 00071 //////////////////////////////////////////////////////////////////// 00072 EXPCL_PANDA_PUTIL bool 00073 unload_prc_file(ConfigPage *page); 00074 00075 #ifdef HAVE_OPENSSL 00076 00077 //////////////////////////////////////////////////////////////////// 00078 // Function: hash_prc_variables 00079 // Description: Fills HashVal with the hash from the current prc file 00080 // state as reported by 00081 // ConfigVariableManager::write_prc_variables(). 00082 //////////////////////////////////////////////////////////////////// 00083 EXPCL_PANDA_PUTIL void 00084 hash_prc_variables(HashVal &hash); 00085 00086 #endif // HAVE_OPENSSL 00087 00088 00089 END_PUBLISH 00090 00091 #endif