Panda3D
|
A page of ConfigDeclarations that may be loaded or unloaded. More...
#include <pandadoc.hpp>
Public Member Functions | |
clear () | |
Removes all of the declarations from the page. | |
bool | deleteDeclaration (ConfigDeclaration decl) |
Removes the indicated declaration from the page and deletes it. | |
const ConfigDeclaration | getDeclaration (int n) |
Returns the nth declaration on the page. | |
str | getName () |
Returns the name of the page. | |
int | getNumDeclarations () |
Returns the number of declarations on the page. | |
int | getPageSeq () |
Returns the sequence number of the page. | |
str | getSignature () |
Returns the raw binary signature that was found in the prc file, if any. | |
int | getSort () |
Returns the explicit sort order of this particular ConfigPage. | |
str | getStringValue (int n) |
Returns the value assigned by the nth declaration on the page. | |
int | getTrustLevel () |
Returns the trust level associated with this page. | |
str | getVariableName (int n) |
Returns the variable named by the nth declaration on the page. | |
bool | isImplicit () |
Returns true if the page was loaded by implicitly searching the config path on startup, or false if it was explicitly loaded by dynamic code after initial startup. | |
bool | isSpecial () |
Returns true if this is the special "default" or "local" page, or false if it is an ordinary page, e.g. | |
bool | isVariableUsed (int n) |
Returns true if the nth active variable on the page has been used by code, false otherwise. | |
ConfigDeclaration | makeDeclaration (ConfigVariableCore variable, str value) |
Adds the indicated variable/value pair as a new declaration on the page. | |
ConfigDeclaration | makeDeclaration (str variable, str value) |
Adds the indicated variable/value pair as a new declaration on the page. | |
ConfigDeclaration | modifyDeclaration (int n) |
Returns a modifiable pointer to the nth declaration on the page. | |
output (Ostream out) | |
outputBriefSignature (Ostream out) | |
Outputs the first few hex digits of the signature. | |
bool | readEncryptedPrc (Istream in, str password) |
Automatically decrypts and reads the stream, given the indicated password. | |
bool | readPrc (Istream in) |
Reads the contents of a complete prc file, as returned by the indicated istream, into the current page file. | |
setSort (int sort) | |
Changes the explicit sort order of this particular ConfigPage. | |
setTrustLevel (int trust_level) | |
Explicitly sets the trust level on this particular page. | |
write (Ostream out) | |
Static Public Member Functions | |
static ConfigPage | getDefaultPage () |
Returns a pointer to the global "default page". | |
static ConfigPage | getLocalPage () |
Returns a pointer to the global "local page". | |
Public Attributes | |
ConfigDeclaration | declarations [] |
Returns a modifiable pointer to the nth declaration on the page. | |
bool | implicit |
Returns true if the page was loaded by implicitly searching the config path on startup, or false if it was explicitly loaded by dynamic code after initial startup. | |
const String | name |
Returns the name of the page. | |
int | page_seq |
Returns the sequence number of the page. | |
const String | signature |
Returns the raw binary signature that was found in the prc file, if any. | |
int | sort |
Returns the explicit sort order of this particular ConfigPage. | |
bool | special |
Returns true if this is the special "default" or "local" page, or false if it is an ordinary page, e.g. | |
int | trust_level |
Returns the trust level associated with this page. | |
A page of ConfigDeclarations that may be loaded or unloaded.
Typically this represents a single .prc file that is read from disk at runtime, but it may also represent a list of declarations built up by application code and explicitly loaded.
clear | ( | ) |
Removes all of the declarations from the page.
bool deleteDeclaration | ( | ConfigDeclaration | decl | ) |
Removes the indicated declaration from the page and deletes it.
Returns true if the declaration is successfully removed, false if it was not on the page.
const ConfigDeclaration getDeclaration | ( | int | n | ) |
Returns the nth declaration on the page.
|
static |
Returns a pointer to the global "default page".
This is the ConfigPage that lists all variables' original default values.
|
static |
Returns a pointer to the global "local page".
This is the ConfigPage that lists the locally-assigned values for any variables in the world that have such a local assignment.
str getName | ( | ) |
Returns the name of the page.
If the page was loaded from a .prc file, this is usually the filename.
int getNumDeclarations | ( | ) |
Returns the number of declarations on the page.
int getPageSeq | ( | ) |
Returns the sequence number of the page.
Sequence numbers for a particular class (implicit vs. explicit) of pages are assigned as each page is loaded; each page is given a higher sequence number than all the pages loaded before it.
The implicit_load pages, which are discovered in the file system automatically, have a different set of sequence numbers than the explicit pages.
str getSignature | ( | ) |
Returns the raw binary signature that was found in the prc file, if any.
This method is probably not terribly useful for most applications.
int getSort | ( | ) |
Returns the explicit sort order of this particular ConfigPage.
See set_sort().
str getStringValue | ( | int | n | ) |
Returns the value assigned by the nth declaration on the page.
int getTrustLevel | ( | ) |
Returns the trust level associated with this page.
An untrusted page is trust level 0; if the page was loaded from a signed .prc file, its trust level is the index number of the certificate that signed it. Generally, a higher trust level value represents a greater level of trust.
str getVariableName | ( | int | n | ) |
Returns the variable named by the nth declaration on the page.
bool isImplicit | ( | ) |
Returns true if the page was loaded by implicitly searching the config path on startup, or false if it was explicitly loaded by dynamic code after initial startup.
bool isSpecial | ( | ) |
Returns true if this is the special "default" or "local" page, or false if it is an ordinary page, e.g.
an implicit page loaded from a prc file at startup, or an explicit page created by ConfigPageManager::make_explicit_page().
bool isVariableUsed | ( | int | n | ) |
Returns true if the nth active variable on the page has been used by code, false otherwise.
ConfigDeclaration makeDeclaration | ( | ConfigVariableCore | variable, |
str | value ) |
Adds the indicated variable/value pair as a new declaration on the page.
ConfigDeclaration makeDeclaration | ( | str | variable, |
str | value ) |
Adds the indicated variable/value pair as a new declaration on the page.
ConfigDeclaration modifyDeclaration | ( | int | n | ) |
Returns a modifiable pointer to the nth declaration on the page.
Any modifications will appear in the output, if the page is written out with ConfigPage::write().
output | ( | Ostream | out | ) |
outputBriefSignature | ( | Ostream | out | ) |
Outputs the first few hex digits of the signature.
bool readEncryptedPrc | ( | Istream | in, |
str | password ) |
Automatically decrypts and reads the stream, given the indicated password.
Note that if the password is incorrect, the result may be garbage.
bool readPrc | ( | Istream | in | ) |
Reads the contents of a complete prc file, as returned by the indicated istream, into the current page file.
Returns true on success, or false on some I/O error.
This is a low-level interface. Normally you do not need to call it directly. See the global functions load_prc_file() and unload_prc_file(), defined in panda/src/putil, for a higher-level interface.
setSort | ( | int | sort | ) |
Changes the explicit sort order of this particular ConfigPage.
Lower- numbered pages supercede higher-numbered pages. Initially, all explicitly- loaded pages have sort value 0, and implicitly-loaded pages (found on disk) have sort value 10; you may set an individual page higher or lower to influence its priority relative to other pages.
setTrustLevel | ( | int | trust_level | ) |
Explicitly sets the trust level on this particular page.
Note that any subsequent changes to the page, or to any variable declarations on it, will reset the trust level to zero.
write | ( | Ostream | out | ) |
ConfigDeclaration declarations[] |
Returns a modifiable pointer to the nth declaration on the page.
Any modifications will appear in the output, if the page is written out with ConfigPage::write().
bool implicit |
Returns true if the page was loaded by implicitly searching the config path on startup, or false if it was explicitly loaded by dynamic code after initial startup.
const String name |
Returns the name of the page.
If the page was loaded from a .prc file, this is usually the filename.
int page_seq |
Returns the sequence number of the page.
Sequence numbers for a particular class (implicit vs. explicit) of pages are assigned as each page is loaded; each page is given a higher sequence number than all the pages loaded before it.
The implicit_load pages, which are discovered in the file system automatically, have a different set of sequence numbers than the explicit pages.
const String signature |
Returns the raw binary signature that was found in the prc file, if any.
This method is probably not terribly useful for most applications.
int sort |
Returns the explicit sort order of this particular ConfigPage.
See set_sort().
bool special |
Returns true if this is the special "default" or "local" page, or false if it is an ordinary page, e.g.
an implicit page loaded from a prc file at startup, or an explicit page created by ConfigPageManager::make_explicit_page().
int trust_level |
Returns the trust level associated with this page.
An untrusted page is trust level 0; if the page was loaded from a signed .prc file, its trust level is the index number of the certificate that signed it. Generally, a higher trust level value represents a greater level of trust.