Exemplo n.º 1
0
KeyList
BaseG::secretKeys(const QStringList &patterns)
{
    int exitStatus = 0;

    // the option --with-colons should be used for interprocess communication
    // with gpg (according to Werner Koch)
    QCString cmd = "--batch --list-secret-keys --with-fingerprint --with-colons "
                   "--fixed-list-mode";
    for(QStringList::ConstIterator it = patterns.begin();
            it != patterns.end(); ++it)
    {
        cmd += " ";
        cmd += KProcess::quote(*it).local8Bit();
    }
    status = 0;
    exitStatus = runGpg(cmd, 0, true);

    if(exitStatus != 0)
    {
        status = ERROR;
        return KeyList();
    }

    // now we need to parse the output for secret keys
    KeyList secretKeys = parseKeyList(output, true);

    // sort the list of secret keys
    secretKeys.sort();

    return secretKeys;
}
Exemplo n.º 2
0
///
/// \brief AnalysisResults::Replicate
/// \return
/// Used in lieu of a copy constructor. Does not produce a perfect copy
/// but does copy name, type, matrices, etc. does not replicate most metadata
QSharedPointer<AnalysisResults> AnalysisResults::Replicate()
{
    QSharedPointer<AnalysisResults> new_result(new AnalysisResults(name_, type_));
    for (auto key: KeyList()) {
        new_result->AddMatrix(key, GetMatrix(key));
    }
    return new_result;
}
Exemplo n.º 3
0
///
/// \brief AnalysisResults::Concatenate
/// \param other
/// Merge the matrices of other into the same-named matrices of this one
/// Will perform a check of mergability for every matrix before performing merge
/// Non mergable matrices are removed from this result.
bool AnalysisResults::Concatenate(QSharedPointer<AnalysisResults> other)
{
    QSet<QString> intersection = KeyList().toSet().intersect(other->KeyList().toSet());
    //Check mergability (this should not be a problem if both come from same dataset)
    //User may be allowed to merge from two different datasets, if for some reason they wanted to do that
    QSet<QString> mergeable_matrices = intersection;
    for (auto key: intersection)
        if (GetMatrix(key).n_rows != other->GetMatrix(key).n_rows) {
            mergeable_matrices.remove(key);
            RemoveMatrix(key);
        }
    if (mergeable_matrices.isEmpty()) return false;
    for (auto key: mergeable_matrices) {
        mat matrix = GetMatrix(key);
        mat other_matrix = other->GetMatrix(key);
        matrix = join_horiz(matrix, other_matrix);
        AddMatrix(key, matrix);
    }
    return true;
}