Example #1
0
 /**
  * @brief Database::addExistsScope
  * @param scope
  */
 void Database::addExistsScope(const entity::SharedScope &scope)
 {
     if (scope) {
         Q_ASSERT(!m_Scopes.contains(scope->id()));
         m_Scopes[scope->id()] = scope;
     }
 }
Example #2
0
    /**
     * @brief Database::recursiveFind
     * @param scope
     * @param id
     * @param ids
     */
    void Database::recursiveFind(entity::SharedScope scope, const QString &id, QStringList &ids) const
    {
        if (scope->scopes().isEmpty())  {
            ids.clear();
            return;
        }

        ids << scope->id();

        if (scope->containsChildScope(id)) {
            ids << scope->getChildScope(id)->id();
            return;
        } else {
            for (auto sc : scope->scopes()) recursiveFind(sc, id, ids);
        }
    }