20 #include <kstandarddirs.h>
21 #include <tdeglobal.h>
22 #include <tdeapplication.h>
24 #include <tdesycoca.h>
25 #include <tdesycocadict.h>
27 #include "kprotocolinfofactory.h"
32 KProtocolInfoFactory::KProtocolInfoFactory() : KSycocaFactory( KST_KProtocolInfoFactory )
37 KProtocolInfoFactory::~KProtocolInfoFactory()
44 KProtocolInfoFactory::createEntry(
int offset)
46 KProtocolInfo *info = 0;
48 TQDataStream *str = KSycoca::self()->findEntry(offset, type);
51 case KST_KProtocolInfo:
52 info =
new KProtocolInfo(*str, offset);
70 KSycocaEntry::List list = allEntries();
71 for( KSycocaEntry::List::Iterator it = list.begin();
76 KProtocolInfo *info =
static_cast<KProtocolInfo *
>(entry);
78 res.append( info->name() );
85 KProtocolInfoFactory::findProtocol(
const TQString &protocol)
87 if (!m_sycocaDict)
return 0;
89 TQMap<TQString,KProtocolInfo::Ptr>::iterator it = m_cache.find(protocol);
90 if (it != m_cache.end())
95 offset = m_sycocaDict->find_string( protocol );
97 if (!offset)
return 0;
99 KProtocolInfo *info = createEntry(offset);
101 if (info && (info->name() != protocol))
107 m_cache.insert(protocol,info);
111 void KProtocolInfoFactory::virtual_hook(
int id,
void* data )
112 { KSycocaFactory::virtual_hook(
id, data ); }
KProtocolInfoFactory is a factory for getting KProtocolInfo.
TQStringList protocols()
Returns list of all known protocols.
Base class for all Sycoca entries.