WvStreams
getiface.cc
1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 *
3 * XPLC - Cross-Platform Lightweight Components
4 * Copyright (C) 2002, Pierre Phaneuf
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 * USA
20 *
21 * As a special exception, you may use this file as part of a free
22 * software library without restriction. Specifically, if other files
23 * instantiate templates or use macros or inline functions from this
24 * file, or you compile this file and link it with other files to
25 * produce an executable, this file does not by itself cause the
26 * resulting executable to be covered by the GNU Lesser General Public
27 * License. This exception does not however invalidate any other
28 * reasons why the executable file might be covered by the GNU Lesser
29 * General Public License.
30 */
31
32#include <xplc/utils.h>
33#include <xplc/uuidops.h>
34
39
41 const UUID& uuid,
42 const UUID_Info* uuidlist) {
43 IObject* rv;
44
45 while(uuidlist->iid) {
46 if(*(uuidlist->iid) == uuid) {
47 rv = reinterpret_cast<IObject*>
48 (reinterpret_cast<ptrdiff_t>(self) + uuidlist->delta);
49 rv->addRef();
50 return rv;
51 }
52 uuidlist++;
53 }
54
55 return 0;
56}
57
The basic interface which is included by all other XPLC interfaces and objects.
virtual unsigned int addRef()=0
Indicate you are using this object.
Represents a weak reference to another object.
Common implementation of a weak reference.
#define UUID_MAP_END
Marks the end of an interface map.
#define UUID_MAP_BEGIN(component)
Start the interface map for "component".
#define UUID_MAP_ENTRY(iface)
Add an entry to an interface map.
IObject * getInterface(void *self, const UUID &uuid, const UUID_Info *uuidlist)
Used to implement IObject::getInterface().
Definition getiface.cc:40
Utility structure used for the interface map.