/usr/include/sigc++-1.2/sigc++/marshal.h is in libsigc++-1.2-dev 1.2.7-2.
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 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | // Copyright 2000, Karl Einar Nelson
#ifndef SIGCXX_MARSHALLER_H
#define SIGCXX_MARSHALLER_H
#include <sigcconfig.h>
#include <sigc++/trait.h>
#ifndef SIGC_CXX_INT_CTOR
#include <new>
#endif
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif
/*
All classes used to marshal return values should have the following API:
class SomeMarshal
{
// both typedefs must be defined.
typedef Type1 InType;
typedef Type2 OutType;
public:
// Return final return code.
OutType value();
// Captures return codes and returns TRUE to stop emittion.
bool marshal(const InType&);
SomeMarshal();
};
It is not necessary for the InType to match the OutType.
This is to allow for things like list capturing.
*/
/*******************************************************************
***** Marshal
*******************************************************************/
// Basic Marshal class.
template <typename R>
class Marshal
{
public:
typedef R OutType;
typedef typename Trait<R>::type InType;
protected:
#ifdef SIGC_CXX_PARTIAL_SPEC
typedef OutType OutType_;
#else
typedef InType OutType_;
#endif
OutType_ value_;
public:
OutType_& value() {return value_;}
static OutType_ default_value()
#ifdef SIGC_CXX_INT_CTOR
{return OutType_();}
#else
{OutType_ r; new (&r) OutType_(); return r;}
#endif
// This captures return values. Return TRUE to stop emittion process.
bool marshal(const InType& newval)
{
value_=newval;
return 0; // continue emittion process
};
Marshal()
#ifdef SIGC_CXX_INT_CTOR
:value_()
{}
#else
{
new (&value_) OutType_();
}
#endif
};
#ifdef SIGC_CXX_SPECIALIZE_REFERENCES
// Basic Marshal class.
template <typename R>
class Marshal<R&>
{
public:
typedef R& OutType;
typedef R& InType;
R* value_;
OutType value() {return *value_;}
static OutType default_value() {return Default;}
static R Default;
// This captures return values. Return TRUE to stop emittion process.
bool marshal(InType newval)
{
value_=&newval;
return 0; // continue emittion process
};
Marshal()
:value_(&Default)
{}
~Marshal()
{}
};
template <typename T> T Marshal<T&>::Default;
#endif
#ifdef SIGC_CXX_PARTIAL_SPEC
// dummy marshaller for void type.
template <>
class Marshal<void>
{
public:
typedef void OutType;
static void default_value() {}
static void value() {}
Marshal()
{}
~Marshal()
{}
};
#endif
#ifdef SIGC_CXX_NAMESPACES
}
#endif
#endif
|