/usr/include/vdk2/vdk/vdkprops.h is in libvdk2-dev 2.4.0-5.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 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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | // -*- c++ -*-
/*
* ===========================
* VDK Visual Development Kit
* Version 0.4
* October 1998
* ===========================
*
* Copyright (C) 1998, Mario Motta
* Developed by Mario Motta <mmotta@guest.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-130
*/
#ifndef VDKPROPS_H
#define VDKPROPS_H
#include <vdk/vdkstring.h>
#include <vdk/vdkfont.h>
#include <cstdio>
#ifdef USE_SIGCPLUSPLUS
# include <vdk/sigc_addon.h>
#endif // USE_SIGCPLUSPLUS
#define __rwproperty(ownerClass,propertyType) \
VDKReadWriteValueProp<ownerClass, propertyType>
#define __rproperty(ownerClass,propertyType) \
VDKReadOnlyValueProp<ownerClass, propertyType>
#ifdef NULL
#undef NULL
#define NULL 0x0000
#endif
#define PFREAD_NULL (PFRead) 0x0000
#define PFWRITE_NULL (PFWrite) 0x0000
//==================================================
/*
read/write values property
*/
template <class T, typename S>
class VDKReadWriteValueProp
#ifdef USE_SIGCPLUSPLUS
: public SigC::Object
#endif
{
// checked out because confuse some compiler
//friend class T;
protected:
typedef S (T::* PFRead)(void);
typedef void (T::*PFWrite)(S);
VDKString name;
T* object;
S (T::* get)(void);
void (T::*set)(S);
S value;
VDKReadWriteValueProp(VDKReadWriteValueProp& p) { }
void operator=(VDKReadWriteValueProp& p) { }
public:
VDKReadWriteValueProp():
name(""),
object(NULL),
get(NULL /*PFREAD_NULL*/),
set(NULL /*PFWRITE_NULL*/)
{ }
VDKReadWriteValueProp(
const char* name,
T* object,
S defValue,
void (T::*write)(S) = NULL,//PFWRITE_NULL,
S (T::*read)(void) = NULL //PFREAD_NULL
):
name(name),object(object),
get(read),set(write),
value(defValue)
{ }
virtual ~VDKReadWriteValueProp() {}
// raw setting (functor)
// caution using it in read only props breaks
// data hiding and can lead in ugly errors.
// user: use it at your own risk.
virtual void operator()(S val)
{
value = val;
#ifdef USE_SIGCPLUSPLUS
OnValueChanged.emit(object, value);
#endif
}
// setting prop value operator
virtual void operator = (S val)
{
if(set && object)
((*object).*set)(val);
value = val;
#ifdef USE_SIGCPLUSPLUS
OnValueChanged.emit(object, value);
#endif
}
// getting prop value operator
virtual operator S()const
{
if(get && object)
// return (*((const_cast<VDKReadWriteValueProp<T,S>*>(this))->object).*get)();
return ((*object).*get)();
else
return value;
}
char* Name() { return name; }
S Value()const { return value; }
#ifdef USE_SIGCPLUSPLUS
DualSignal1<void, T*,S> OnValueChanged;
#endif
};
/*
read only values property
*/
template <class T, class S>
class VDKReadOnlyValueProp: public VDKReadWriteValueProp<T,S>
{
void operator = (S) { }
public:
VDKReadOnlyValueProp():VDKReadWriteValueProp<T,S>() { }
VDKReadOnlyValueProp(
const char* name,
T* object,
S defValue,
S (T::*read)(void) = NULL, //PFREAD_NULL,
void (T::*write)(S) = NULL //PFWRITE_NULL
):
VDKReadWriteValueProp<T,S>(
name,
object,
defValue,
write,
read) { }
virtual ~VDKReadOnlyValueProp() {}
};
#endif
|