libHSPlasma
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
plKeyData Class Reference

Contains plKey data. More...

#include <plKey.h>

Public Types

typedef std::function< void(hsKeyedObject *)> AfterLoadCallback

Public Member Functions

 plKeyData ()
 ~plKeyData ()
bool operator== (plKeyData &other) const
plString toString () const
void read (hsStream *S)
void write (hsStream *S)
void readUoid (hsStream *S)
void writeUoid (hsStream *S)
void prcWrite (pfPrcHelper *prc)
plUoidgetUoid ()
class hsKeyedObjectgetObj ()
void setObj (class hsKeyedObject *obj)
void deleteObj ()
short getType () const
const plStringgetName () const
const plLocationgetLocation () const
const plLoadMaskgetLoadMask () const
uint32_t getID () const
uint32_t getCloneID () const
uint32_t getClonePlayerID () const
uint32_t getFileOff () const
uint32_t getObjSize () const
void setType (short type)
void setName (const plString &name)
void setLocation (const plLocation &loc)
void setLoadMask (const plLoadMask &mask)
void setID (uint32_t id)
void setCloneIDs (uint32_t clone, uint32_t player)
void setFileOff (uint32_t off)
void setObjSize (uint32_t size)
void addCallback (const AfterLoadCallback &callback)
void clearCallbacks ()

Static Public Member Functions

static plKeyDataPrcParse (const pfPrcTag *tag)

Friends

class plKey

Detailed Description

Contains plKey data.

This class contains the actual description and pointers for hsKeyedObjects, and is used by plKey. You generally shouldn't use this class directly, but rather keep it contained in a plKey object, and use plKeyData's members through the plKey's overloaded pointer operators.

Member Typedef Documentation

typedef std::function<void (hsKeyedObject*)> plKeyData::AfterLoadCallback

Constructor & Destructor Documentation

plKeyData::plKeyData ( )

Construct key data for an empty object. The key will need to be filled in with meaningful data before it is useful.

plKeyData::~plKeyData ( )

Don't ever use this directly (i.e., don't ever allocate plKeyData objects on the stack). The key will be automatically deleted once its ref count is zero (meaning there are no more keys that own references to this KeyData).

Member Function Documentation

void plKeyData::addCallback ( const AfterLoadCallback callback)

Add callback to be called after referenced object is loaded. Callbacks added after object load will be executed immediately.

void plKeyData::clearCallbacks ( )

Remove all callbacks, without executing

void plKeyData::deleteObj ( )

Delete object referenced by this key.

uint32_t plKeyData::getCloneID ( ) const

Returns the Clone ID of this key (usually 0)

uint32_t plKeyData::getClonePlayerID ( ) const

Returns the Clone Player ID of this key (usually 0)

uint32_t plKeyData::getFileOff ( ) const

Returns the location in the PRP file where this key's data starts. This is not updated until the PRP file's key index is either read or written.

uint32_t plKeyData::getID ( ) const

Returns the numeric ID of the key; only meaningful for EoA, Hex Isle and MOUL

const plLoadMask& plKeyData::getLoadMask ( ) const

Returns the load mask of the object referenced by this key

const plLocation& plKeyData::getLocation ( ) const

Returns the location where this key and its object are stored

const plString& plKeyData::getName ( ) const

Returns the name of the object referenced by this key

class hsKeyedObject* plKeyData::getObj ( )

Returns a pointer to the object referenced by this key

uint32_t plKeyData::getObjSize ( ) const

Returns the total size of the object referenced by this key. This is not updated until the PRP file's key index is either read or written.

short plKeyData::getType ( ) const

Returns the Class Index of the object referenced by this key

plUoid& plKeyData::getUoid ( )

Returns the plUoid that describes the object

bool plKeyData::operator== ( plKeyData other) const

Compares the contents of this key to another to see if they are equivalent. This basically just calls the == operator on the plUoid (so storage information is not compared).

static plKeyData* plKeyData::PrcParse ( const pfPrcTag tag)
static

Parse a plKey tag from the PRC document into this structure. You generally shouldn't use this directly, but rather use the plResManager to parse keys.

See Also
prcWrite(), plResManager::prcParseKey()
void plKeyData::prcWrite ( pfPrcHelper prc)

Write a plKey tag describing this key into the PRC document. Unlike the other reading and writing functions, you can use this directly to write keys to PRC output.

See Also
PrcParse()
void plKeyData::read ( hsStream S)

Read a key directly from the key index of a PRP file. This will include the file offset and size where the hsKeyedObject is stored. You generally shouldn't use this directly, but rather use the plResManager to read keys.

See Also
write(), readUoid(), plResManager::ReadKey()
void plKeyData::readUoid ( hsStream S)

Read a key without the index information or exists bool directly from a stream. You generally shouldn't use this directly, but rather use the plResManager to read keys.

See Also
writeUoid(), read(), plResManager::ReadUoid()
void plKeyData::setCloneIDs ( uint32_t  clone,
uint32_t  player 
)

Sets the Clone IDs of the key.

void plKeyData::setFileOff ( uint32_t  off)

Set the file offset for the object pointed to by the key. This is done automatically by the plResManager when writing pages.

void plKeyData::setID ( uint32_t  id)

Sets the numeric ID of this key. This is handled automatically by the plResManager while managing keys, so you should never call this directly unless you are not using a ResManager.

void plKeyData::setLoadMask ( const plLoadMask mask)

Sets the load mask of this object and key. This can be done at any time.

void plKeyData::setLocation ( const plLocation loc)

Sets the location of this key and its object. Generally, you should not use this directly, but rather use the plResManager to manage a key's location.

See Also
plResManager::MoveKey(), plResManager::ChangeLocation()
void plKeyData::setName ( const plString name)

Sets the name of an object/key. This can be done at any time.

See Also
hsKeyedObject::init()
void plKeyData::setObj ( class hsKeyedObject obj)

Sets the object referenced by this key.

void plKeyData::setObjSize ( uint32_t  size)

Set the object size for the object pointed to by the key. This is done automatically by the plResManager when writing pages.

void plKeyData::setType ( short  type)

Sets the Class Index of the object referenced by this key. You should not use this directly, but rather call hsKeyedObject::init() to set up the key for an object.

See Also
hsKeyedObject::init()
plString plKeyData::toString ( ) const

Converts the key to a string. If the key is empty, returns "NULL", otherwise, returns the plUoid's string representation.

See Also
plUoid::toString()
void plKeyData::write ( hsStream S)

Write a key directly to the key index of a PRP file. This includes the file offset and size information for the hsKeyedObject. You generally shouldn't use this directly, but rather use the plResManager to write keys.

See Also
read(), writeUoid(), plResManager::WriteKey()
void plKeyData::writeUoid ( hsStream S)

Write a key without the index information or exists bool directly to a stream. You generally shouldn't use this directly, but rather use the plResManager to write keys.

See Also
readUoid(), write(), plResManager::WriteUoid()

Friends And Related Function Documentation

friend class plKey
friend

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