Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

TItemPack Class Reference

TItemPack saves the type of an item and the amount. More...

#include <shipdesign.h>

Collaboration diagram for TItemPack:

Collaboration graph
[legend]
List of all members.

Public Methods

 TItemPack ()
 TItemPack (const TItemPack &OldItemPack)
 ~TItemPack ()
void setItem (TItem *Item)
TItemgetItem () const
void setItemAmount (int2 ItemAmount)
int2 getItemAmount () const
bool operator== (const TItemPack &ItemPack) const
TItemPack & operator= (const TItemPack &ItemPack)
bool load (TDataPackageList *in, const string &sIdentifier, bool bUnique=true)
bool save (TDataPackageList *out, const string &sIdentifier, bool bUnique=true) const

Protected Attributes

TLink< TItemfItemLink
int2 fItemAmount

Detailed Description

TItemPack saves the type of an item and the amount.

Author:
Ralf Laue
Version:
Id:
shipdesign.h,v 1.20 2002/04/25 22:21:13 prolator Exp
See also:
TItem
The class TItemPack saves the type and the amount of an item on a ship design. The list of TShipDesign which saves all the equipment, consists of elements of TItemPack. TItemPack has only a link to the type of the item, an integer variable for the amount and the basic methods. The is mainly for communicating the item lists on a ship (method TShipDesign::getItemList)


Constructor & Destructor Documentation

TItemPack::TItemPack  
 

This constructor creates a new TItemPack object with the link and the amount reseted. That means the link and the amount have to be set afterwards.

TItemPack::TItemPack const TItemPack &    OldItemPack
 

This constructor creates also a new TItemPack objet, but the values are copied from the TItemPack object given as parameter. This is the copy constructor.

Parameters:
OldItemPack  the item pack which shall be copied

TItemPack::~TItemPack  
 

Destructs the object. Has nothing else to do, because no memory has to be freed or similar stuff.


Member Function Documentation

TItem* TItemPack::getItem   const
 

With the method getItem you can get the link to the item type this item pack contains an item of.

Returns:
a pointer to the item this pack is of

int2 TItemPack::getItemAmount   const
 

With the method getItemAmount you can get the amount of items in this item pack.

Returns:
the amount of items in the itme pack

bool TItemPack::load TDataPackageList   in,
const string &    sIdentifier,
bool    bUnique = true
 

With the method Load you can load a TItemPack object from the data packages in the list. For more information look in the documentation of TLinkable.

Parameters:
in  the list of data packages
sIdentifier  the string this item pack is saved under
bUnique  bool value whether the indentifiers have to be unique
Returns:
true means that everything was loaded correctly, otherwise this method will return false.
See also:
TLinkable

TItemPack& TItemPack::operator= const TItemPack &    ItemPack
 

This is the assignment operator for TItemPack.

bool TItemPack::operator== const TItemPack &    ItemPack const
 

With the method operator== you can compare two TItemPack objects. This is of course the expected behaviour of "operator==".

Parameters:
ItemPack  the TItemPack object which to be compared with "*this"
Returns:
true if the TItemPack objects are equal, false if not

bool TItemPack::save TDataPackageList   out,
const string &    sIdentifier,
bool    bUnique = true
const
 

With the method Save you can save a TItemPack object from the data packages in the list. For more information look in the documentation of TLinkable.

Parameters:
in  the list of data packages
sIdentifier  the string this item pack is to be saved under
bUnique  bool value whether the indentifiers have to be unique
Returns:
true means that everything was saved correctly, otherwise this method will return false.
See also:
TLinkable

void TItemPack::setItem TItem   Item
 

With the method setItem you can set the link to the item type this item pack should contain an item of.

Parameters:
Item  a pointer to the new item this pack should be of

void TItemPack::setItemAmount int2    ItemAmount
 

With the method setItemAmount you can set the amount of items represented through this item pack.

Parameters:
ItemAmount  the new amount of items in this item pack


Member Data Documentation

int2 TItemPack::fItemAmount [protected]
 

the amount of items this item pack contains

TLink<TItem> TItemPack::fItemLink [protected]
 

the link to the item this item pack contains items of


The documentation for this class was generated from the following file:
Generated on Thu Jun 20 18:13:24 2002 for Stellar Legacy by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001