Changeset 1475 for trunk/gsinstaller/unInstall.cpp
- Timestamp:
- 2000-08-31T00:42:59+12:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsinstaller/unInstall.cpp
r1397 r1475 4 4 #include <stdarg.h> 5 5 #include "File.h" 6 7 bool installManager::openLog(string filename, bool write) 8 { if (this->logfile.rdbuf()->is_open()) 9 { this->logfile.close(); 10 } 11 this->logfile.open(filename.c_str(), (write ? ios::out : ios::in) | ios::app); 12 } 13 14 void installManager::setModule(string moduleName) 15 { this->currentModule = moduleName; 16 } 17 18 bool installManager::writeString(char *buffer) 19 { string s(buffer); 20 this->writeString(s); 21 } 22 23 bool installManager::writeString(string str) 24 { bool quote; 25 26 // TODO: check for space characters in str and quote if necessary 27 quote = str.find_first_of(' ') < str.length(); 28 29 if (quote) 30 { this->logfile << "\""; 31 } 32 this->logfile << str; 33 if (quote) 34 { this->logfile << "\""; 35 } 36 return true; 37 } 38 39 bool installManager::writeSeparator() 40 { this->logfile << " "; 41 return true; 42 } 43 44 string installManager::readString() 45 { string reply; 46 char c; 47 48 this->logfile >> c; 49 while (c <= ' ') 50 { this->logfile.get(); 51 } 52 if (c == '\"') 53 { do 54 { c = this->logfile.get(); 55 if (c != '\"') 56 { reply += c; 57 } 58 } 59 while (c != '\"'); 60 } 61 else 62 { /*while (c > ' ') 63 { reply += c; 64 c = this->logfile.get(); 65 }*/ 66 this->logfile.putback(c); 67 this->logfile >> reply; 68 } 69 return reply; 70 } 71 72 string installManager::readCommand(stringArray &array) 73 { string reply; 74 char c; 75 76 array.clear(); 77 78 reply = this->readString(); 79 while((c = this->logfile.get()) != '\n') 80 { this->logfile.putback(c); 81 array.add(this->readString()); 82 } 83 this->logfile.putback(c); 84 85 return reply; 86 } 87 88 installManager::~installManager() 89 { if (this->logfile.rdbuf()->is_open()) 90 { this->logfile.close(); 91 } 92 } 6 93 7 94 unInstaller::unInstaller(string &fileName)
Note:
See TracChangeset
for help on using the changeset viewer.