SPString SPFileHelper::GetUpperPath( SPString path ) { SPString result1 = L""; SPString result2 = L""; if (path.find_last_of(L"\\") != wstring::npos) { result2 = path.substr(0, path.find_last_of(L"\\")); } if (path.find_last_of(L"/") != wstring::npos) { result1 = path.substr(0, path.find_last_of(L"/")); } return result1.size() > result2.size() ? result1 : result2; }
int bcnt; // current brace count /* * Reads in a line, and eliminates anything in between comments * or quotes. Also keeps count of the brace level */ int getline() { LTRACER("getline", 4) if(!(fin >> curln)) return 0; cout << curln << endl; LTRACE(2, curln) while(curln.m("\".*\"")){ // remove anything in quoted strings int o, c; SPString tl= curln.substr(0, o= curln.index("\"")); do{ // make sure the quote is not backslashed c= curln.index("\"", o+1); o= c; }while(c > 1 && curln[c-1] == '\\'); tl += curln.substr(c+1); // rest of line curln= tl; // cout << "quote stripped curln= " << curln <<endl; } if(curln.m("//")){ // found a comment in line curln.substr(curln.index("//"))= ""; // chop it off } if(curln.m("/\\*")){ // in c comment SPString tl= curln.substr(0, curln.index("/*"));