kdecore Library API Documentation

KSycocaFactory Class Reference

Inheritance diagram for KSycocaFactory:

Inheritance graph
[legend]
Collaboration diagram for KSycocaFactory:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual KSycocaFactoryId factoryId () const =0
virtual ~KSycocaFactory ()
int offset ()
KSycocaEntryDictentryDict ()
virtual KSycocaEntrycreateEntry (const QString &file, const char *resource)=0
virtual void addEntry (KSycocaEntry *newEntry, const char *resource)
void removeEntry (KSycocaEntry *newEntry)
virtual KSycocaEntrycreateEntry (int offset)=0
KSycocaEntry::List allEntries ()
virtual void save (QDataStream &str)
virtual void saveHeader (QDataStream &str)
virtual const KSycocaResourceList * resourceList () const

Protected Member Functions

 KSycocaFactory (KSycocaFactoryId factory_id)
virtual void virtual_hook (int id, void *data)

Protected Attributes

int m_sycocaDictOffset
int m_beginEntryOffset
int m_endEntryOffset
QDataStreamm_str
KSycocaResourceList * m_resourceList
KSycocaEntryDictm_entryDict
KSycocaDictm_sycocaDict

Related Functions

(Note that these are not member functions.)

enum  KSycocaFactoryId {
  KST_KServiceFactory = 1, KST_KServiceTypeFactory = 2, KST_KServiceGroupFactory = 3, KST_KImageIO = 4,
  KST_KProtocolInfoFactory = 5, KST_CTimeInfo = 100
}

Detailed Description

Definition at line 39 of file ksycocafactory.h.


Constructor & Destructor Documentation

KSycocaFactory::KSycocaFactory KSycocaFactoryId  factory_id  )  [protected]
 

Create a factory which can be used to lookup from/create a database (depending on KSycoca::isBuilding()).

Definition at line 31 of file ksycocafactory.cpp.

References KSycoca::addFactory(), QDataStream::device(), KSycoca::findFactory(), m_beginEntryOffset, m_endEntryOffset, m_entryDict, m_resourceList, m_str, m_sycocaDict, m_sycocaDictOffset, KSycoca::self(), and QDict::setAutoDelete().


Member Function Documentation

int KSycocaFactory::offset  )  [inline]
 

Returns:
the position of the factory in the sycoca file

Definition at line 57 of file ksycocafactory.h.

Referenced by KProtocolInfoFactory::findProtocol().

KSycocaEntryDict* KSycocaFactory::entryDict  )  [inline]
 

Returns:
the dict, for special use by KBuildSycoca

Definition at line 62 of file ksycocafactory.h.

virtual KSycocaEntry* KSycocaFactory::createEntry const QString file,
const char *  resource
[pure virtual]
 

Construct an entry from a config file.

To be implemented in the real factories.

Implemented in KImageIOFactory, KServiceFactory, KServiceGroupFactory, KServiceTypeFactory, and KProtocolInfoFactory.

Referenced by allEntries().

void KSycocaFactory::addEntry KSycocaEntry newEntry,
const char *  resource
[virtual]
 

Add an entry.

Definition at line 140 of file ksycocafactory.cpp.

References KSycocaDict::add(), QDict::insert(), m_entryDict, m_sycocaDict, and KSycocaEntry::name().

void KSycocaFactory::removeEntry KSycocaEntry newEntry  ) 
 

Remove an entry Not very fast, use with care.

O(N)

Definition at line 153 of file ksycocafactory.cpp.

References m_entryDict, m_sycocaDict, KSycocaEntry::name(), KSycocaDict::remove(), and QDict::remove().

virtual KSycocaEntry* KSycocaFactory::createEntry int  offset  )  [pure virtual]
 

Read an entry from the database.

Implemented in KImageIOFactory, KServiceFactory, KServiceGroupFactory, KServiceTypeFactory, and KProtocolInfoFactory.

KSycocaEntry::List KSycocaFactory::allEntries  ) 
 

Get a list of all entries from the database.

Definition at line 165 of file ksycocafactory.cpp.

References QValueList::append(), createEntry(), QDataStream::device(), KSycoca::flagError(), m_endEntryOffset, and m_str.

Referenced by KProtocolInfoFactory::protocols().

void KSycocaFactory::save QDataStream str  )  [virtual]
 

Saves all entries it maintains as well as index files for these entries to the stream 'str'.

Also sets mOffset to the starting position.

The stream is positioned at the end of the last index.

Don't forget to call the parent first when you override this function.

Definition at line 88 of file ksycocafactory.cpp.

References QDictIterator::current(), QDataStream::device(), m_beginEntryOffset, m_endEntryOffset, m_entryDict, m_sycocaDict, m_sycocaDictOffset, KSycocaEntry::offset(), KSycocaDict::save(), KSycocaEntry::save(), and saveHeader().

void KSycocaFactory::saveHeader QDataStream str  )  [virtual]
 

Writes out a header to the stream 'str'.

The baseclass positions the stream correctly.

Don't forget to call the parent first when you override this function.

Definition at line 78 of file ksycocafactory.cpp.

References QDataStream::device(), m_beginEntryOffset, m_endEntryOffset, and m_sycocaDictOffset.

Referenced by save().

virtual const KSycocaResourceList* KSycocaFactory::resourceList  )  const [inline, virtual]
 

Returns:
the resources for which this factory is responsible.

Definition at line 116 of file ksycocafactory.h.


Friends And Related Function Documentation

enum KSycocaFactoryId [related]
 

A KSycocaFactoryId is a code (out of the KSycocaFactoryId enum) assigned to each class type derived from KSycocaFactory. To use it, call the macro K_SYCOCAFACTORY( your_factory_id ) at the top of your class definition.

Definition at line 50 of file ksycocatype.h.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdecore Library Version 3.4.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Oct 9 07:55:12 2005 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003