2 |
|
// |
3 |
|
// Douglas Thrift |
4 |
|
// |
5 |
< |
// $Id: IndividualClient.h,v 1.2 2003/08/17 03:55:39 douglas Exp $ |
5 |
> |
// $Id: IndividualClient.h,v 1.7 2003/09/03 03:40:35 douglas Exp $ |
6 |
|
|
7 |
|
#ifndef _IndividualClient_h_ |
8 |
|
#define _IndividualClient_h_ |
15 |
|
unsigned number; |
16 |
|
string name; |
17 |
|
string file; |
18 |
+ |
static string extension; |
19 |
+ |
void lowercase(string& word) { word = toLower(word); } |
20 |
|
void demunge(void); |
21 |
|
string demunge(const string& munged); |
22 |
< |
void capitalize(string& word, unsigned index = 0) { word[index] = |
21 |
< |
toupper(word[index]); } |
22 |
> |
void capitalize(string& word, unsigned index = 0, unsigned count = 1); |
23 |
|
public: |
24 |
|
IndividualClient() { number = 0; } |
25 |
+ |
IndividualClient(unsigned number, const string& name); |
26 |
+ |
IndividualClient(const string& file); |
27 |
|
~IndividualClient() {} |
28 |
|
unsigned getNumber(void); |
29 |
|
string getName(void); |
30 |
|
string getFile(void); |
31 |
+ |
static string getExtension(void) { return extension; } |
32 |
|
void setNumber(unsigned number); |
33 |
|
void setName(const string& name); |
34 |
|
void setFile(const string& file); |
35 |
+ |
static void setExtension(const string& extension) { |
36 |
+ |
IndividualClient::extension = extension; } |
37 |
+ |
bool operator<(const IndividualClient& data) const; |
38 |
+ |
bool operator>(const IndividualClient& data) const; |
39 |
|
}; |
40 |
|
|
41 |
+ |
inline bool mcLess(const string& first, const string& second) |
42 |
+ |
{ |
43 |
+ |
if (first.find('M') == 0 && second.find('M') == 0) |
44 |
+ |
{ |
45 |
+ |
if (first.find("Mc") == 0 && second.find("Mc") != 0) |
46 |
+ |
{ |
47 |
+ |
return true; |
48 |
+ |
} |
49 |
+ |
else if (first.find("Mc") != 0 && second.find("Mc") == 0) |
50 |
+ |
{ |
51 |
+ |
return false; |
52 |
+ |
} |
53 |
+ |
} |
54 |
+ |
|
55 |
+ |
return toLower(first) < toLower(second); |
56 |
+ |
} |
57 |
+ |
inline bool mcGreater(const string& first, const string& second) |
58 |
+ |
{ |
59 |
+ |
if (first.find('M') == 0 && second.find('M') == 0) |
60 |
+ |
{ |
61 |
+ |
if (first.find("Mc") == 0 && second.find("Mc") != 0) |
62 |
+ |
{ |
63 |
+ |
return false; |
64 |
+ |
} |
65 |
+ |
else if (first.find("Mc") != 0 && second.find("Mc") == 0) |
66 |
+ |
{ |
67 |
+ |
return true; |
68 |
+ |
} |
69 |
+ |
} |
70 |
+ |
|
71 |
+ |
return toLower(first) > toLower(second); |
72 |
+ |
} |
73 |
+ |
|
74 |
|
#endif // _IndividualClient_h_ |