Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
NameKeyGenerator Class Reference

#include <NameKeyGenerator.h>

Inherits SubsystemInterface.

Public Member Functions

 NameKeyGenerator ()
 
virtual ~NameKeyGenerator ()
 
virtual void init ()
 
virtual void reset ()
 
virtual void update ()
 
NameKeyType nameToKey (const AsciiString &name)
 Given a string, convert into a unique integer key.
 
NameKeyType nameToLowercaseKey (const AsciiString &name)
 
NameKeyType nameToKey (const char *name)
 Given a string, convert into a unique integer key.
 
NameKeyType nameToLowercaseKey (const char *name)
 
AsciiString keyToName (NameKeyType key)
 
- Public Member Functions inherited from SubsystemInterface
 SubsystemInterface ()
 
virtual ~SubsystemInterface ()
 
virtual void postProcessLoad ()
 
virtual void draw (void)
 
void UPDATE (void)
 
void DRAW (void)
 
AsciiString getName (void)
 
void setName (AsciiString name)
 

Static Public Member Functions

static void parseStringAsNameKeyType (INI *ini, void *instance, void *store, const void *userData)
 

Additional Inherited Members

- Protected Attributes inherited from SubsystemInterface
AsciiString m_name
 

Detailed Description

This class implements the conversion of an arbitrary string into a unique integer "key". Calling the nameToKey() method with the same string is guaranteed to return the same key. Also, all keys generated by an instance of this class are guaranteed to be unique with respect to that instance's catalog of names. Multiple instances of this class can be created to service multiple namespaces.

Definition at line 85 of file NameKeyGenerator.h.

Constructor & Destructor Documentation

◆ NameKeyGenerator()

NameKeyGenerator::NameKeyGenerator ( )

Definition at line 37 of file NameKeyGenerator.cpp.

◆ ~NameKeyGenerator()

NameKeyGenerator::~NameKeyGenerator ( )
virtual

Definition at line 48 of file NameKeyGenerator.cpp.

Member Function Documentation

◆ init()

void NameKeyGenerator::init ( )
virtual
  • Assign any default values to data required for the class
    • Allocate any memory and resources needed throughout the lifetime of the class

Implements SubsystemInterface.

Definition at line 57 of file NameKeyGenerator.cpp.

◆ keyToName()

AsciiString NameKeyGenerator::keyToName ( NameKeyType key)

given a key, return the name. this is almost never needed, except for a few rare cases like object serialization. also note that it's not particularly fast; it does a dumb linear search for the key.

Definition at line 112 of file NameKeyGenerator.cpp.

◆ nameToKey() [1/2]

NameKeyType NameKeyGenerator::nameToKey ( const AsciiString & name)
inline

Given a string, convert into a unique integer key.

Definition at line 98 of file NameKeyGenerator.h.

◆ nameToKey() [2/2]

NameKeyType NameKeyGenerator::nameToKey ( const char * name)

Given a string, convert into a unique integer key.

Definition at line 126 of file NameKeyGenerator.cpp.

◆ nameToLowercaseKey() [1/2]

NameKeyType NameKeyGenerator::nameToLowercaseKey ( const AsciiString & name)
inline

Definition at line 99 of file NameKeyGenerator.h.

◆ nameToLowercaseKey() [2/2]

NameKeyType NameKeyGenerator::nameToLowercaseKey ( const char * name)

Definition at line 174 of file NameKeyGenerator.cpp.

◆ parseStringAsNameKeyType()

void NameKeyGenerator::parseStringAsNameKeyType ( INI * ini,
void * instance,
void * store,
const void * userData )
static

Definition at line 224 of file NameKeyGenerator.cpp.

◆ reset()

void NameKeyGenerator::reset ( )
virtual
  • Any system should be able to reset all data and go back to an empty state that is ready to accept a completely new set of data. Reset() can expect to be used in the context of resetting the engine in order to start or load a new game.
    • Do NOT free and re-allocate resources needed, where possible reorganize and re-initialize the resources already allocated.
    • After a reset, the system does not need to be in EXACTLY the same state as a fresh instantiation. If there are persistent state information for the system make sure you maintain it while restoring or re-initializing other transient parts.

Implements SubsystemInterface.

Definition at line 68 of file NameKeyGenerator.cpp.

◆ update()

virtual void NameKeyGenerator::update ( )
inlinevirtual
  • Update methods are the place to do system per frame processing. You should call the system update once each time through the game loop to service the system.
    • Note that currently the GameClient and GameLogic will be updating at different rates where the logic is running real time, and the client will adjust how many loops can be done during one server time slice in order to improve performance on low end machines.

Implements SubsystemInterface.

Definition at line 95 of file NameKeyGenerator.h.


The documentation for this class was generated from the following files: