bool isExtensionManaged(const YString& file) { // Check whether it is a valid jpg file String extension; IO::ExtractExtension(extension, file, false, false); // Only JPG files managed at the moment return (extension.toUpper() == "JPG"); }
bool MrcpRtpHandler::received(Message& msg) { String trans = msg.getValue("transport"); trans.toUpper(); bool tls = false; if (trans == "TCP/TLS/MRCPV2") tls = true; else if (trans != "TCP/MRCPV2") return false; Debug(&plugin,DebugAll,"RTP message received, TLS: %s",String::boolText(tls)); return true; }
bool Search::setParameter(String param, int value) { #if defined(CLOP) || defined(DEBUG_MODE) param.toUpper(); bool res = true; if (param == "FUTIL_MARGIN") { FUTIL_MARGIN = value; } else if (param == "EXT_FUTILY_MARGIN") { EXT_FUTILY_MARGIN = value; } else if (param == "RAZOR_MARGIN") { RAZOR_MARGIN = value; } else if (param == "ATTACK_KING") { ATTACK_KING = value; } else if (param == "BACKWARD_PAWN") { BACKWARD_PAWN = value; } else if (param == "BISHOP_ON_QUEEN") { BISHOP_ON_QUEEN = value; } else if (param == "BONUS2BISHOP") { BONUS2BISHOP = value; } else if (param == "CONNECTED_ROOKS") { CONNECTED_ROOKS = value; } else if (param == "DOUBLED_ISOLATED_PAWNS") { DOUBLED_ISOLATED_PAWNS = value; } else if (param == "DOUBLED_PAWNS") { DOUBLED_PAWNS = value; } else if (param == "END_OPENING") { END_OPENING = value; } else if (param == "ENEMY_NEAR_KING") { ENEMY_NEAR_KING = value; } else if (param == "FRIEND_NEAR_KING") { FRIEND_NEAR_KING = value; } else if (param == "HALF_OPEN_FILE_Q") { HALF_OPEN_FILE_Q = value; } else if (param == "OPEN_FILE") { OPEN_FILE = value; } else if (param == "OPEN_FILE_Q") { OPEN_FILE_Q = value; } else if (param == "PAWN_IN_7TH") { PAWN_IN_7TH = value; } else if (param == "PAWN_CENTER") { PAWN_CENTER = value; } else if (param == "PAWN_IN_8TH") { PAWN_IN_8TH = value; } else if (param == "PAWN_ISOLATED") { PAWN_ISOLATED = value; } else if (param == "PAWN_NEAR_KING") { PAWN_NEAR_KING = value; } else if (param == "PAWN_BLOCKED") { PAWN_BLOCKED = value; } else if (param == "ROOK_7TH_RANK") { ROOK_7TH_RANK = value; } else if (param == "ROOK_BLOCKED") { ROOK_BLOCKED = value; } else if (param == "ROOK_TRAPPED") { ROOK_TRAPPED = value; } else if (param == "UNDEVELOPED_KNIGHT") { UNDEVELOPED_KNIGHT = value; } else if (param == "UNDEVELOPED_BISHOP") { UNDEVELOPED_BISHOP = value; } else if (param == "VAL_WINDOW") { VAL_WINDOW = value; } else if (param == "UNPROTECTED_PAWNS") { UNPROTECTED_PAWNS = value; } else { res = false; } return res; #else cout << param << " " << value << endl; return false; #endif }
String PepNovoInfile::handlePTMs_(const String& modification, const bool variable) { String locations, key, type; ResidueModification::TermSpecificity ts = ModificationsDB::getInstance()->getModification(modification).getTermSpecificity(); String origin = ModificationsDB::getInstance()->getModification(modification).getOrigin(); double mass = ModificationsDB::getInstance()->getModification(modification).getDiffMonoMass(); String full_name = ModificationsDB::getInstance()->getModification(modification).getFullName(); String full_id = ModificationsDB::getInstance()->getModification(modification).getFullId(); if (variable) { type = "OPTIONAL"; } else { type = "FIXED"; } switch (ts) { case ResidueModification::C_TERM: locations = "C_TERM"; break; case ResidueModification::N_TERM: locations = "N_TERM"; break; case ResidueModification::ANYWHERE: locations = "ALL"; break; default: throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Invalid term specificity", String(ts)); } if (ts == ResidueModification::C_TERM) { key = "$"; } else if (ts == ResidueModification::N_TERM) { key = "^"; } //cout<<"origin: "<<origin<<" loc: "<<locations<<endl; if ((ts == ResidueModification::C_TERM) && (origin == "X")) { origin = "C_TERM"; } else if ((ts == ResidueModification::N_TERM) && (origin == "X")) { origin = "N_TERM"; } else { key = origin; } if (mass >= 0) { key += "+" + String(Math::round(mass)); } else { key += String(Math::round(mass)); } String line = ""; line += origin.toUpper(); line += "\t"; line += mass; line += "\t"; line += type; line += "\t"; line += locations; line += "\t"; line += key; line += "\t"; line += full_name; mods_and_keys_[key] = full_id; return line; }
int main(int argc, char** argv) { String a; a = "Testing..."; cout << a << endl; cout << "length: " << a.length() << endl; cout << "capacity: " << a.capacity() << endl; a = a + "one two three"; cout << a << endl; cout << "length: " << a.length() << endl; cout << "capacity: " << a.capacity() << endl; a = "stuff on the front:" + a; cout << a << endl; cout << "length: " << a.length() << endl; cout << "capacity: " << a.capacity() << endl; long intval = 0; if (String("32").parseInt(intval)) cout << "Converting '32' to int: " << intval << endl; else cout << "Error converting string to int.\n"; double doubleval = 0.0; String("3.141592654").parseDouble(doubleval); cout << "Converting 3.141592654 to double: " << doubleval << endl; long hexval = 0; if (String("0x34ab").parseHex(hexval)) cout << "Converting 0x34ab to " << hexval << " (Should be 13483)" << endl; else cout << "Hex conversion failed.\n"; String tflag("true"); String fflag("false"); bool boolval; tflag.parseBool(boolval); if (boolval) cout << "This should have been true (and was)" << endl; else cout << "tflag was false and should have been true." << endl; fflag.parseBool(boolval); if (boolval) cout << "fflag should have been false and wasn't." << endl; else cout << "fflag was false and should have been." << endl; char c; a.charAt(3, c); cout << "\nCharacter at position 3: '" << c << "' \n"; String b("cat"); String d = "cat"; if (b == d) cout << "Yup, equal.\n"; else cout << "Nope, not equal.\n"; if (b == "fark") cout << b << " is less than fark\n"; cout << a.toLower() << endl; cout << a.toUpper() << endl; cout << "Substring..." << endl; String substr_test = "this is a weird string. Much odd."; cout << substr_test.substring(4, 4) << endl; cout << "Regular Expressions\n"; String astring = "This is a test."; if (astring.matches("is a")) cout << " Matched!\n"; else cout << " Didn't match.\n"; String csvstuff = "3.1415 2.71828 42 testing"; ArrayList<String> fields = csvstuff.split(" +"); }