skillEntry Class Reference

#include <skill-entry.hpp>

Inheritance diagram for skillEntry:

Inheritance graph
[legend]
Collaboration diagram for skillEntry:

Collaboration graph
[legend]
List of all members.

Detailed Description

This is yet another linked list implementation within this library. This one in particular carries a list of skills and their relative level values.

Each node has three values: a string representing the skill, an integer value for the level attained for that skill and a pointer to the next skill in the list.

See also:
skillList
Todo:
centralize all skill types as a set of classes and a sparse array

using a class based skill implementation, implement cascading skills properly.

Definition at line 42 of file skill-entry.hpp.

Public Member Functions

 skillEntry ()
 skillEntry (char *)
 skillEntry (char *, int)
skillEntrygetNext ()
void setNext (skillEntry *)
char * getSkill ()
void setSkill (char *)
int getLevel ()
void setLevel (int)
char * toString ()
void XMLout (FILE *fout)


Constructor & Destructor Documentation

skillEntry::skillEntry (  ) 

Non parametized constructor.

Definition at line 49 of file skill-entry.cpp.

00049                       {
00050         level=0;
00051         skill = (char*)0;
00052         
00053 }

skillEntry::skillEntry ( char *   ) 

Create a new skill entry named with the passed in string and assign it a level of 1.

Parameters:
(char*) pointer to a string representing the skill being added.

Definition at line 55 of file skill-entry.cpp.

00055                              {
00056         
00057         skill=(char*)malloc(strlen(s)+1);
00058         sprintf(skill,"%s",s);
00059         level=1;
00060 }

skillEntry::skillEntry ( char *  ,
int   
)

Create a new skill entry with the name an level as passed.

Parameters:
(char*) pointer to a string representing the skill being added.
int -- integer value for the level to assign to that skill.

Definition at line 62 of file skill-entry.cpp.

00062                                    {
00063         level = l;
00064         
00065         skill = (char*) malloc(strlen(s)+1);
00066         sprintf(skill,"%s",s);
00067 }


Member Function Documentation

int skillEntry::getLevel (  ) 

Return the skill level for this skill.

Returns:
integer value for the skill level

Definition at line 77 of file skill-entry.cpp.

Referenced by skillList::addSkill(), and skillList::listOfSkillString().

00077                         {
00078         return level;
00079 }

Here is the caller graph for this function:

skillEntry * skillEntry::getNext (  ) 

Retrieve the value of the pointer pointing to the next skill in the list.

Returns:
pointer to a skillEntry node or null if none is there.

Definition at line 69 of file skill-entry.cpp.

Referenced by skillList::addSkill(), skillList::listOfSkills(), skillList::listOfSkillString(), skillList::skillCount(), and skillList::XMLout().

00069                                {
00070         return next;
00071 }

Here is the caller graph for this function:

char * skillEntry::getSkill (  ) 

Return the string value for this skill

Returns:
pointer to the string representation of the skill.

Definition at line 84 of file skill-entry.cpp.

Referenced by skillList::addSkill(), and skillList::listOfSkillString().

00084                           {
00085         checkString(skill);
00086         return skill;
00087 }

Here is the caller graph for this function:

void skillEntry::setLevel ( int   ) 

Set the level of skill for this skill entry.

Parameters:
int -- integer value to set this skill entry level to.

Definition at line 80 of file skill-entry.cpp.

Referenced by skillList::addSkill(), and skillList::skillList().

00080                               {
00081         level=l;
00082 }

Here is the caller graph for this function:

void skillEntry::setNext ( skillEntry  ) 

Set the value of the pointer pointing to the next skill in the list.

Definition at line 73 of file skill-entry.cpp.

Referenced by skillList::addSkill().

00073                                      {
00074         next =p;
00075 }

Here is the caller graph for this function:

void skillEntry::setSkill ( char *   ) 

Assign the string value for this skill entry.

Parameters:
(char*) pointer to the string representation we want to set.

Definition at line 89 of file skill-entry.cpp.

Referenced by skillList::skillList().

00089                                 {
00090         skill=(char*) malloc(strlen(p)+1);
00091         sprintf(skill,"%s",p);
00092 }

Here is the caller graph for this function:

char * skillEntry::toString (  ) 

Convert this object to a string.

Returns:
pointer to character string.

Definition at line 96 of file skill-entry.cpp.

Referenced by skillList::listOfSkills().

00096                           {
00097         char rvalue[10]; // I doubt it should ever be more than that. 
00098         char *buffer;    // This will evenually be our return value 
00099         
00100         sprintf(rvalue,"%d",this->getLevel());
00101         buffer=(char*)malloc(strlen(this->getSkill()) + strlen(FILLER) + 
00102                                                  strlen(rvalue) + 1 );
00103         sprintf(buffer,"%s%s%s",this->getSkill(),FILLER,rvalue);
00104         return buffer;
00105 }

Here is the caller graph for this function:

void skillEntry::XMLout ( FILE *  fout  ) 

Send this object to an XML formatted file.

Parameters:
fout pointer to a file buffer.

Definition at line 107 of file skill-entry.cpp.

Referenced by skillList::XMLout().

00107                                  {
00108         
00109         fprintf(fout,"\t\t%s\n",createStartElement("skill"));
00110         fprintf(fout,"\t\t\t%s%s%s\n",
00111                         createStartElement("skill-name"),
00112                         this->getSkill(),
00113                         createEndElement("skill-name")
00114                         );
00115         fprintf(fout,"\t\t\t%s%d%s\n",
00116                         createStartElement("skill-level"),
00117                         this->getLevel(),
00118                         createEndElement("skill-level"));
00119         fprintf(fout,"\t\t%s\n",createEndElement("skill"));
00120         
00121 }

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Fri Mar 7 16:42:56 2008 for frpuniverse by  doxygen 1.4.7