ConsoleObject Class Reference#include <consoleObject.h>
Inheritance diagram for ConsoleObject:
[legend]
Detailed Description
Interface class to the console.
The Basics
Any object which you want to work with the console system should derive from this, and access functionality through the static interface.
This class is always used with the DECLARE_CONOBJECT and IMPLEMENT_* macros.
That's all you need to do to get a class registered with the console system. At this point, you can instantiate it via script, tie methods to it using ConsoleMethod, register fields, and so forth. You can also register any global variables related to the class by creating a consoleInit() method.
You will need to use different IMPLEMENT_ macros in different cases; for instance, if you are making a NetObject (for ghosting), a DataBlock, or a NetEvent.
- See also:
- AbstractClassRep for gory implementation details.
|
Field List |
const AbstractClassRep::FieldList & | getFieldList () const |
| Get a list of all the fields. This information cannot be modified.
|
AbstractClassRep::FieldList & | getModifiableFieldList () |
| Get a list of all the fields, set up so we can modify them.
|
bool & | getDynamicGroupExpand () |
| Get a handle to a boolean telling us if we expanded the dynamic group.
|
ConsoleObject Implementation |
These functions are implemented in every subclass of ConsoleObject by an IMPLEMENT_CONOBJECT or IMPLEMENT_CO_* macro.
|
S32 | getClassId (U32 netClassGroup) const |
| Get our network-layer class id.
|
const char * | getClassName () const |
| Get our compiler and platform independent class name.
|
static AbstractClassRep * | getStaticClassRep () |
| Get the abstract class information for this class.
|
static AbstractClassRep * | getParentStaticClassRep () |
| Get the abstract class information for this class's superclass.
|
Object Creation |
static ConsoleObject * | create (const char *in_pClassName) |
static ConsoleObject * | create (const U32 groupId, const U32 typeId, const U32 in_classId) |
Fields |
static void | addGroup (const char *in_pGroupname, const char *in_pGroupDocs=NULL) |
| Mark the beginning of a group of fields.
|
static void | endGroup (const char *in_pGroupname) |
| Mark the end of a group of fields.
|
static void | addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL) |
| Register a complex field.
|
static void | addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, const char *in_pFieldDocs) |
| Register a simple field.
|
static void | addFieldV (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, TypeValidator *v, const char *in_pFieldDocs=NULL) |
| Register a validated field.
|
static void | addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL) |
| Register a complex protected field.
|
static void | addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, const char *in_pFieldDocs=NULL) |
| Register a simple protected field.
|
static void | addDepricatedField (const char *fieldName) |
| Add a deprecated field.
|
static bool | removeField (const char *in_pFieldname) |
| Remove a field.
|
Public Member Functions |
virtual AbstractClassRep * | getClassRep () const |
| Gets the ClassRep.
|
bool | setField (const char *fieldName, const char *value) |
| Set the value of a field.
|
virtual | ~ConsoleObject () |
Static Public Member Functions |
static const char * | lookupClassName (const U32 in_classTag) |
| Get the classname from a class tag.
|
static void | initPersistFields () |
| Register dynamic fields in a subclass of ConsoleObject.
|
static void | consoleInit () |
| Register global constant variables and do other one-time initialization tasks in a subclass of ConsoleObject.
|
Protected Member Functions |
| ConsoleObject () |
| ConsoleObject (const ConsoleObject &) |
const AbstractClassRep::Field * | findField (StringTableEntry fieldName) const |
| Get a reference to a field by name.
|
Constructor & Destructor Documentation
ConsoleObject::ConsoleObject |
( |
|
) |
[inline, protected] |
ConsoleObject::ConsoleObject |
( |
const ConsoleObject & |
|
) |
[protected] |
virtual ConsoleObject::~ConsoleObject |
( |
|
) |
[virtual] |
Member Function Documentation
Get a reference to a field by name.
bool ConsoleObject::setField |
( |
const char * |
fieldName, |
|
|
const char * |
value | |
|
) |
| | [inline] |
Set the value of a field.
ConsoleObject * ConsoleObject::create |
( |
const char * |
in_pClassName |
) |
[inline, static] |
ConsoleObject * ConsoleObject::create |
( |
const U32 |
groupId, |
|
|
const U32 |
typeId, |
|
|
const U32 |
in_classId | |
|
) |
| | [inline, static] |
static const char* ConsoleObject::lookupClassName |
( |
const U32 |
in_classTag |
) |
[static] |
Get the classname from a class tag.
static void ConsoleObject::addGroup |
( |
const char * |
in_pGroupname, |
|
|
const char * |
in_pGroupDocs = NULL | |
|
) |
| | [static, protected] |
Mark the beginning of a group of fields.
This is used in the consoleDoc system. - See also:
- console_autodoc
static void ConsoleObject::endGroup |
( |
const char * |
in_pGroupname |
) |
[static, protected] |
Mark the end of a group of fields.
This is used in the consoleDoc system. - See also:
- console_autodoc
static void ConsoleObject::addField |
( |
const char * |
in_pFieldname, |
|
|
const U32 |
in_fieldType, |
|
|
const dsize_t |
in_fieldOffset, |
|
|
const U32 |
in_elementCount = 1 , |
|
|
EnumTable * |
in_table = NULL , |
|
|
const char * |
in_pFieldDocs = NULL | |
|
) |
| | [static, protected] |
Register a complex field.
- Parameters:
-
| in_pFieldname | Name of the field. |
| in_fieldType | Type of the field. |
- See also:
- ConsoleDynamicTypes
- Parameters:
-
| in_fieldOffset | Offset to the field from the start of the class; calculated using the Offset() macro. |
| in_elementCount | Number of elements in this field. Arrays of elements are assumed to be contiguous in memory. |
| in_table | An EnumTable, if this is an enumerated field. |
| in_pFieldDocs | Usage string for this field. |
- See also:
- console_autodoc
static void ConsoleObject::addField |
( |
const char * |
in_pFieldname, |
|
|
const U32 |
in_fieldType, |
|
|
const dsize_t |
in_fieldOffset, |
|
|
const char * |
in_pFieldDocs | |
|
) |
| | [static, protected] |
Register a simple field.
- Parameters:
-
| in_pFieldname | Name of the field. |
| in_fieldType | Type of the field. |
- See also:
- ConsoleDynamicTypes
- Parameters:
-
| in_fieldOffset | Offset to the field from the start of the class; calculated using the Offset() macro. |
| in_pFieldDocs | Usage string for this field. |
- See also:
- console_autodoc
static void ConsoleObject::addFieldV |
( |
const char * |
in_pFieldname, |
|
|
const U32 |
in_fieldType, |
|
|
const dsize_t |
in_fieldOffset, |
|
|
TypeValidator * |
v, |
|
|
const char * |
in_pFieldDocs = NULL | |
|
) |
| | [static, protected] |
Register a validated field.
A validated field is just like a normal field except that you can't have it be an array, and that you give it a pointer to a TypeValidator subclass, which is then used to validate any value placed in it. Invalid values are ignored and an error is printed to the console.
- See also:
- addField
typeValidators.h
Register a complex protected field.
- Parameters:
-
| in_pFieldname | Name of the field. |
| in_fieldType | Type of the field. |
- See also:
- ConsoleDynamicTypes
- Parameters:
-
| in_fieldOffset | Offset to the field from the start of the class; calculated using the Offset() macro. |
| in_setDataFn | When this field gets set, it will call the callback provided. |
- See also:
- console_protected
- Parameters:
-
| in_getDataFn | When this field is accessed for it's data, it will return the value of this function |
| in_elementCount | Number of elements in this field. Arrays of elements are assumed to be contiguous in memory. |
| in_table | An EnumTable, if this is an enumerated field. |
| in_pFieldDocs | Usage string for this field. |
- See also:
- console_autodoc
Register a simple protected field.
- Parameters:
-
| in_pFieldname | Name of the field. |
| in_fieldType | Type of the field. |
- See also:
- ConsoleDynamicTypes
- Parameters:
-
| in_fieldOffset | Offset to the field from the start of the class; calculated using the Offset() macro. |
| in_setDataFn | When this field gets set, it will call the callback provided. |
- See also:
- console_protected
- Parameters:
-
| in_getDataFn | When this field is accessed for it's data, it will return the value of this function |
| in_pFieldDocs | Usage string for this field. |
- See also:
- console_autodoc
static void ConsoleObject::addDepricatedField |
( |
const char * |
fieldName |
) |
[static, protected] |
Add a deprecated field.
A deprecated field will always be undefined, even if you assign a value to it. This is useful when you need to make sure that a field is not being used anymore.
static bool ConsoleObject::removeField |
( |
const char * |
in_pFieldname |
) |
[static, protected] |
Remove a field.
Sometimes, you just have to remove a field! - Returns:
- True on success.
static void ConsoleObject::initPersistFields |
( |
|
) |
[static] |
Register dynamic fields in a subclass of ConsoleObject.
- See also:
- addField(), addFieldV(), addDepricatedField(), addGroup(), endGroup()
Reimplemented in AudioEnvironment, AudioSampleEnvironment, AudioDescription, AudioProfile, ConsoleLogger, SimObject, EditTSCtrl, GuiTerrPreviewCtrl, MissionAreaEditor, TerrainEditor, WorldEditor, AudioEmitter, CameraData, Camera, DebrisData, Debris, FireballAtmosphereData, FireballAtmosphere, ExplosionData, Explosion, fxFoliageReplicator, fxLightData, fxLight, fxRenderObject, fxShapeReplicator, fxSunLight, LightningData, Lightning, ParticleEmitterNodeData, ParticleEmitterNode, ParticleData, ParticleEmitterData, PrecipitationData, Precipitation, SplashData, WeatherLightningData, WeatherLightning, GameBaseData, GameBase, ItemData, Item, MissionArea, MissionMarker, SpawnSphere, PathCameraData, PathCamera, PhysicalZone, PlayerData, ProjectileData, Projectile, RigidShapeData, RigidShape, ShapeBaseImageData, ShapeBaseData, StaticShapeData, StaticShape, Trigger, TSStatic, FlyingVehicleData, FlyingVehicle, HoverVehicleData, VehicleData, Vehicle, VehicleBlocker, WheeledVehicleTire, WheeledVehicleSpring, WheeledVehicleData, WheeledVehicle, GuiControlArrayControl, GuiFrameSetCtrl, GuiPaneControl, GuiScrollCtrl, GuiStackControl, GuiTabBookCtrl, GuiWindowCtrl, GuiBitmapButtonCtrl, GuiBitmapCtrl, GuiButtonBaseCtrl, GuiCheckBoxCtrl, GuiColorPickerCtrl, GuiConsoleEditCtrl, GuiConsoleTextCtrl, GuiListBoxCtrl, GuiMLTextCtrl, GuiMLTextEditCtrl, GuiPopUpMenuCtrl, GuiSliderCtrl, GuiTabPageCtrl, GuiTextCtrl, GuiTextEditCtrl, GuiTextEditSliderCtrl, GuiTextListCtrl, GuiTreeViewCtrl, GuiControl, GuiTSCtrl, GuiCursor, GuiControlProfile, GuiFilterCtrl, GuiInspectorGroup, GuiMenuBar, GuiAviBitmapCtrl, GuiMessageVectorCtrl, GuiTheoraCtrl, GuiMouseEventCtrl, MessageVector, InteriorInstance, InteriorMap, MirrorSubObject, PathedInteriorData, PathedInterior, sgLightObjectData, sgLightObject, sgMissionLightingFilterData, sgMissionLightingFilter, volumeLight, DecalData, NetObject, SceneObject, Path, Marker, Sky, Sun, TerrainBlock, WaterBlock, and TSShapeConstructor.
static void ConsoleObject::consoleInit |
( |
|
) |
[static] |
Register global constant variables and do other one-time initialization tasks in a subclass of ConsoleObject.
- Deprecated:
- You should use ConsoleMethod and ConsoleFunction, not this, to register methods or commands.
- See also:
- console
Reimplemented in EditTSCtrl, Camera, GameBase, GameConnection, Item, PathCameraData, PathCamera, Player, ShapeBase, GuiTSCtrl, GuiInspectorTypeEnum, GuiInspectorTypeCheckBox, GuiInspectorTypeGuiProfile, GuiInspectorTypeFileName, GuiInspectorTypeColorI, GuiInspectorTypeColorF, InteriorInstance, volumeLight, DecalManager, NetConnection, and Sky.
Get a list of all the fields. This information cannot be modified.
Get a list of all the fields, set up so we can modify them.
- Note:
- This is a bad trick to pull if you aren't very careful, since you can blast field data!
bool & ConsoleObject::getDynamicGroupExpand |
( |
|
) |
[inline] |
Get a handle to a boolean telling us if we expanded the dynamic group.
- See also:
- GuiInspector::Inspect()
Get the abstract class information for this class.
static AbstractClassRep* ConsoleObject::getParentStaticClassRep |
( |
|
) |
[inline, static] |
Get the abstract class information for this class's superclass.
S32 ConsoleObject::getClassId |
( |
U32 |
netClassGroup |
) |
const [inline] |
Get our network-layer class id.
- Parameters:
-
| netClassGroup | The net class for which we want our ID. |
- See also:
const char * ConsoleObject::getClassName |
( |
|
) |
const [inline] |
Get our compiler and platform independent class name.
- Note:
- This name can be used to instantiate another instance using create()
|