本文整理汇总了C++中collection函数的典型用法代码示例。如果您正苦于以下问题:C++ collection函数的具体用法?C++ collection怎么用?C++ collection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了collection函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: shouldCreateCollections
void shouldCreateCollections()
{
// GIVEN
auto data = Testlib::AkonadiFakeData();
QScopedPointer<Akonadi::MonitorInterface> monitor(data.createMonitor());
QSignalSpy spy(monitor.data(), &Akonadi::MonitorInterface::collectionAdded);
auto c1 = Akonadi::Collection(42);
c1.setName(QStringLiteral("42"));
auto c2 = Akonadi::Collection(43);
c2.setName(QStringLiteral("43"));
const auto colSet = QSet<Akonadi::Collection>() << c1 << c2;
// WHEN
data.createCollection(c1);
data.createCollection(c2);
// THEN
QCOMPARE(data.collections().toList().toSet(), colSet);
QCOMPARE(data.collection(c1.id()), c1);
QCOMPARE(data.collection(c2.id()), c2);
QCOMPARE(spy.size(), 2);
QCOMPARE(spy.takeFirst().at(0).value<Akonadi::Collection>(), c1);
QCOMPARE(spy.takeFirst().at(0).value<Akonadi::Collection>(), c2);
}
开发者ID:KDE,项目名称:zanshin,代码行数:26,代码来源:akonadifakedatatest.cpp
示例2: run
void run() {
OperationContextImpl txn;
create();
BSONObj b = bigObj();
ASSERT( collection()->insertDocument( &txn, b, true ).isOK() );
ASSERT_EQUALS( 1, nRecords() );
}
开发者ID:ramgtv,项目名称:mongo,代码行数:7,代码来源:namespacetests.cpp
示例3: actionQueryGlobalStat
void actionQueryGlobalStat(const std::string &kindName, const std::string &filename)
{
MeasurementSet *ms = new MeasurementSet(filename);
const unsigned polarizationCount = ms->GetPolarizationCount();
const BandInfo band = ms->GetBandInfo(0);
delete ms;
const QualityTablesFormatter::StatisticKind kind = QualityTablesFormatter::NameToKind(kindName);
QualityTablesFormatter formatter(filename);
StatisticsCollection collection(polarizationCount);
collection.Load(formatter);
DefaultStatistics statistics(polarizationCount);
collection.GetGlobalCrossBaselineStatistics(statistics);
StatisticsDerivator derivator(collection);
double start = band.channels.begin()->frequencyHz;
double end = band.channels.rbegin()->frequencyHz;
std::cout << round(start/10000.0)/100.0 << '\t' << round(end/10000.0)/100.0;
for(unsigned p=0;p<polarizationCount;++p)
{
long double val = derivator.GetStatisticAmplitude(kind, statistics, p);
std::cout << '\t' << val;
}
std::cout << '\n';
}
开发者ID:jjdmol,项目名称:LOFAR,代码行数:26,代码来源:aoquality.cpp
示例4: collection
NoteEditTest::NoteEditTest()
{
qRegisterMetaType<Akonadi::Collection>();
qRegisterMetaType<KMime::Message::Ptr>();
QStandardPaths::setTestModeEnabled(true);
QStandardItemModel *model = new QStandardItemModel;
for (int id = 42; id < 51; ++id) {
Akonadi::Collection collection(id);
collection.setRights(Akonadi::Collection::AllRights);
collection.setName(QString::number(id));
collection.setContentMimeTypes(QStringList() << Akonadi::NoteUtils::noteMimeType());
QStandardItem *item = new QStandardItem(collection.name());
item->setData(QVariant::fromValue(collection),
Akonadi::EntityTreeModel::CollectionRole);
item->setData(QVariant::fromValue(collection.id()),
Akonadi::EntityTreeModel::CollectionIdRole);
model->appendRow(item);
}
MessageViewer::_k_noteEditStubModel = model;
// Fake a default-selected collection for shouldHaveDefaultValuesOnCreation test
MessageViewer::MessageViewerSettingsBase::self()->setLastNoteSelectedFolder(43);
}
开发者ID:KDE,项目名称:kdepim-addons,代码行数:26,代码来源:noteedittest.cpp
示例5: start
void start (collectiontype ct)
{
char ch = (ct == array) ? openbracket : openbrace;
output ({&ch, 1});
stack_.push (collection());
stack_.top().type = ct;
}
开发者ID:moorecoin,项目名称:MooreCoinService,代码行数:7,代码来源:JsonWriter.cpp
示例6: GetContactListModel
void SearchModel::searchPatternChanged(QString p)
{
SearchPatterns_ = Utils::GetPossibleStrings(p);
if (p.isEmpty())
{
unsigned size = (unsigned)Match_.size();
Match_ = GetContactListModel()->getSearchedContacts();
emit dataChanged(index(0), index(size));
return;
}
if (!SearchRequested_)
{
QTimer::singleShot(200, [this]()
{
SearchRequested_ = false;
Ui::gui_coll_helper collection(Ui::GetDispatcher()->create_collection(), true);
core::ifptr<core::iarray> patternsArray(collection->create_array());
patternsArray->reserve(SearchPatterns_.size());
for (auto iter = SearchPatterns_.begin(); iter != SearchPatterns_.end(); ++iter)
{
core::coll_helper coll(collection->create_collection(), true);
coll.set_value_as_string("pattern", iter->toUtf8().data(), iter->toUtf8().size());
core::ifptr<core::ivalue> val(collection->create_value());
val->set_as_collection(coll.get());
patternsArray->push_back(val.get());
}
collection.set_value_as_array("search_patterns", patternsArray.get());
Ui::GetDispatcher()->post_message_to_core("search", collection.get());
});
SearchRequested_ = true;
}
}
开发者ID:ICoderXI,项目名称:icqdesktop,代码行数:33,代码来源:SearchModel.cpp
示例7: collection
void ArchiveJob::execute()
{
if(mInfo) {
MailCommon::BackupJob *backupJob = new MailCommon::BackupJob();
Akonadi::Collection collection(mInfo->saveCollectionId());
backupJob->setRootFolder( MailCommon::Util::updatedCollection(collection) );
const QString realPath = MailCommon::Util::fullCollectionPath(collection);
backupJob->setSaveLocation( mInfo->realUrl(realPath) );
backupJob->setArchiveType( mInfo->archiveType() );
backupJob->setDeleteFoldersAfterCompletion( false );
backupJob->setRecursive( mInfo->saveSubCollection() );
backupJob->setDisplayMessageBox(false);
const QString summary = i18n("Start to archive %1",realPath );
const QPixmap pixmap = KIcon( "kmail" ).pixmap( KIconLoader::SizeSmall, KIconLoader::SizeSmall );
KNotification::event( QLatin1String("archivemailstarted"),
summary,
pixmap,
0,
KNotification::CloseOnTimeout,
KGlobal::mainComponent());
connect(backupJob,SIGNAL(backupDone(QString)),this,SLOT(slotBackupDone(QString)));
connect(backupJob,SIGNAL(error(QString)),this,SLOT(slotError(QString)));
backupJob->start();
}
}
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:26,代码来源:archivejob.cpp
示例8: GetControllerId
void
HdStreamTaskController::_CreateRenderTasks()
{
// Create two render tasks, one to create a color render, the other
// to create an id render (so we don't need to thrash params).
_renderTaskId = GetControllerId().AppendChild(_tokens->renderTask);
_idRenderTaskId = GetControllerId().AppendChild(_tokens->idRenderTask);
HdxRenderTaskParams renderParams;
renderParams.camera = _cameraId;
renderParams.viewport = GfVec4d(0,0,1,1);
HdRprimCollection collection(HdTokens->geometry, HdTokens->smoothHull);
collection.SetRootPath(SdfPath::AbsoluteRootPath());
SdfPath const renderTasks[] = {
_renderTaskId,
_idRenderTaskId,
};
for (size_t i = 0; i < sizeof(renderTasks)/sizeof(renderTasks[0]); ++i) {
GetRenderIndex()->InsertTask<HdxRenderTask>(&_delegate,
renderTasks[i]);
_delegate.SetParameter(renderTasks[i], HdTokens->params,
renderParams);
_delegate.SetParameter(renderTasks[i], HdTokens->children,
SdfPathVector());
_delegate.SetParameter(renderTasks[i], HdTokens->collection,
collection);
}
}
开发者ID:davidgyu,项目名称:USD,代码行数:31,代码来源:taskController.cpp
示例9: actionQueryTime
void actionQueryTime(const std::string &kindName, const std::string &filename)
{
const unsigned polarizationCount = MeasurementSet::GetPolarizationCount(filename);
const QualityTablesFormatter::StatisticKind kind = QualityTablesFormatter::NameToKind(kindName);
QualityTablesFormatter formatter(filename);
StatisticsCollection collection(polarizationCount);
collection.Load(formatter);
const std::map<double, DefaultStatistics> &timeStats = collection.TimeStatistics();
StatisticsDerivator derivator(collection);
std::cout << "TIME";
for(unsigned p=0;p<polarizationCount;++p)
std::cout << '\t' << kindName << "_POL" << p << "_R\t" << kindName << "_POL" << p << "_I" ;
std::cout << '\n';
for(std::map<double, DefaultStatistics>::const_iterator i=timeStats.begin();i!=timeStats.end();++i)
{
const double time = i->first;
std::cout << time;
for(unsigned p=0;p<polarizationCount;++p)
{
const std::complex<long double> val = derivator.GetComplexStatistic(kind, i->second, p);
std::cout << '\t' << val.real() << '\t' << val.imag();
}
std::cout << '\n';
}
}
开发者ID:jjdmol,项目名称:LOFAR,代码行数:27,代码来源:aoquality.cpp
示例10: actionQueryBaselines
void actionQueryBaselines(const std::string &kindName, const std::string &filename)
{
MeasurementSet *ms = new MeasurementSet(filename);
const unsigned polarizationCount = ms->GetPolarizationCount();
delete ms;
const QualityTablesFormatter::StatisticKind kind = QualityTablesFormatter::NameToKind(kindName);
QualityTablesFormatter formatter(filename);
StatisticsCollection collection(polarizationCount);
collection.Load(formatter);
const std::vector<std::pair<unsigned, unsigned> > &baselines = collection.BaselineStatistics().BaselineList();
StatisticsDerivator derivator(collection);
std::cout << "ANTENNA1\tANTENNA2";
for(unsigned p=0;p<polarizationCount;++p)
std::cout << '\t' << kindName << "_POL" << p << "_R\t" << kindName << "_POL" << p << "_I" ;
std::cout << '\n';
for(std::vector<std::pair<unsigned, unsigned> >::const_iterator i=baselines.begin();i!=baselines.end();++i)
{
const unsigned antenna1 = i->first, antenna2 = i->second;
std::cout << antenna1 << '\t' << antenna2;
for(unsigned p=0;p<polarizationCount;++p)
{
const std::complex<long double> val = derivator.GetComplexBaselineStatistic(kind, antenna1, antenna2, p);
std::cout << '\t' << val.real() << '\t' << val.imag();
}
std::cout << '\n';
}
}
开发者ID:jjdmol,项目名称:LOFAR,代码行数:30,代码来源:aoquality.cpp
示例11: assert
Field GroupOperation::PerformAggregation(std::vector<Record> const &vRecords, Field::Name const name, Aggregate const aggr) const
{
Field newField;
std::set<std::string> setUniqueValues;
if (aggr == Aggregate::NONE) {
assert(!vRecords.empty());
return vRecords.front().GetField(name);
}
for (Record const &rec : vRecords) {
Field const field(rec.GetField(name));
switch (aggr) {
case Aggregate::MIN: {
try {
newField = (newField.IsValid() ? (newField < field ? newField : field)
: field);
} catch(...) {
throw std::runtime_error("Failed to apply aggregate MIN to field " + Field::ToString(name));
}
break;
}
case Aggregate::MAX: {
try {
newField = (newField.IsValid() ? (newField > field ? newField : field)
: field);
} catch(...) {
throw std::runtime_error("Failed to apply aggregate MAX to field " + Field::ToString(name));
}
break;
}
case Aggregate::SUM: {
try {
newField = (newField.IsValid() ? newField + field : field);
} catch(...) {
throw std::runtime_error("Failed to apply aggregate SUM to field " + Field::ToString(name));
}
break;
}
case Aggregate::COUNT: {
setUniqueValues.insert(field.GetValue());
newField = Field(name, std::to_string(setUniqueValues.size()));
break;
}
case Aggregate::COLLECT: {
std::string collection(newField.IsValid() ? newField.GetValue() : "");
collection = (collection.empty() ? "[" + field.GetValue() + "]"
: collection.substr(0, collection.size() - 1) + "," + field.GetValue() + "]");
newField = Field(name, collection);
break;
}
default:
throw std::runtime_error("Unknown aggregate token");
}
}
return newField;
}
开发者ID:ssbotelh,项目名称:rentrak,代码行数:59,代码来源:GroupOperation.cpp
示例12: collection
std::shared_ptr<OsmAnd::FavoriteLocationsGpxCollection> OsmAnd::FavoriteLocationsGpxCollection::tryLoadFrom(QXmlStreamReader& reader)
{
std::shared_ptr<FavoriteLocationsGpxCollection> collection(new FavoriteLocationsGpxCollection());
if (!collection->loadFrom(reader))
return nullptr;
return collection;
}
开发者ID:SfietKonstantin,项目名称:OsmAnd-core,代码行数:8,代码来源:FavoriteLocationsGpxCollection.cpp
示例13: h
/// Method for generating hit(s) using the information of G4Step object.
template <> bool Geant4GenericSD<Calorimeter>::buildHits(G4Step* step,G4TouchableHistory*) {
StepHandler h(step);
Position pos = 0.5 * (h.prePos() + h.postPos());
HitContribution contrib = Geant4Hit::extractContribution(step);
Geant4CalorimeterHit* hit=find(collection(0),HitPositionCompare<Geant4CalorimeterHit>(pos));
// G4cout << "----------- Geant4GenericSD<Calorimeter>::buildHits : position : " << pos << G4endl;
if ( !hit ) {
hit = new Geant4CalorimeterHit(pos);
hit->cellID = getCellID( step );
collection(0)->insert(hit);
}
hit->truth.push_back(contrib);
hit->energyDeposit += contrib.deposit;
return true;
}
开发者ID:vvolkl,项目名称:DD4hep,代码行数:18,代码来源:Geant4CalorimeterSD.cpp
示例14: TEST_F
// Tests if the crate filter works along with other filters (artist)
TEST_F(SearchQueryParserTest, CrateFilterWithOther){
QStringList searchColumns;
searchColumns << "artist"
<< "album";
// User's search term
QString searchTerm = "test";
// Parse the user query
auto pQuery(m_parser.parseQuery(QString("crate: %1 artist: asdf").arg(searchTerm),
QStringList(), ""));
// locations for test tracks
const QString kTrackALocationTest(QDir::currentPath() %
"/src/test/id3-test-data/cover-test-jpg.mp3");
const QString kTrackBLocationTest(QDir::currentPath() %
"/src/test/id3-test-data/cover-test-png.mp3");
// Create new crate and add it to the collection
Crate testCrate;
testCrate.setName(searchTerm);
CrateId testCrateId;
collection()->insertCrate(testCrate, &testCrateId);
// Add the tracks in the collection
TrackId trackAId = addTrackToCollection(kTrackALocationTest);
TrackPointer pTrackA(Track::newDummy(kTrackALocationTest, trackAId));
TrackId trackBId = addTrackToCollection(kTrackBLocationTest);
TrackPointer pTrackB(Track::newDummy(kTrackBLocationTest, trackBId));
// Add trackA to the newly created crate
QList<TrackId> trackIds;
trackIds << trackAId;
collection()->addCrateTracks(testCrateId, trackIds);
pTrackA->setArtist("asdf");
pTrackB->setArtist("asdf");
EXPECT_TRUE(pQuery->match(pTrackA));
EXPECT_FALSE(pQuery->match(pTrackB));
EXPECT_STREQ(
qPrintable("(" + m_crateFilterQuery.arg(searchTerm) +
") AND ((artist LIKE '%asdf%') OR (album_artist LIKE '%asdf%'))"),
qPrintable(pQuery->toSql()));
}
开发者ID:WaylonR,项目名称:mixxx,代码行数:47,代码来源:searchqueryparsertest.cpp
示例15: setupFromQuery
void setupFromQuery(const BSONObj& query) {
CanonicalQuery* cq;
Status s = CanonicalQuery::canonicalize(ns(), query, &cq);
ASSERT(s.isOK());
_cq.reset(cq);
_oplogws.reset(new WorkingSet());
_stage.reset(new OplogStart(collection(), _cq->root(), _oplogws.get()));
}
开发者ID:AndrewCEmil,项目名称:mongo,代码行数:8,代码来源:oplogstarttests.cpp
示例16: shouldRemoveCollections
void shouldRemoveCollections()
{
// GIVEN
auto data = Testlib::AkonadiFakeData();
QScopedPointer<Akonadi::MonitorInterface> monitor(data.createMonitor());
QSignalSpy spy(monitor.data(), &Akonadi::MonitorInterface::collectionRemoved);
auto c1 = Akonadi::Collection(42);
c1.setName(QStringLiteral("42"));
data.createCollection(c1);
auto c2 = Akonadi::Collection(43);
c2.setName(QStringLiteral("43"));
c2.setParentCollection(Akonadi::Collection(42));
data.createCollection(c2);
auto c3 = Akonadi::Collection(44);
c3.setName(QStringLiteral("44"));
c3.setParentCollection(Akonadi::Collection(43));
data.createCollection(c3);
auto i1 = Akonadi::Item(42);
i1.setPayloadFromData("42");
i1.setParentCollection(Akonadi::Collection(43));
data.createItem(i1);
auto i2 = Akonadi::Item(43);
i2.setPayloadFromData("43");
i2.setParentCollection(Akonadi::Collection(44));
data.createItem(i2);
// WHEN
data.removeCollection(c2);
// THEN
QCOMPARE(data.collections().size(), 1);
QCOMPARE(data.collections().at(0), c1);
QVERIFY(!data.collection(c2.id()).isValid());
QVERIFY(!data.collection(c3.id()).isValid());
QVERIFY(data.childCollections(c1.id()).isEmpty());
QVERIFY(data.childCollections(c2.id()).isEmpty());
QVERIFY(data.childCollections(c3.id()).isEmpty());
QVERIFY(data.items().isEmpty());
QVERIFY(!data.item(i1.id()).isValid());
QVERIFY(!data.item(i2.id()).isValid());
QVERIFY(data.childItems(c2.id()).isEmpty());
QVERIFY(data.childItems(c3.id()).isEmpty());
QCOMPARE(spy.size(), 2);
QCOMPARE(spy.takeFirst().at(0).value<Akonadi::Collection>(), c3);
QCOMPARE(spy.takeFirst().at(0).value<Akonadi::Collection>(), c2);
}
开发者ID:KDE,项目名称:zanshin,代码行数:57,代码来源:akonadifakedatatest.cpp
示例17: collection
std::vector<Utterance> Engine::answers(const String& inName)
{
auto optState = collection().states().optionalObjectWithName(inName);
return (!optState)
? std::vector<Utterance>()
: std::vector<Utterance>(
optState->answers().utterances().begin(),
optState->answers().utterances().end());
}
开发者ID:leuski-ict,项目名称:jerome,代码行数:9,代码来源:engine.cpp
示例18: isImmediate
bool KSecretUnlockCollectionJob::isImmediate() const
{
// unlocked collections don't need a job to open
if(!collection()->isLocked()) {
return true;
} else {
return false;
}
}
开发者ID:KDE,项目名称:ksecrets,代码行数:9,代码来源:ksecretjobs.cpp
示例19: run
void run() {
auto indexCatalog = collection()->getIndexCatalog();
ASSERT_BSONOBJ_EQ(BSON("x" << 1), indexCatalog->fixIndexKey(BSON("x" << 1)));
ASSERT_BSONOBJ_EQ(BSON("_id" << 1), indexCatalog->fixIndexKey(BSON("_id" << 1)));
ASSERT_BSONOBJ_EQ(BSON("_id" << 1), indexCatalog->fixIndexKey(BSON("_id" << true)));
}
开发者ID:guoyr,项目名称:mongo,代码行数:9,代码来源:indexupdatetests.cpp
示例20: Q_ASSERT
void KSecretUnlockCollectionJob::askPasswordJobResult(KJob *job)
{
AbstractAskPasswordJob *apj = qobject_cast<AbstractAskPasswordJob*>(job);
Q_ASSERT(apj);
if(apj->cancelled()) {
setResult(false);
setError(BackendErrorOther, i18n("Unlocking the secret collection was canceled by the user."));
emitResult();
return;
}
KSecretCollection *ksecretColl = dynamic_cast< KSecretCollection* >(collection());
BackendReturn<bool> rc = ksecretColl->tryUnlockPassword(apj->password());
if(rc.isError()) {
setResult(false);
setError(rc.error(), rc.errorMessage());
emitResult();
} else if(!rc.value()) {
// try again the password
createAskPasswordJob();
} else {
m_passwordAsked = true;
m_collectionPerm = collection()->applicationPermission( unlockInfo().m_peer.exePath() );
if ( m_collectionPerm == PermissionUndefined ) {
// ask for the ACL preference if the application is unknown by this collection
AbstractUiManager *uiManager = BackendMaster::instance()->uiManager();
AbstractAskAclPrefsJob* askAclPrefsJob = uiManager->createAskAclPrefsJob(unlockInfo());
connect(askAclPrefsJob, SIGNAL(result(KJob*)), SLOT(askAclPrefsJobResult(KJob*)));
if ( addSubjob( askAclPrefsJob ) ) {
askAclPrefsJob->start();
}
else {
setResult(false);
emitResult();
}
}
else {
setResult(true);
emitResult();
}
}
}
开发者ID:KDE,项目名称:ksecrets,代码行数:44,代码来源:ksecretjobs.cpp
注:本文中的collection函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论