# panda3d.core.ConfigDeclaration¶

from panda3d.core import ConfigDeclaration

class ConfigDeclaration

Bases: ConfigFlags

A single declaration of a config variable, typically defined as one line in a .prc file, e.g. “show-frame-rate-meter 1”. This is really just a pairing of a string name (actually, a ConfigVariableCore pointer) to a string value.

Inheritance diagram

getPage() → ConfigPage

Returns the page on which this declaration can be found.

Return type

ConfigPage

getVariable() → ConfigVariableCore

Returns the variable that this declaration names. This variable may or may not have been defined by the time the declaration is read.

Return type

ConfigVariableCore

getStringValue() → str

Returns the value assigned to this variable. This is the original one-line text defined for the variable in the .prc file (or passed to ConfigPage.makeDeclaration()).

setStringValue(value: str) → None

Changes the value assigned to this variable.

getNumWords() → size_t

Returns the number of words in the declaration’s value. A word is defined as a sequence of non-whitespace characters delimited by whitespace.

Return type

size_t

hasStringWord(n: size_t) → bool

Returns true if the declaration’s value has a valid string value for the nth word. This is really the same thing as asking if there are at least n words in the value.

hasBoolWord(n: size_t) → bool

Returns true if the declaration’s value has a valid boolean value for the nth word.

hasIntWord(n: size_t) → bool

Returns true if the declaration’s value has a valid integer value for the nth word.

hasInt64Word(n: size_t) → bool

Returns true if the declaration’s value has a valid int64 value for the nth word.

hasDoubleWord(n: size_t) → bool

Returns true if the declaration’s value has a valid integer value for the nth word.

getStringWord(n: size_t) → str

Returns the string value of the nth word of the declaration’s value, or empty string if there is no nth value. See also hasStringWord().

getBoolWord(n: size_t) → bool

Returns the boolean value of the nth word of the declaration’s value, or false if there is no nth value. See also hasBoolWord().

getIntWord(n: size_t) → int

Returns the integer value of the nth word of the declaration’s value, or 0 if there is no nth value. See also hasIntWord().

getInt64Word(n: size_t) → int64_t

Returns the int64 value of the nth word of the declaration’s value, or 0 if there is no nth value. See also hasInt64Word().

Return type

int64_t

getDoubleWord(n: size_t) → float

Returns the integer value of the nth word of the declaration’s value, or 0 if there is no nth value. See also hasDoubleWord().

setStringWord(n: size_t, value: str) → None

Changes the nth word to the indicated value without affecting the other words.

setBoolWord(n: size_t, value: bool) → None

Changes the nth word to the indicated value without affecting the other words.

setIntWord(n: size_t, value: int) → None

Changes the nth word to the indicated value without affecting the other words.

setInt64Word(n: size_t, value: int64_t) → None

Changes the nth word to the indicated value without affecting the other words.

setDoubleWord(n: size_t, value: float) → None

Changes the nth word to the indicated value without affecting the other words.

getFilenameValue() → Filename

Interprets the string value as a filename and returns it, with any variables expanded.

Return type

Filename

getDeclSeq() → int

Returns the sequence number of the declaration within the page. Sequence numbers are assigned as each declaration is created; each declaration is given a higher sequence number than all the declarations created in the page before it.

output(out: ostream) → None
write(out: ostream) → None
property page

Returns the page on which this declaration can be found.

Return type

ConfigPage

property variable

Returns the variable that this declaration names. This variable may or may not have been defined by the time the declaration is read.

Return type

ConfigVariableCore