/usr/include/wvstreams/wvtypetraits.h is in libwvstreams-dev 4.6.1-5.
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 | /* -*- Mode: C++ -*-
* Worldvisions Weaver Software:
* Copyright (C) 1997-2004 Net Integration Technologies, Inc.
*
* Contains code you'd rather not think about.
*/
#ifndef __WVTYPETRAITS_H
#define __WVTYPETRAITS_H
#include "wvxplc.h"
template<class T, bool b>
struct WvTraits_Helper
{
static inline void maybe_addref(T* obj)
{
}
static inline void release(T* obj)
{
delete obj;
}
};
template<class T>
struct WvTraits_Helper<T, true>
{
static inline void maybe_addref(T* obj)
{
obj->addRef();
}
static inline void release(T* obj)
{
if (obj)
obj->release();
}
};
template<class From>
class WvTraits
{
typedef char Yes;
struct No { char dummy[2]; };
static From* from;
static Yes test(IObject*);
static No test(...);
public:
static inline void maybe_addref(From* obj)
{
const bool is_iobject = (sizeof(test(from)) == sizeof(Yes));
WvTraits_Helper<From, is_iobject>::maybe_addref(obj);
}
static inline void release(From* obj)
{
const bool is_iobject = (sizeof(test(from)) == sizeof(Yes));
WvTraits_Helper<From, is_iobject>::release(obj);
}
};
#endif /* __WVTYPETRAITS_H */
|