本文整理汇总了C++中QValueList::prepend方法的典型用法代码示例。如果您正苦于以下问题:C++ QValueList::prepend方法的具体用法?C++ QValueList::prepend怎么用?C++ QValueList::prepend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QValueList
的用法示例。
在下文中一共展示了QValueList::prepend方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
SipUriList &SipUriList::reverseList( void )
{
QValueList<SipUri>::Iterator it;
QValueList<SipUri> templist;
for( it = urilist.begin(); it != urilist.end(); ++it ) {
templist.prepend( (*it) );
}
urilist = templist;
return *this;
}
示例2: sortedVersionList
/**
* Return a list of PackageVersion objects sorted by their version numbers,
* with the oldest version at the beginning and the latest version at the end
* of the list.
*/
QValueList<PackageVersion*> Package::sortedVersionList()
{
QValueList<PackageVersion*> sortedVersions;
QValueList<PackageVersion*>::iterator sortedVersionIterator;
PackageVersionMap::iterator versionIterator;
for( versionIterator = m_versions.begin();
versionIterator != m_versions.end(); versionIterator++ )
{
if( versionIterator == m_versions.begin() ) {
sortedVersions.append( *versionIterator );
continue; // if there is only one version, it can't be compared
}
// reverse iteration through the sorted version list
sortedVersionIterator = sortedVersions.end();
while( true )
{
if( sortedVersionIterator == sortedVersions.begin() )
{
sortedVersions.prepend( *versionIterator );
break;
}
sortedVersionIterator--;
if( (*versionIterator)->isNewerThan(
(*sortedVersionIterator)->version() ) )
{
sortedVersionIterator++; // insert after the compared one, not before
sortedVersions.insert( sortedVersionIterator, *versionIterator );
break;
}
}
}
return sortedVersions;
} // end of sortedVersionList()
示例3: getCCHistory
void DbPlugin::getCCHistory (BarData *barData, QDateTime &startDate)
{
FuturesData fd;
if (fd.setSymbol(indexKey))
{
qDebug("CC::getCCHistory: invalid futures symbol");
return;
}
Config config;
QString s;
QString baseDir;
config.getData(Config::DataPath, baseDir);
baseDir.append("/Futures/");
fd.getExchange(s);
baseDir.append(s + "/");
fd.getSymbol(s);
baseDir.append(s);
QDir dir(baseDir);
if (! dir.exists(baseDir, TRUE))
return;
QStringList dirList = dir.entryList();
QString lastChart;
fd.getCurrentContract(startDate, lastChart);
QString ey = lastChart.right(5);
ey.truncate(4);
QValueList<Bar> indexList;
int indexCount = -1;
int dirLoop = dirList.findIndex(lastChart);
if (dirLoop == -1)
dirLoop = dirList.count() - 1;
lastChart = dirList[dirLoop];
s = "Adjustment";
QString s2;
getData(s, s2);
bool adjustFlag = s2.toInt();
while (dirLoop > 1)
{
if (indexCount >= barRange)
break;
s = baseDir + "/" + dirList[dirLoop];
DbPlugin tdb;
if (tdb.open(s, chartIndex))
{
tdb.close();
dirLoop--;
lastChart = dirList[dirLoop];
continue;
}
BarData *recordList = new BarData(s);
tdb.setBarRange(barRange);
tdb.setBarLength(barLength);
tdb.getHistory(recordList, startDate);
tdb.close();
int loop;
QDateTime dt = startDate;
int lastBar = -1;
bool dataFlag = FALSE;
for (loop = recordList->count() - 1; loop > -1; loop--)
{
if (indexCount >= barRange)
break;
recordList->getDate(loop, dt);
fd.getCurrentContract(dt, s);
if (! s.compare(lastChart))
{
Bar bar;
recordList->getBar(loop, bar);
indexList.prepend(bar);
indexCount++;
startDate = dt;
lastBar = loop;
dataFlag = TRUE;
}
}
if (dataFlag)
{
if (adjustFlag)
{
Bar bar;
double t = 0;
if (lastBar - 1 > -1)
t = recordList->getClose(lastBar) - recordList->getClose(lastBar - 1);
bar.setClose(t);
bar.setEmptyFlag(TRUE);
indexList.prepend(bar);
}
}
//.........这里部分代码省略.........