This is a "wrapper" around a normal C++ variable. More...
#include "Variables.hpp"
Public Member Functions | |
VarT (const char *Name, const T &Value, const char *Flags[]=NULL) | |
The constructor. More... | |
const T & | Get () const |
Returns the value of this variable. More... | |
virtual void | Set (const T &v) |
Sets the value of this variable to the given value v . More... | |
virtual void | GetChoices (ArrayT< std::string > &Strings, ArrayT< T > &Values) const |
This method returns a list of acceptable input values for this variable, along with a string representation of each. More... | |
void | Serialize (Network::OutStreamT &Stream) const |
Stores the value of this variable in the given Stream. More... | |
void | Deserialize (Network::InStreamT &Stream) |
Restores the value of this variable from the given Stream. More... | |
void | accept (VisitorT &Visitor) |
void | accept (VisitorConstT &Visitor) const |
template<> | |
void | Serialize (cf::Network::OutStreamT &Stream) const |
Stores the value of this variable in the given Stream. More... | |
template<> | |
void | Serialize (cf::Network::OutStreamT &Stream) const |
Stores the value of this variable in the given Stream. More... | |
template<> | |
void | Serialize (cf::Network::OutStreamT &Stream) const |
Stores the value of this variable in the given Stream. More... | |
template<> | |
void | Serialize (cf::Network::OutStreamT &Stream) const |
Stores the value of this variable in the given Stream. More... | |
template<> | |
void | Deserialize (cf::Network::InStreamT &Stream) |
Restores the value of this variable from the given Stream. More... | |
template<> | |
void | Deserialize (cf::Network::InStreamT &Stream) |
Restores the value of this variable from the given Stream. More... | |
template<> | |
void | Deserialize (cf::Network::InStreamT &Stream) |
Restores the value of this variable from the given Stream. More... | |
template<> | |
void | Deserialize (cf::Network::InStreamT &Stream) |
Restores the value of this variable from the given Stream. More... | |
![]() | |
VarBaseT (const char *Name, const char *Flags[]) | |
const char * | GetName () const |
const char ** | GetFlags () const |
bool | HasFlag (const char *Flag) const |
const char * | GetFlag (const char *Flag, unsigned int Nr, const char *Default=NULL) const |
virtual std::string | GetExtraMessage () const |
Sometimes actions on variables generate extra messages that are relevant to the user. More... | |
This is a "wrapper" around a normal C++ variable.
It can be used in place of a normal variable whenever the functionality described in TypeSys Variables Overview is desired, for example in the member variables of component classes of game entities and GUI windows.
User code can derive from this class and override the Set() method in order to customize the behaviour.
|
inline |
The constructor.
|
virtual |
Restores the value of this variable from the given Stream.
See Serialize() for additional details.
Implements cf::TypeSys::VarBaseT.
|
virtual |
Restores the value of this variable from the given Stream.
See Serialize() for additional details.
Implements cf::TypeSys::VarBaseT.
|
virtual |
Restores the value of this variable from the given Stream.
See Serialize() for additional details.
Implements cf::TypeSys::VarBaseT.
|
virtual |
Restores the value of this variable from the given Stream.
See Serialize() for additional details.
Implements cf::TypeSys::VarBaseT.
|
virtual |
Restores the value of this variable from the given Stream.
See Serialize() for additional details.
Implements cf::TypeSys::VarBaseT.
|
inline |
Returns the value of this variable.
|
inlinevirtual |
This method returns a list of acceptable input values for this variable, along with a string representation of each.
The relevancy of the returned tuples is limited: They are intended to create helpful user interfaces in our graphical editors and to provide extra information in scripts, but if Set() is called with a value that is not in Values
, it will work and is not an error. If the method returns no tuples at all, it means that user input is free and any value is acceptable.
Reimplemented in cf::GuiSys::ComponentTextT::VarTextAlignVerT, cf::GameSys::ComponentMoverT::VarTrajFuncT, cf::GuiSys::ComponentTextT::VarTextAlignHorT, cf::GameSys::ComponentMoverT::VarOtherEntitiesT, cf::GameSys::ComponentMoverT::VarDestActivatedT, cf::GuiSys::ComponentTextT::VarFontNameT, and cf::GameSys::ComponentPointLightT::VarShadowTypeT.
|
virtual |
Stores the value of this variable in the given Stream.
An implementation may also store additional data, so that Deserialize() is able to recover from side- effects where restoring the value of the variable alone does not suffice. For example, consider the side-effects of setting a new model name in a ComponentModelT as described at VarT::Set(): restoring the previous model name will properly restore the internal model resource, but not undo any clamps or resets that setting the new name caused for the animation and skin numbers. Thus, the implementation of this method for the model name would also store the values of the affected sibling variables, so that Deserialize() can implement a proper restore / "undo".
Implements cf::TypeSys::VarBaseT.
|
virtual |
Stores the value of this variable in the given Stream.
An implementation may also store additional data, so that Deserialize() is able to recover from side- effects where restoring the value of the variable alone does not suffice. For example, consider the side-effects of setting a new model name in a ComponentModelT as described at VarT::Set(): restoring the previous model name will properly restore the internal model resource, but not undo any clamps or resets that setting the new name caused for the animation and skin numbers. Thus, the implementation of this method for the model name would also store the values of the affected sibling variables, so that Deserialize() can implement a proper restore / "undo".
Implements cf::TypeSys::VarBaseT.
|
virtual |
Stores the value of this variable in the given Stream.
An implementation may also store additional data, so that Deserialize() is able to recover from side- effects where restoring the value of the variable alone does not suffice. For example, consider the side-effects of setting a new model name in a ComponentModelT as described at VarT::Set(): restoring the previous model name will properly restore the internal model resource, but not undo any clamps or resets that setting the new name caused for the animation and skin numbers. Thus, the implementation of this method for the model name would also store the values of the affected sibling variables, so that Deserialize() can implement a proper restore / "undo".
Implements cf::TypeSys::VarBaseT.
|
virtual |
Stores the value of this variable in the given Stream.
An implementation may also store additional data, so that Deserialize() is able to recover from side- effects where restoring the value of the variable alone does not suffice. For example, consider the side-effects of setting a new model name in a ComponentModelT as described at VarT::Set(): restoring the previous model name will properly restore the internal model resource, but not undo any clamps or resets that setting the new name caused for the animation and skin numbers. Thus, the implementation of this method for the model name would also store the values of the affected sibling variables, so that Deserialize() can implement a proper restore / "undo".
Implements cf::TypeSys::VarBaseT.
|
virtual |
Stores the value of this variable in the given Stream.
An implementation may also store additional data, so that Deserialize() is able to recover from side- effects where restoring the value of the variable alone does not suffice. For example, consider the side-effects of setting a new model name in a ComponentModelT as described at VarT::Set(): restoring the previous model name will properly restore the internal model resource, but not undo any clamps or resets that setting the new name caused for the animation and skin numbers. Thus, the implementation of this method for the model name would also store the values of the affected sibling variables, so that Deserialize() can implement a proper restore / "undo".
Implements cf::TypeSys::VarBaseT.
|
inlinevirtual |
Sets the value of this variable to the given value v
.
Derived classes can override this method to add "side-effects", such as updating graphical resources. In some cases, side-effects can even affect other variables (siblings). For example, setting a new model name in ComponentModelT not only updates the internal (private) model resource, but it can also imply updates (resets or clamps) to the animation and skin number variables.
Reimplemented in cf::GuiSys::ComponentTextT::VarFontNameT.