• 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
30class TDEInstance;
31class TQTimer;
32class KLibrary;
33class KLibFactory;
34class KLibFactoryPrivate;
35class KLibLoaderPrivate;
36class KLibraryPrivate;
37
38# define K_EXPORT_COMPONENT_FACTORY( libname, factory ) \
39 extern "C" { TDE_EXPORT void *init_##libname() { return new factory; } }
40
50class TDECORE_EXPORT KLibrary : public TQObject
51{
52 friend class KLibLoader;
53 friend class TQAsciiDict<KLibrary>;
54
55 TQ_OBJECT
56public:
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
109private slots:
110 void slotObjectCreated( TQObject *obj );
111 void slotObjectDestroyed();
112 void slotTimeout();
113
114private:
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
130class KLibWrapPrivate;
131
142class TDECORE_EXPORT KLibLoader : public TQObject
143{
144 friend class KLibrary;
145
146 TQ_OBJECT
147public:
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
278protected:
279 KLibLoader( TQObject* parent = 0, const char* name = 0 );
280
281private slots:
282 void slotLibraryDestroyed();
283private:
284 void close_pending( KLibWrapPrivate * );
285 TQAsciiDict<KLibWrapPrivate> m_libs;
286
287 static KLibLoader* s_self;
288
289protected:
290 virtual void virtual_hook( int id, void* data );
291private:
292 KLibLoaderPrivate *d;
293};
294
333class TDECORE_EXPORT KLibFactory : public TQObject
334{
335 TQ_OBJECT
336public:
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", const TQStringList &args = TQStringList() );
367
368signals:
373 void objectCreated( TQObject *obj );
374
375
376protected:
377
394 virtual TQObject* createObject( TQObject* parent = 0, const char* name = 0,
395 const char* className = "TQObject",
396 const TQStringList &args = TQStringList() ) = 0;
397
398
399protected:
400 virtual void virtual_hook( int id, void* data );
401private:
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:334
KLibFactory::objectCreated
void objectCreated(TQObject *obj)
Emitted in create.
KLibLoader
The KLibLoader allows you to load libraries dynamically at runtime.
Definition: klibloader.h:143
KLibrary
Represents a dynamically loaded library.
Definition: klibloader.h:51
KLibrary::name
TQString name() const
Returns the name of the library.
Definition: klibloader.cpp:138
KLibrary::factory
KLibFactory * factory()
Returns the factory of the library.
Definition: klibloader.cpp:148
TDEGlobal::instance
static TDEInstance * instance()
Returns the global instance.
Definition: tdeglobal.cpp:102
TDEInstance
Access to KDE global objects for use in shared libraries.
Definition: kinstance.h:48

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
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.4
This website is maintained by Timothy Pearson.