This file is indexed.

/usr/include/wvstreams/wvmoniker.h is in libwvstreams-dev 4.6.1-11.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
/* -*- Mode: C++ -*-
 * Worldvisions Weaver Software:
 *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
 * 
 * Support for monikers, which are strings that you can pass to a magic
 * factory to get objects supporting a particular interface, without actually
 * knowing anything about the constructor for those objects.
 */
#ifndef __WVMONIKER_H
#define __WVMONIKER_H

#include "wvstring.h"
#include "wvxplc.h"

class WvMonikerRegistry;

typedef void *WvMonikerCreateFunc(WvStringParm parms, IObject *obj);

/**
 * WvMonikerBase is an auto-registration class for putting things into
 * a WvMonikerRegistry.  When a WvMonikerBase instance is created, it
 * registers a moniker prefix ("test:", "ssl:", "ini:", etc) and a factory
 * function that can be used to create an IObject using that prefix.
 * 
 * When the instance is destroyed, it auto-unregisters the moniker prefix
 * from the registry.
 * 
 * You can't actually create one of these, because it's not typesafe.  See
 * WvMoniker<T> instead.
 */
class WvMonikerBase
{
protected:
    WvMonikerBase(const UUID &iid, WvStringParm _id,
		  WvMonikerCreateFunc *func, const bool override = false);
    ~WvMonikerBase();
    
public:
    WvString id;
    WvMonikerRegistry *reg;
};


/**
 * A type-safe version of WvMonikerBase that lets you provide create functions
 * for object types other than IObject.  (The objects themselves have to
 * be derived from IObject, however.)
 * 
 * See WvMonikerBase for details.
 * 
 * Example:
 *    static IWvStream *createfunc(WvStringParm s, IObject *obj,
 *                                 void *userdata)
 *    {
 *        return new WvStream;
 *    }
 * 
 *    static WvMoniker<IWvStream> registration("ssl", createfunc);
 */
template <class T>
class WvMoniker : public WvMonikerBase
{
public:
    typedef T *CreateFunc(WvStringParm parms, IObject *obj);
    
    WvMoniker(WvStringParm _id, CreateFunc *_func, const bool override = false)
	: WvMonikerBase(XPLC_IID<T>::get(), _id, (WvMonikerCreateFunc *)_func,
			override)
    { 
	// this looks pointless, but it ensures that T* can be safely,
	// automatically downcast to IObject*.  That means T is really derived
	// from IObject, which is very important. The 'for' avoids a
	// warning.
	for(IObject *silly = (T *)NULL; silly; )
            ;
    };
};


/**
 * Create an object registered in a WvMonikerRegistry.  The iid specifies
 * which registry to look in, and s, obj, and userdata are the parameters to
 * supply to the object's factory.  Most factories need only 's', which is the
 * moniker itself.
 * 
 * Most people don't use this function.  See the templated, type-safe version
 * of wvcreate() below.
 */
void *wvcreate(const UUID &iid, WvStringParm s, IObject *obj);


/**
 * Create an object registered in a WvMonikerRegistry.  Exactly which
 * registry is determined by the template type T.
 * 
 * s, obj, and userdata are the parameters to supply to the object's
 * factory.  Most factories need only 's', which is the moniker itself.
 * 
 * Example:
 *    IWvStream *s = wvcreate<IWvStream>("tcp:localhost:25");
 *    IWvStream *s_ssl = wvcreate<IWvStream>("ssl:", s);
 */
template <class T>
inline T *wvcreate(WvStringParm s, IObject *obj = 0)
{
    return (T *)(wvcreate(XPLC_IID<T>::get(), s, obj));
}


#endif // __WVMONIKER_H