MCPcopy Create free account
hub / github.com/OpenBoard-org/OpenBoard / moveScene

Method moveScene

src/core/UBSceneCache.cpp:167–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165
166
167void UBSceneCache::moveScene(std::shared_ptr<UBDocumentProxy> proxy, int sourceIndex, int targetIndex)
168{
169 UBSceneCacheID keySource(proxy, sourceIndex);
170
171 std::shared_ptr<SceneCacheEntry> entry;
172 bool hasEntry = mSceneCache.contains(keySource);
173
174 if (hasEntry)
175 {
176 entry = mSceneCache.value(keySource);
177 mCachedKeyFIFO.removeAll(keySource);
178 }
179
180 if (sourceIndex < targetIndex)
181 {
182 for (int i = sourceIndex + 1; i <= targetIndex; i++)
183 {
184 internalMoveScene(proxy, i, i - 1);
185 }
186 }
187 else
188 {
189 for (int i = sourceIndex - 1; i >= targetIndex; i--)
190 {
191 internalMoveScene(proxy, i, i + 1);
192 }
193 }
194
195 UBSceneCacheID keyTarget(proxy, targetIndex);
196
197 if (hasEntry)
198 {
199 insertEntry(keyTarget, entry);
200 mCachedKeyFIFO.enqueue(keyTarget);
201 }
202 else if (mSceneCache.contains(keyTarget))
203 {
204 entry = mSceneCache.take(keyTarget);
205 mCachedKeyFIFO.removeAll(keyTarget);
206 }
207
208}
209
210void UBSceneCache::reassignDocProxy(std::shared_ptr<UBDocumentProxy> newDocument, std::shared_ptr<UBDocumentProxy> oldDocument)
211{

Callers 4

deleteDocumentScenesMethod · 0.80
copyDocumentSceneMethod · 0.80
moveSceneToIndexMethod · 0.80

Calls 2

containsMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected