• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

  • tdecore
klibloader.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 1999 Torben Weis <weis@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 #ifndef KLIBLOADER_H
19 #define KLIBLOADER_H
20 
21 #include <tqobject.h>
22 #include <tqstring.h>
23 #include <tqstringlist.h>
24 #include <tqasciidict.h>
25 #include <tqptrlist.h>
26 #include <tdeglobal.h>
27 
28 #include <stdlib.h> // For backwards compatibility
29 
30 class TDEInstance;
31 class TQTimer;
32 class KLibrary;
33 class KLibFactory;
34 class KLibFactoryPrivate;
35 class KLibLoaderPrivate;
36 class KLibraryPrivate;
37 
38 # define K_EXPORT_COMPONENT_FACTORY( libname, factory ) \
39  extern "C" { KDE_EXPORT void *init_##libname() { return new factory; } }
40 
50 class TDECORE_EXPORT KLibrary : public TQObject
51 {
52  friend class KLibLoader;
53  friend class TQAsciiDict<KLibrary>;
54 
55  Q_OBJECT
56 public:
60  KLibrary( const TQString& libname, const TQString& filename, void * handle );
61 
66  TQString name() const;
67 
72  TQString fileName() const;
73 
78  KLibFactory* factory();
79 
89  void* symbol( const char* name ) const;
90 
100  bool hasSymbol( const char* name ) const;
101 
107  void unload() const;
108 
109 private slots:
110  void slotObjectCreated( TQObject *obj );
111  void slotObjectDestroyed();
112  void slotTimeout();
113 
114 private:
119  ~KLibrary();
120 
121  TQString m_libname;
122  TQString m_filename;
123  KLibFactory* m_factory;
124  void * m_handle;
125  TQPtrList<TQObject> m_objs;
126  TQTimer *m_timer;
127  KLibraryPrivate *d;
128 };
129 
130 class KLibWrapPrivate;
131 
142 class TDECORE_EXPORT KLibLoader : public TQObject
143 {
144  friend class KLibrary;
145 
146  Q_OBJECT
147 public:
153  ~KLibLoader();
154 
175  KLibFactory* factory( const char* libname );
176 
197  virtual KLibrary* library( const char* libname );
198 
221  KLibrary* globalLibrary( const char *name );
222 
230  TQString lastErrorMessage() const;
231 
246  virtual void unloadLibrary( const char *libname );
247 
254  static KLibLoader* self();
255 
264  static void cleanUp();
265 
276  static TQString findLibrary( const char * name, const TDEInstance * instance = TDEGlobal::instance() );
277 
278 protected:
279  KLibLoader( TQObject* parent = 0, const char* name = 0 );
280 
281 private slots:
282  void slotLibraryDestroyed();
283 private:
284  void close_pending( KLibWrapPrivate * );
285  TQAsciiDict<KLibWrapPrivate> m_libs;
286 
287  static KLibLoader* s_self;
288 
289 protected:
290  virtual void virtual_hook( int id, void* data );
291 private:
292  KLibLoaderPrivate *d;
293 };
294 
333 class TDECORE_EXPORT KLibFactory : public TQObject
334 {
335  Q_OBJECT
336 public:
342  KLibFactory( TQObject* parent = 0, const char* name = 0 );
343  virtual ~KLibFactory();
344 
366  TQObject* create( TQObject* parent = 0, const char* name = 0, const char* classname = TQOBJECT_OBJECT_NAME_STRING, const TQStringList &args = TQStringList() );
367 
368 signals:
373  void objectCreated( TQObject *obj );
374 
375 
376 protected:
377 
394  virtual TQObject* createObject( TQObject* parent = 0, const char* name = 0,
395  const char* className = TQOBJECT_OBJECT_NAME_STRING,
396  const TQStringList &args = TQStringList() ) = 0;
397 
398 
399 protected:
400  virtual void virtual_hook( int id, void* data );
401 private:
402  KLibFactoryPrivate *d;
403 };
404 
405 #endif
KLibFactory
If you develop a library that is to be loaded dynamically at runtime, then you should return a pointe...
Definition: klibloader.h:333
KLibrary::name
TQString name() const
Returns the name of the library.
Definition: klibloader.cpp:138
TDEGlobal::instance
static TDEInstance * instance()
Returns the global instance.
Definition: tdeglobal.cpp:102
KLibrary
Represents a dynamically loaded library.
Definition: klibloader.h:50
KLibrary::factory
KLibFactory * factory()
Returns the factory of the library.
Definition: klibloader.cpp:148
KLibLoader
The KLibLoader allows you to load libraries dynamically at runtime.
Definition: klibloader.h:142
TDEInstance
Access to KDE global objects for use in shared libraries.
Definition: kinstance.h:47

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.8.8
This website is maintained by Timothy Pearson.