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