Date Date::dateStringToObject(string date) { Date convertedDateObject; vector <string> tokenizedDate=tokenize(date); int dayIndex=-1; if(tokenizedDate.size()==1) { dayIndex=whichDay(date); if (dayIndex!=-1) convertedDateObject=setDayToObject(dayIndex); else if(equalsIgnoreCase(date, "today")) convertedDateObject=*this; else if(equalsIgnoreCase(date, "tomorrow")) convertedDateObject=setTomorrowToObject(); else if (hasSlashes(date)) convertedDateObject=setDateWithSlashesToObject(date, *this); else if (date.size()==8) convertedDateObject=setDateIdToObject(date); } else if(tokenizedDate.size()>1 && tokenizedDate.size()<4) convertedDateObject=setDateWithMonthToObject(tokenizedDate, *this); return convertedDateObject; }
bool StocksUpdateFromUDF(const UniversalDataFormat& udf) { StocksPrefs& prefs = GetPreferences()->stocksPrefs; StocksPortfolio& p = prefs.portfolio(prefs.currentPortfolio); ulong_t len = udf.getItemsCount(); assert(len == p.size()); for (ulong_t i = 0; i < len; ++i) { StocksEntry& e = p.entry(i); assert(udf.getItemElementsCount(i) >= 2); free(e.url); e.url = StringCopy(udf.getItemData(i, stocksListItemUrlIndex)); if (NULL == e.url) return false; const char_t* symbol = udf.getItemText(i, stocksListItemSymbolIndex); if (equalsIgnoreCase(symbol, e.symbol)) { assert(stocksListElementsCount == udf.getItemElementsCount(i)); e.status = e.statusReady; const char* trade = udf.getItemData(i, stocksListItemTradeIndex); const char* change = udf.getItemData(i, stocksListItemChangeIndex); const char* percent = udf.getItemData(i, stocksListItemPercentChangeIndex); if (errNone != numericValue(trade, -1, e.trade)) return false; if (errNone != numericValue(change, -1, e.change)) return false; ulong_t len = Len(percent); if (0 == len || '%' != percent[len - 1]) return false; if (errNone != numericValue(percent, len - 1, e.percentChange)) return false; } else if (equalsIgnoreCase(symbol, _T("?"))) { assert(stocksListNotFoundElementsCount == udf.getItemElementsCount(i)); e.status = e.statusAmbiguous; } else { assert(stocksListNotFoundElementsCount == udf.getItemElementsCount(i)); free(e.data); e.data = StringCopy(symbol); if (NULL == e.data) return false; e.status = e.statusChanged; } } return true; }
Static command_type findCommand(Char *command) { command_type j; curtail(command, ':'); if (equalsIgnoreCase(command, "STYLE")) style_supplied = true; for (j = c1; j <= cn; j = (command_type)((long)j + 1)) { if (equalsIgnoreCase(command, commands[(long)j])) return j; } return none; }
bool String::toBool() const { if (equalsIgnoreCase("true")) { return true; } else if (equalsIgnoreCase("false")) { return false; } else { throwStringConversion(c_str(), "bool"); } return false; // to make compiler happy }
string HistoryHandler:: undoCommand () { string commandType=commandOrder.top(); commandOrder.pop(); Event eventObj=eventOrder.top(); eventOrder.pop(); Date dateToUndo=masterList[0].dateStringToObject(eventObj.getId().substr(0,8)); int index = masterList[0].dateDifference(dateToUndo); if(equalsIgnoreCase(commandType,"Done")) { masterList[index].markEventAsNotDone(masterList[index].getIndex(eventObj.getId())); return commandType; } else if(equalsIgnoreCase(commandType,"Done All")) { while(commandType=="Done All") { masterList[index].markEventAsNotDone(masterList[index].getIndex(eventObj.getId())); if (commandOrder.size()>0) { if(commandOrder.top()=="Done All") { commandType=commandOrder.top(); eventObj=eventOrder.top(); dateToUndo=masterList[0].dateStringToObject(eventObj.getId().substr(0,8)); index = masterList[0].dateDifference(dateToUndo); commandOrder.pop(); eventOrder.pop(); } } else break; } return "Done All"; } if (equalsIgnoreCase(commandType, "Delete")) { masterList[index].addEvent(eventObj.getId(),eventObj.getName(), eventObj.getLocation(), eventObj.getStartTime(), eventObj.getEndTime(), eventObj.getEventType(), eventObj.getEventStatus()); return commandType; } }
int Date::whichDay(string input) { string days[]={"sunday" , "monday","tuesday", "wednesday", "thursday", "friday", "saturday"}; for(int i=0;i<7;i++) { if(equalsIgnoreCase(input, days[i])) return i; } return -1; }
bool MenuDialog::handleBackKey(UINT msg, WPARAM wParam, LPARAM lParam) { bool keyUp = (0 != (UINT(LOWORD(lParam)) & MOD_KEYUP)); HWND wnd = GetFocus(); if (NULL == wnd) { if (keyUp) { PostMessage(handle(), WM_COMMAND, MAKEWPARAM(IDCANCEL, 0), 0); return true; } else return true; } char_t name[8]; int res = GetClassName(wnd, name, 5); if (0 == res || !(equalsIgnoreCase(name, WINDOW_CLASS_EDITBOX) || equalsIgnoreCase(name, _T("CAPEDIT")))) { if (keyUp) { //SHNavigateBack(); PostMessage(handle(), WM_COMMAND, MAKEWPARAM(IDCANCEL, 0), 0); return true; } else return true; } #ifdef SHELL_TPCSHELL SHSendBackToFocusWindow(msg, wParam, lParam); return true; #else return false; #endif }
String XmlDocument::getParameterEntity (const String& entity) { for (int i = 0; i < tokenisedDTD.size(); ++i) { if (tokenisedDTD[i] == entity && tokenisedDTD [i - 1] == "%" && tokenisedDTD [i - 2].equalsIgnoreCase ("<!entity")) { auto ent = tokenisedDTD [i + 1].trimCharactersAtEnd (">"); if (ent.equalsIgnoreCase ("system")) return getFileContents (tokenisedDTD [i + 2].trimCharactersAtEnd (">")); return ent.trim().unquoted(); } } return entity; }
void VectorPriorityQueue::changePriority(string value, int newPriority) { // TODO: implement if (elements.isEmpty()) return; PQEntry *entry; for(int i=0; i<elements.size();i++){ entry = &(elements[i]); if(equalsIgnoreCase(entry->value,value)){ if (entry->priority < newPriority) { cout << "Error: new priority cannot be greater than old priority" << endl; entry = NULL; return; } entry->priority = newPriority; entry = NULL; return; } } cout << "Cannot find the value" << endl; }
bool String::equalsIgnoreCase(const String& arg) const { return equalsIgnoreCase(arg.c_str()); }
void ChangeLocationForm::handleControlSelect(const EventType& event) { bool pretendCancelPressed = true; char_t * newLocation = NULL; if (okButton == event.data.ctlSelect.controlID) { newLocation = locationField_.textCopy(); if (NULL == newLocation) goto ClosePopup; StrStrip(newLocation); if (StrEmpty(newLocation)) goto ClosePopup; LookupManager* lookupManager = application().lookupManager; Preferences& prefs = application().preferences(); switch (whenOk_) { case moviesMode: { const String& curLocation = prefs.moviesLocation; // TODO: now that there's a chance, that the text we use is // different than the string user gave, maybe it's a good idea // to popup a confirmation dialog box with "Get movies for location $FOO" // and "OK", "Cancel" so that the user has a chance to preview // location he gave. Changing locations shouldn't be frequent so // we can annoy users like that. // "Cancel" would get us back to entering location form // change only if different than previous if (!equalsIgnoreCase(newLocation, curLocation)) lookupManager->fetchMovies(newLocation); break; } case weatherMode: { const String& curLocation = prefs.weatherPreferences.weatherLocation; // change only if different than previous if (!equalsIgnoreCase(curLocation, newLocation)) lookupManager->fetchWeather(newLocation, newLocation); break; } } pretendCancelPressed = false; } ClosePopup: if( NULL != newLocation) free(newLocation); closePopup(); if (cancelButton == event.data.ctlSelect.controlID || pretendCancelPressed) { Preferences& prefs = application().preferences(); switch (whenOk_) { case moviesMode: if (prefs.moviesLocation.empty()) application().runMainForm(); break; case weatherMode: if (prefs.weatherPreferences.weatherLocationToServer.empty()) application().runMainForm(); break; } } }
bool String::equalsIgnoreCase(String& s) { return equalsIgnoreCase(*s); }
Static void applyStyle(Char *s_, Char *stylename, stave_index first_inst, stave_index first_stave) { Char s[256]; Char clef[256], subline[256], subcommand[256]; stave_index0 i, last_inst, last_stave; boolean continuo = false, toosoon = false, vocal = false; Char STR2[256]; strcpy(s, s_); last_inst = first_inst - 1; GetNextWord(subline, s, blank_, colon_); while (*s != '\0') { GetNextWord(subline, s, semicolon, dummy); i = curtail(subline, semicolon); GetNextWord(subcommand, subline, blank_, dummy); if (equalsIgnoreCase(subcommand, "VOICES")) { sprintf(voices + strlen(voices), " %s", subline); last_stave = first_stave + wordCount(subline) - 1; last_inst = first_inst + voiceCount(subline) - 1; } else if (equalsIgnoreCase(subcommand, "CLEFS")) { strcpy(clef, subline); sprintf(clefs + strlen(clefs), " %s", clef); } else if (equalsIgnoreCase(subcommand, "VOCAL")) { if (last_inst < first_inst) toosoon = true; else { some_vocal = true; vocal = true; for (i = first_inst; i <= last_inst; i++) setVocal(i, true); } } else if (equalsIgnoreCase(subcommand, "CHORAL") || equalsIgnoreCase(subcommand, "GROUP")) { if (last_inst < first_inst) toosoon = true; else { if (equalsIgnoreCase(subcommand, "CHORAL")) { some_vocal = true; vocal = true; for (i = first_inst; i <= last_inst; i++) setVocal(i, true); } if (ngroups == maxgroups) error("Too many groups", print); else { ngroups++; group_start[ngroups-1] = first_stave; group_stop[ngroups-1] = last_stave; } } } else if (equalsIgnoreCase(subcommand, "CONTINUO")) continuo = true; else { sprintf(STR2, "Subcommand %s in STYLE unknown", subcommand); error(STR2, print); } if (toosoon) { sprintf(STR2, "You must first give VOICES before specifying %s", subcommand); error(STR2, print); } } if (vocal && continuo) error("A continuo instrument may not be vocal", print); if (wordCount(clef) != last_stave - first_stave + 1) error("Number of clefs does not match number of voices", print); if (first_stave == last_stave || continuo) { strcpy(instr_name[first_stave-1], stylename); /* p2c: preamble.pas, line 185: * Note: Possible string truncation in assignment [145] */ } else { for (i = first_stave - 1; i <= last_stave - 1; i++) *instr_name[i] = '\0'; } if (continuo) { ninstr++; stave[ninstr-1] = first_stave; for (i = first_stave - 1; i <= last_stave - 1; i++) instr[i] = ninstr; return; } for (i = first_stave; i <= last_stave; i++) { ninstr++; stave[ninstr-1] = i; instr[i-1] = ninstr; } }
bool SDOXMLString::equalsIgnoreCase(const char* localString) const { return equalsIgnoreCase(SDOXMLString(localString)); }
bool SDOXMLString::equalsIgnoreCase(const SDOXMLString& str) const { return equalsIgnoreCase(str.xmlForm); }