Sqlite: Make the statement conversion operator id aware

Before you had to use an constructor which is has an integer as
parameter. Like

struct Foo
{
  Foo{long long id} : id{id} {}
  Foo{TypeId id} : id{id} {}

  TypeId id;
}

Now you can write:

struct Foo
{
  TypeId id;
}

With C++ 20 we can even remove more contructors.

Change-Id: I374505a037a71339b672f5f3a57b06dcf443b4bf
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Marco Bubke
2022-07-19 14:33:00 +02:00
parent fdcb02d5e2
commit 93d0b5a1d3
15 changed files with 194 additions and 198 deletions

View File

@@ -117,9 +117,9 @@ protected:
NiceMock<FileSystemMock> mockFileSystem;
Watcher watcher{sourcePathCacheMock, mockFileSystem, &notifier};
NiceMock<MockQFileSytemWatcher> &mockQFileSytemWatcher = watcher.fileSystemWatcher();
ProjectChunkId id1{ProjectPartId{2}, SourceType::Qml};
ProjectChunkId id2{ProjectPartId{2}, SourceType::QmlUi};
ProjectChunkId id3{ProjectPartId{4}, SourceType::QmlTypes};
ProjectChunkId id1{ProjectPartId::create(2), SourceType::Qml};
ProjectChunkId id2{ProjectPartId::create(2), SourceType::QmlUi};
ProjectChunkId id3{ProjectPartId::create(4), SourceType::QmlTypes};
SourcePathView path1{"/path/path1"};
SourcePathView path2{"/path/path2"};
SourcePathView path3{"/path2/path1"};
@@ -132,8 +132,14 @@ protected:
QString sourceContextPath3 = "/path3";
Utils::PathString sourceContextPathString = sourceContextPath;
Utils::PathString sourceContextPathString2 = sourceContextPath2;
SourceIds pathIds = {SourceId{1}, SourceId{2}, SourceId{3}, SourceId{4}, SourceId{5}};
SourceContextIds sourceContextIds = {SourceContextId{1}, SourceContextId{2}, SourceContextId{3}};
SourceIds pathIds = {SourceId::create(1),
SourceId::create(2),
SourceId::create(3),
SourceId::create(4),
SourceId::create(5)};
SourceContextIds sourceContextIds = {SourceContextId::create(1),
SourceContextId::create(2),
SourceContextId::create(3)};
ProjectChunkIds ids{id1, id2, id3};
WatcherEntry watcherEntry1{id1, sourceContextIds[0], pathIds[0]};
WatcherEntry watcherEntry2{id2, sourceContextIds[0], pathIds[0]};
@@ -273,7 +279,7 @@ TEST_F(ProjectStoragePathWatcher, RemoveEntriesWithId)
{id2, {pathIds[0], pathIds[1]}},
{id3, {pathIds[1], pathIds[3]}}});
watcher.removeIds({ProjectPartId{2}});
watcher.removeIds({ProjectPartId::create(2)});
ASSERT_THAT(watcher.watchedEntries(), ElementsAre(watcherEntry5, watcherEntry8));
}
@@ -370,9 +376,9 @@ TEST_F(ProjectStoragePathWatcher, TwoNotifyFileChanges)
.WillByDefault(Return(FileStatus{pathIds[3], 1, 2}));
EXPECT_CALL(notifier,
pathsWithIdsChanged(
ElementsAre(IdPaths{id1, {SourceId{1}, SourceId{2}}},
IdPaths{id2, {SourceId{1}, SourceId{2}, SourceId{4}}})));
pathsWithIdsChanged(ElementsAre(
IdPaths{id1, {SourceId::create(1), SourceId::create(2)}},
IdPaths{id2, {SourceId::create(1), SourceId::create(2), SourceId::create(4)}})));
mockQFileSytemWatcher.directoryChanged(sourceContextPath);
mockQFileSytemWatcher.directoryChanged(sourceContextPath2);