27 lines
643 B
C++
27 lines
643 B
C++
#include "SqlDocumentRegistry.h"
|
|
#include "SqlDocument.h"
|
|
|
|
void SqlDocumentRegistry::add(const std::shared_ptr<SqlDocument> &document)
|
|
{
|
|
m_documents.push_back(document);
|
|
}
|
|
|
|
QList<std::shared_ptr<SqlDocument>> SqlDocumentRegistry::documents() const
|
|
{
|
|
QList<std::shared_ptr<SqlDocument>> result;
|
|
for (const auto &weak : m_documents) {
|
|
if (auto doc = weak.lock())
|
|
result.append(doc);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
QList<std::shared_ptr<SqlDocument>> SqlDocumentRegistry::modifiedDocuments() const
|
|
{
|
|
QList<std::shared_ptr<SqlDocument>> result;
|
|
for (auto &doc : documents()) {
|
|
if (doc->isModified())
|
|
result.append(doc);
|
|
}
|
|
return result;
|
|
}
|