KDE 4.2 PyKDE API Reference

- KDE's Python API

# KSycocaFactory Class Reference

`from PyKDE4.kdecore import *`

## Detailed Description

Abstract class:
  This class can be used as a base class for new classes, but can not be instantiated directly.

Internal:
  Base class for sycoca factories

## Methods

| __init__ (self, KSycocaFactoryId factory_id)
| addEntry (self, KSycocaEntry.Ptr newEntry)
KSycocaEntry.List | allEntries (self)
KSycocaEntry | createEntry (self, QString file, QString resource)
KSycocaEntry | createEntry (self, int offset)
KSycocaEntryDict | entryDict (self)
KSycocaFactoryId | factoryId (self)
bool | isEmpty (self)
int | offset (self)
| removeEntry (self, QString entryName)
KSycocaResourceList | resourceList (self)
| save (self, QDataStream str)
| saveHeader (self, QDataStream str)
KSycocaDict | sycocaDict (self)
| virtual_hook (self, int id, void data)

## Method Documentation

__init__ | ( | self, |
|  | KSycocaFactoryId | factory_id
| ) |  |  |

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

addEntry | ( | self, |
|  | KSycocaEntry.Ptr | newEntry
| ) |  |  |

Add an entry

KSycocaEntry.List allEntries | ( |  | self ) |

Get a list of all entries from the database.

KSycocaEntry createEntry | ( | self, |
|  | QString | file,
|  | QString | resource
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Construct an entry from a config file. To be implemented in the real factories.

KSycocaEntry createEntry | ( | self, |
|  | int | offset
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Read an entry from the database

KSycocaEntryDict entryDict | ( |  | self ) |

Returns:
  the dict, for special use by KBuildSycoca

KSycocaFactoryId factoryId | ( |  | self ) |

Abstract method:
  This method is abstract and can be overridden but not called directly.

bool isEmpty | ( |  | self ) |

Returns:
  true if the factory is completely empty - no entries defined

int offset | ( |  | self ) |

Returns:
  the position of the factory in the sycoca file

removeEntry | ( | self, |
|  | QString | entryName
| ) |  |  |

Remove all entries with the given name. Not very fast (O(N)), use with care.

KSycocaResourceList resourceList | ( |  | self ) |

Returns:
  the resources for which this factory is responsible.

Internal:
  to kbuildsycoca

save | ( | self, |
|  | QDataStream | str
| ) |  |  |

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.

saveHeader | ( | self, |
|  | QDataStream | str
| ) |  |  |

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.

KSycocaDict sycocaDict | ( |  | self ) |

Returns:
  the sycoca dict, for factories to find entries by name.

virtual_hook | ( | self, |
|  | int | id,
|  | void | data
| ) |  |  |

Virtual hook, used to add new "virtual" functions while maintaining binary compatibility. Unused in this class.