Example #1
0
bool Annotate::getNextSection(SCRef d, int& idx, QString& sec, SCRef target)
{
    if (idx >= d.length())
        return false;

    int newIdx = d.indexOf(target, idx);
    if (newIdx == -1) // last section, take all
        newIdx = d.length() - 1;

    sec = d.mid(idx, newIdx - idx + 1);
    idx = newIdx + 1;
    return true;
}
Example #2
0
File: git.cpp Project: Byron/qgit4
int Git::findFileIndex(const RevFile& rf, SCRef name) {

	if (name.isEmpty())
		return -1;

	int idx = name.lastIndexOf('/') + 1;
	SCRef dr = name.left(idx);
	SCRef nm = name.mid(idx);

	for (uint i = 0, cnt = rf.count(); i < cnt; ++i) {
		if (fileNamesVec[rf.nameAt(i)] == nm && dirNamesVec[rf.dirAt(i)] == dr)
			return i;
	}
	return -1;
}