1 //--------------------------------------------------------------------------
2 // Command.cc - Source file for the Command class
7 // $Date: 1998/09/10 19:57:17 $
12 // $Log: Command.cc,v $
13 // Revision 1.8 1998/09/10 19:57:17 mlong
14 // lots of little bug fixes and a few new features
16 // Revision 1.7 1998/04/15 16:56:17 mlong
17 // *** empty log message ***
19 // Revision 1.6 1998/02/12 18:43:26 mlong
20 // *** empty log message ***
22 // Revision 1.5 1997/05/15 18:27:53 chess
23 // added pending and TourneyPlayers support
24 // added HandleGetPlayerInfo & HandleGetGameInfo
26 // Revision 1.4 1997/04/13 03:14:35 chess
27 // command class changed to have a parameter list.
29 // Revision 1.3 1997/04/07 22:21:49 chess
30 // *** empty log message ***
32 // Revision 1.2 1996/10/03 18:11:10 moses
33 // made sure string are null termindated
35 // Revision 1.1 1996/10/01 20:14:43 moses
39 //--------------------------------------------------------------------------
41 // static char RCSid[] = "$Id: Command.cc,v 1.8 1998/09/10 19:57:17 mlong Exp $";
45 //- constructor -----------------------------------------------------------
47 name = alias = description = NULL;
51 } //- End of constructor
53 Command::Command(char *n, char *a, ranks m, char *d, char *paramTypeList, USERFP u) {
54 name = new char[strlen(n)+1];
56 if(NULL == name) return;
57 memset(name, '\0', strlen(n));
58 strncpy(name, n, strlen(n));
59 name[strlen(n)] = '\0';
61 memset(parameterList, '\0', MAXNUMPARAMS);
62 strncpy(parameterList, paramTypeList, strlen(paramTypeList));
63 parameterList[strlen(paramTypeList)] = '\0';
65 alias = new char[strlen(a)+1];
66 if(NULL == alias) return;
67 memset(alias, '\0', strlen(a));
68 strncpy(alias, a, strlen(a));
69 alias[strlen(a)] = '\0';
73 description = new char[strlen(d)+1];
74 if(NULL == description) return;
75 memset(description, '\0', strlen(d));
76 strncpy(description, d, strlen(d));
77 description[strlen(d)] = '\0';
80 } //- End of constructor
82 Command::Command(char *n, char *a, ranks m, char *d, char *paramTypeList, TOURNFP t) {
83 name = new char[strlen(n)+1];
84 if(NULL == name) return;
85 memset(name, '\0', strlen(n));
86 strncpy(name, n, strlen(n));
87 name[strlen(n)] = '\0';
89 memset(parameterList, '\0', MAXNUMPARAMS);
90 strncpy(parameterList, paramTypeList, strlen(paramTypeList));
91 parameterList[strlen(paramTypeList)] = '\0';
93 alias = new char[strlen(a)+1];
94 if(NULL == alias) return;
95 memset(alias, '\0', strlen(a));
96 strncpy(alias, a, strlen(a));
97 alias[strlen(a)] = '\0';
101 description = new char[strlen(d)+1];
102 if(NULL == description) return;
103 memset(description, '\0', strlen(d));
104 strncpy(description, d, strlen(d));
105 description[strlen(d)] = '\0';
108 } //- End of constructor
110 //- deconstructor ---------------------------------------------------------
111 Command::~Command() {
118 if(NULL != description)
119 delete [] description;
120 } //- End of deconstructor
122 //- IsCommand ------------------------------------------------------
123 int Command::IsCommand(char *comm) {
124 int length = strlen(comm);
125 if((0 == strncasecmp(comm, name, MIN(length, (int)strlen(name)))) ||
126 (0 == strncasecmp(comm, alias, MIN(length, (int)strlen(alias)))))
130 } //- End of IsCommand
132 //- GetCommandName ------------------------------------------------
133 char *Command::GetCommandName() {
135 } //- End of GetCommandName
137 //- GetCommandDescription ------------------------------------------------
138 char *Command::GetCommandDescription() {
140 } //- End of GetCommandDescription
142 //- GetCommandAlias ------------------------------------------------
143 char *Command::GetCommandAlias() {
145 } //- End of GetCommandAlias
147 //- GetManagerLevel -----------------------------------------------
148 ranks Command::GetManagerLevel() {
150 } //- End of GetManagerLevel
152 //- SetManagerLevel -----------------------------------------------
153 void Command::SetManagerLevel(ranks newvalue) {
154 managerLevel = newvalue;
155 } //- end of SetManagerLevel