ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/trunk/VTBFileUtil2/IndividualClient.cxx
(Generate patch)

Comparing trunk/VTBFileUtil2/IndividualClient.cxx (file contents):
Revision 271 by douglas, 2003-08-19T22:49:34-07:00 vs.
Revision 284 by douglas, 2003-09-01T23:05:56-07:00

# Line 2 | Line 2
2   //
3   // Douglas Thrift
4   //
5 < // $Id: IndividualClient.cxx,v 1.5 2003/08/20 05:49:34 douglas Exp $
5 > // $Id: IndividualClient.cxx,v 1.9 2003/09/02 06:05:56 douglas Exp $
6  
7   #include "IndividualClient.h"
8  
9 + IndividualClient::IndividualClient(unsigned number, const string& name)
10 + {
11 +        setNumber(number);
12 +        setName(name);
13 + }
14 +
15 + IndividualClient::IndividualClient(const string& file)
16 + {
17 +        setFile(file);
18 + }
19 +
20   unsigned IndividualClient::getNumber(void)
21   {
22 <        if (number == 0)
22 >        if (number == 0 && file != "")
23          {
24                  demunge();
25          }
# Line 18 | Line 29 | unsigned IndividualClient::getNumber(voi
29  
30   string IndividualClient::getName(void)
31   {
32 <        if (name == "")
32 >        if (name == "" && file != "")
33          {
34                  demunge();
35          }
# Line 28 | Line 39 | string IndividualClient::getName(void)
39  
40   string IndividualClient::getFile(void)
41   {
42 <        if (file == "")
42 >        if (file == "" && number != 0 && name != "")
43          {
44                  ostringstream file;
45  
# Line 82 | Line 93 | void IndividualClient::setFile(const str
93          this->file = file;
94          number = 0;
95          name = "";
96 +
97 +        if (file != "") demunge();
98 + }
99 +
100 + bool IndividualClient::operator<(const IndividualClient& data) const
101 + {
102 +        if (number == data.number)
103 +        {
104 +                return mcLess(name, data.name);
105 +        }
106 +
107 +        return number < data.number;
108 + }
109 +
110 + bool IndividualClient::operator>(const IndividualClient& data) const
111 + {
112 +        if (number == data.number)
113 +        {
114 +                return mcGreater(name, data.name);
115 +        }
116 +
117 +        return number > data.number;
118   }
119  
120   string IndividualClient::extension = "pdf";
# Line 103 | Line 136 | void IndividualClient::demunge(void)
136                  file >> word;
137                  file.get();
138  
139 <                if (word.length() == 1 || word == "jr" || word == "sr" || word == "dr"
140 <                        || word == "mr" || word == "ms" || word == "mrs")
139 >                if (word.length() == 1 && word != "i")
140 >                {
141 >                        if (isalpha(word[0])) word += '.';
142 >                }
143 >                else if (word == "jr" || word == "sr" || word == "dr" || word == "mr"
144 >                        || word == "ms" || word == "mrs")
145                  {
146                          word += '.';
147                  }
# Line 114 | Line 151 | void IndividualClient::demunge(void)
151                  }
152                  else if (word == "ii" || word == "iv" || word == "iv")
153                  {
154 <                        capitalize(word += '.', 0, 2);
154 >                        capitalize(word, 0, 2);
155                  }
156                  else if (word == "iii")
157                  {
158 <                        capitalize(word += '.', 0, 3);
158 >                        capitalize(word, 0, 3);
159                  }
160                  else if (word.length() > 2 && word.find("mc") == 0)
161                  {
# Line 128 | Line 165 | void IndividualClient::demunge(void)
165                  {
166                          capitalize(word, 3);
167                  }
168 <                else if (word.length() > 2 && word.find("o\'") == 0)
168 >                else if (word.length() > word.find_first_of("\'-") + 1 &&
169 >                        word.find_first_of("\'-") != string::npos)
170 >                {
171 >                        capitalize(word, word.find_first_of("\'-") + 1);
172 >                }
173 >                else if (word == "lefevre")
174                  {
175                          capitalize(word, 2);
176                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines