Classes - Annotated - Tree - Functions - Home - Structure

QComponentFactory Class Reference

The QComponentFactory class provides static functions to create components. More...

#include <qcomponentfactory.h>

List of all member functions.

Static Public Members


Detailed Description

The QComponentFactory class provides static functions to create components.

The createInstance() function is used to obtain a pointer to an interface.

Use registerServer() to load a shared library which provides the QComponentServerInterface and register its components. Use unregisterServer() to unregister a shared library's components.

See also QComponentServerInterface and QComponentFactoryInterface.


Member Function Documentation

QRESULT QComponentFactory::createInstance ( const QUuid & cid, const QUuid & iid, QUnknownInterface ** instance, QUnknownInterface * outer ) [static]

Looks up the component identifier cid in the system registry, loads the corresponding component server and queries for the interface iid. The parameter outer is a pointer to the outer interface used for containment and aggregation and is propagated to the createInstance implementation of the QComponentFactoryInterface provided by the component server if provided. Returns the retrieved interface pointer, or NULL if there was an error.

Example:

  MyInterface *iface = (MyInterface*)QComponentFactory::createInstance( IID_MyInterface, CID_MyComponent );
  if ( iface ) {
      ...
      iface->release();
  }
  

bool QComponentFactory::registerServer ( const QString & filename ) [static]

Loads the shared library filename and queries for a QComponentServerInterface. If the library implements this interface, the registerComponents function is called.

Returns TRUE if the interface is found and successfully registered, otherwise returns FALSE.

bool QComponentFactory::unregisterServer ( const QString & filename ) [static]

Loads the shared library filename and queries for a QComponentServerInterface. If the library implements this interface, the unregisterComponents function is called.

Returns TRUE if the interface is found and successfully unregistered, otherwise returns FALSE.


Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):


This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.


Copyright © 2000 TrolltechTrademarks
Qt version main-beta1