本文整理汇总了C++中SList::append方法的典型用法代码示例。如果您正苦于以下问题:C++ SList::append方法的具体用法?C++ SList::append怎么用?C++ SList::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SList
的用法示例。
在下文中一共展示了SList::append方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getLaneParentsChilds
bool HistoryView::getLaneParentsChilds(SCRef sha, int x, SList p, SList c) {
ListViewDelegate* lvd = static_cast<ListViewDelegate*>(itemDelegate());
uint lane = x / lvd->laneWidth();
int t = getLaneType(sha, lane);
if (t == EMPTY || t == -1)
return false;
// first find the parents
p.clear();
QString root;
if (!isFreeLane(t)) {
p = git->revLookup(sha, fh)->parents(); // pointer cannot be NULL
root = sha;
} else {
SCRef par(git->getLaneParent(sha, lane));
if (par.isEmpty()) {
dbs("ASSERT getLaneParentsChilds: parent not found");
return false;
}
p.append(par);
root = p.first();
}
// then find children
c = git->getChilds(root);
return true;
}
示例2: getFiles
bool CommitImpl::getFiles(SList selFiles) {
// check for files to commit
selFiles.clear();
QTreeWidgetItemIterator it(treeWidgetFiles);
while (*it) {
if ((*it)->checkState(0) == Qt::Checked)
selFiles.append((*it)->text(0));
++it;
}
return !selFiles.isEmpty();
}
示例3: setAnnotation
bool Annotate::setAnnotation(SCRef diff, SCRef author, SCList prevAnn, SList newAnn, int ofs)
{
newAnn.clear();
QStringList::const_iterator cur(prevAnn.constBegin());
QString line;
int idx = 0, num, lineNumStart, lineNumEnd;
int curLineNum = 1; // warning, starts from 1 instead of 0
bool inHeader = true;
while (getNextSection(diff, idx, line, "\n")) {
char firstChar = line.at(0).toLatin1();
if (inHeader) {
if (firstChar == '@')
inHeader = false;
else
continue;
}
switch (firstChar) {
case '@':
// an unified diff fragment header has form '@@ -a,b +c,d @@'
// where 'a' is old file line number and 'b' is old file
// number of lines of the hunk, 'c' and 'd' are the same
// for new file. If the file does not have enough lines
// then also the form '@@ -a +c @@' is used.
if (ofs == 0)
lineNumStart = line.indexOf('-') + 1;
else
// in this case we are given diff fragments with
// faked small files that span the fragment plus
// some padding. So we use 'c' instead of 'a' to
// find the beginning of our patch in the faked file,
// this value will be offsetted by ofs later
lineNumStart = line.indexOf('+') + 1;
lineNumEnd = line.indexOf(',', lineNumStart);
if (lineNumEnd == -1) // small file case
lineNumEnd = line.indexOf(' ', lineNumStart);
num = line.mid(lineNumStart, lineNumEnd - lineNumStart).toInt();
num -= ofs; // offset for range filter computation
// diff lines start from 1, 0 is empty file,
// instead QValueList::at() starts from 0
if (num < 0 || num > prevAnn.size()) {
dbp("ASSERT setAnnotation: start line number is %1", num);
isError = true;
return false;
}
for ( ; curLineNum < num; ++curLineNum) {
newAnn.append(*cur);
++cur;
}
break;
case '+':
newAnn.append(author);
break;
case '-':
if (curLineNum > prevAnn.size()) {
dbp("ASSERT setAnnotation: remove end of "
"file, diff is %1", diff);
isError = true;
return false;
} else {
++cur;
++curLineNum;
}
break;
case '\\':
// diff(1) produces a "\ No newline at end of file", but the
// message is locale dependent, so just test the space after '\'
if (line[1] == ' ')
break;
// fall through
default:
if (curLineNum > prevAnn.size()) {
dbp("ASSERT setAnnotation: end of "
"file reached, diff is %1", diff);
isError = true;
return false;
} else {
newAnn.append(*cur);
++cur;
++curLineNum;
}
break;
}
}
// copy the tail
for ( ; curLineNum <= prevAnn.size(); ++curLineNum) {
newAnn.append(*cur);
++cur;
}
return true;
}