void tst_Q3CString::findRev() { Q3CString a; a="ABCDEFGHIEfGEFG"; // 15 chars QCOMPARE(a.findRev('G'),14); // QCOMPARE(a.findRev('G',-3),11); // QCOMPARE(a.findRev('G',-5),6); QCOMPARE(a.findRev('G',14),14); QCOMPARE(a.findRev('G',13),11); QCOMPARE(a.findRev('B'),1); QCOMPARE(a.findRev('B',1),1); QCOMPARE(a.findRev('B',0),-1); // QCOMPARE(a.findRev(QRegExp("[EFG][EFG]"),14),13); // QCOMPARE(a.findRev(QRegExp("[EFG][EFG]"),11),11); }
void UmlRelation::write_relation(FileOut & out) { // note : it is the first side if (_assoc_class != 0) // generated in the association class return; const char * k = (_uml_20) ? "ownedElement" : "packagedElement"; out.indent(); out << '<' << k << " xmi:type=\"uml:Association\""; out.id_prefix(this, "ASSOC_"); Q3CString s = name(); int i1 = s.find("("); int i2 = s.findRev(")"); if ((i1 != -1) && (i2 != -1) && (i2 > i1) && (s[i1+1] != '<') && (s[i2-1] != '>')) { s = s.mid(i1 + 1, i2 - i1 - 1); if (!s.isEmpty()) { out << " name=\""; out.quote((const char*)s);//[jasa] ambiguous call out << '"'; } } write_visibility(out); out << ">\n"; write_ends(out); out.indent(); out << "</" << k << ">\n"; }