jjBEHAVIOR class by value JJ2+
What drives an object every tick
A small value type that holds exactly one of three things: a built-in BEHAVIOR::Behavior constant, a script function matching jjVOIDFUNCOBJ, or an instance of a script class implementing jjBEHAVIORINTERFACE. It is mainly met as jjOBJ::behavior and as an argument of jjOBJ::behave(). Assignment, comparison and conversion operators accept each form, so the type rarely has to be named explicitly. A held function or object is kept alive for as long as the behavior holds it.
Constructors
- jjBEHAVIOR() C++
- Creates a behavior holding BEHAVIOR::INACTIVE
- jjBEHAVIOR(const BEHAVIOR::Behavior&in behavior) C++
- Creates a behavior holding the given built-in behavior
Operators
- jjBEHAVIOR& opAssign(const jjBEHAVIOR&in other) = C++
- Copies another behavior into this one
- jjBEHAVIOR& opAssign(BEHAVIOR::Behavior other) = C++
- Makes this behavior a built-in one, dropping a held function or object
- jjBEHAVIOR& opAssign(jjVOIDFUNCOBJ@+ other) = C++
- Makes this behavior a script function, dropping a held built-in behavior or object
- jjBEHAVIOR& opAssign(jjBEHAVIORINTERFACE@+ other) = C++
- Makes this behavior a jjBEHAVIORINTERFACE instance, dropping a held built-in behavior or function
- jjVOIDFUNCOBJ@+ opCast() const cast
- Casts to the held script function
- BEHAVIOR::Behavior opConv() const conversion
- bool opEquals(const jjBEHAVIOR&in other) const == C++
- Whether both behaviors hold the same built-in behavior, function or object
- bool opEquals(BEHAVIOR::Behavior other) const == C++
- Whether this behavior is the given built-in behavior (never true while it holds a function or object)
- bool opEquals(const jjVOIDFUNCOBJ@+ other) const == C++
- Whether this behavior holds the given script function
Operator documentation
jjVOIDFUNCOBJ@+ jjBEHAVIOR:: opCast() const cast
Casts to the held script function
Gives null when the behavior holds a built-in behavior or a jjBEHAVIORINTERFACE instance.