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

Method findDocument

src/document/UBDocument.cpp:194–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194std::shared_ptr<UBDocument> UBDocument::findDocument(std::shared_ptr<UBDocumentProxy> proxy)
195{
196 if (!proxy)
197 {
198 return nullptr;
199 }
200
201 for (int i = 0; i < sDocuments.size();)
202 {
203 const auto document = sDocuments.at(i).lock();
204
205 if (!document)
206 {
207 // weak pointer expired, clean up list
208 sDocuments.removeAt(i);
209 }
210 else if (document->mProxy == proxy)
211 {
212 // document found
213 return document;
214 }
215 else
216 {
217 // check next list entry
218 ++i;
219 }
220 }
221
222 return nullptr;
223}

Callers 1

documentUpdatedMethod · 0.80

Calls 2

lockMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected