Changeset 1544
- Timestamp:
- 2000-09-13T21:34:31+12:00 (24 years ago)
- Location:
- trunk/gsinstaller
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsinstaller/FilePath.cpp
r1541 r1544 195 195 } 196 196 197 bool FilePath::equals(FilePath &other) 198 { 199 if (this->path.compare(other.path) == 0) 200 { 201 return true;202 }203 204 return false;205 } 206 207 bool FilePath::equals(const char *other) 208 { 209 if (strcmp(this->path.c_str(), other) == 0)210 { 211 return true; 212 } 213 214 return false;197 int FilePath::compare(const FilePath &other) const 198 { string::const_iterator thisc = this->path.begin(); 199 string::const_iterator otherc = other.path.begin(); 200 201 while (thisc != this->path.end() && otherc != other.path.end()) 202 { if (toupper(*thisc) != toupper(*otherc)) 203 { return (toupper(*thisc) - toupper(*otherc)); 204 } 205 thisc ++; 206 otherc ++; 207 } 208 209 return this->path.size() - other.path.size(); 210 } 211 212 int FilePath::compare(const char *other) const 213 { 214 return strcmpi(this->path.c_str(), other); 215 215 } 216 216 … … 357 357 parent = this->parent(); 358 358 359 if ( parent->equals(thisFile.cString()))359 if (*parent == thisFile) 360 360 { 361 361 delete parent; -
trunk/gsinstaller/FilePath.h
r1541 r1544 11 11 #endif 12 12 #endif 13 14 #include <string.h> 13 15 14 16 class FilePath … … 25 27 FilePath(int nPaths, ...); 26 28 FilePath(FilePath &path, string subPath); 27 bool equals(FilePath &path);28 bool equals(const char *path);29 29 bool isRoot(); 30 30 bool isEmpty(); 31 int compare(const FilePath &other) const; 32 int compare(const char *other) const; 31 33 FilePath *append(FilePath &path); 32 34 FilePath *append(char *path); … … 38 40 const char *cString(); 39 41 string pathString(); 40 bool operator==(const FilePath &b) const { return this-> path == b.path; }41 bool operator!=(const FilePath &b) const { return this-> path != b.path; }42 bool operator<(const FilePath &b) const { return this-> path < b.path; }42 bool operator==(const FilePath &b) const { return this->compare(b) == 0; } 43 bool operator!=(const FilePath &b) const { return this->compare(b) != 0; } 44 bool operator<(const FilePath &b) const { return this->compare(b) < 0; } 43 45 }; 44 46 #endif
Note:
See TracChangeset
for help on using the changeset viewer.