37 #include "hierarchyanalyser.h"
42 HierarchyAnalyser::HierarchyAnalyser( TQObject * parent,
const char * name )
43 : TQObject( parent, name )
48 HierarchyAnalyser::~HierarchyAnalyser() {
52 void HierarchyAnalyser::slotNextKey(
const GpgME::Key & key ) {
55 if ( key.isRoot() || !key.chainID() || !*key.chainID() )
58 mSubjectsByIssuer[0].push_back( key );
60 mSubjectsByIssuer[key.chainID()].push_back( key );
63 const std::vector<GpgME::Key> & HierarchyAnalyser::subjectsForIssuer(
const char * issuer_dn )
const {
64 static const std::vector<GpgME::Key> empty;
65 std::map< TQCString, std::vector<GpgME::Key> >::const_iterator it =
66 mSubjectsByIssuer.find( issuer_dn );
67 return it == mSubjectsByIssuer.end() ? empty : it->second ;
70 std::vector<GpgME::Key> HierarchyAnalyser::subjectsForIssuerRecursive(
const char * issuer_dn )
const {
71 std::vector<GpgME::Key> keys = subjectsForIssuer( issuer_dn );
72 for (
unsigned int i = 0 ; i < keys.size() ; ++i )
73 if (
const char * fpr = keys[i].primaryFingerprint() ) {
74 const std::vector<GpgME::Key> & tmp = subjectsForIssuer( fpr );
75 std::copy( tmp.begin(), tmp.end(), std::back_inserter( keys ) );
81 #include "hierarchyanalyser.moc"