1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * XPLC - Cross-Platform Lightweight Components
4 * Copyright (C) 2002-2004, Net Integration Technologies, Inc.
5 * Copyright (C) 2003-2004, Pierre Phaneuf
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * as published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 * As a special exception, you may use this file as part of a free
23 * software library without restriction. Specifically, if other files
24 * instantiate templates or use macros or inline functions from this
25 * file, or you compile this file and link it with other files to
26 * produce an executable, this file does not by itself cause the
27 * resulting executable to be covered by the GNU Lesser General Public
28 * License. This exception does not however invalidate any other
29 * reasons why the executable file might be covered by the GNU Lesser
30 * General Public License.
33 #include <xplc/IMoniker.h>
34 #include <xplc/IFactory.h>
35 #include <xplc/IModuleManagerFactory.h>
36 #include <xplc/xplc.h>
39 void XPLC::addModuleDirectory(const char* directory
) {
40 xplc_ptr
<IModuleManagerFactory
> factory(get
<IModuleManagerFactory
>(XPLC_moduleManagerFactory
));
45 xplc_ptr
<IServiceHandler
> modulemgr(factory
->createModuleManager(directory
));
50 servmgr
->addHandler(modulemgr
);
53 IObject
* XPLC::create(const UUID
& cid
) {
57 xplc_ptr
<IFactory
> factory(mutate
<IFactory
>(servmgr
->getObject(cid
)));
62 return factory
->createObject();
65 IObject
* XPLC::create(const char* aMoniker
) {
69 xplc_ptr
<IMoniker
> moniker(mutate
<IMoniker
>(servmgr
->getObject(XPLC_monikers
)));
73 xplc_ptr
<IFactory
> factory(mutate
<IFactory
>(moniker
->resolve(aMoniker
)));
77 return factory
->createObject();