summaryrefslogtreecommitdiffstats
path: root/kbabel/kbabeldict/modules/dbsearchengine/dbse_factory.cpp
blob: 2273a9c46e4c912e49491a38d73612f9da1ca4c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

#include <tdelocale.h>
#include <kinstance.h>
#include <tdeaboutdata.h>
#include <kdebug.h>

#include "dbse_factory.h"
#include "KDBSearchEngine.h"


extern "C"
{
	KDE_EXPORT void *init_kbabeldict_dbsearchengine()
	{
		return new DbSeFactory;
	}
}


TDEInstance *DbSeFactory::s_instance = 0;
TDEAboutData *DbSeFactory::s_about = 0;


DbSeFactory::DbSeFactory( TQObject *parent, const char *name)
		: KLibFactory(parent,name)
{
}

DbSeFactory::~DbSeFactory()
{
	if(s_instance)
	{
		delete s_instance;
		s_instance=0;
	}

	if(s_about)
	{
		delete s_about;
		s_about=0;
	}
}


TQObject *DbSeFactory::createObject( TQObject *parent, const char *name,
				    const char *classname, const TQStringList &)
{
	if(TQCString(classname) != "SearchEngine")
	{
		kdError() << "not a SearchEngine requested" << endl;
		return 0;
	}
	
	KDBSearchEngine *se = new KDBSearchEngine(parent,name);

	emit objectCreated(se);
	return se;
}


TDEInstance *DbSeFactory::instance()
{
	if(!s_instance)
	{

		s_about = new TDEAboutData( "kdbsearchengine",
			      I18N_NOOP("Translation Database")
				, "0.3"	,
I18N_NOOP("A fast translation search engine based on databases")
						, TDEAboutData::License_GPL
						, I18N_NOOP("Copyright 2000-2001 by Andrea Rizzi")
						,0,0, "[email protected]");

		s_about->addAuthor("Andrea Rizzi",0,"[email protected]");

		s_instance = new TDEInstance(s_about);
	}

	return s_instance;
}

#include "dbse_factory.moc"