/usr/include/aqbanking5/aqbankingpp/cxxwrap.hpp is in libaqbanking34-dev 5.4.3beta-2+b1.
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 | /***************************************************************************
$RCSfile$
-------------------
begin : Mon March 1 2011
copyright : (C) 2011 by Christian Stimming
email : christian@cstimming.de
***************************************************************************
* This file is part of the project "AqBanking". *
* Please see toplevel file COPYING of that project for license details. *
***************************************************************************/
#ifndef AB_CXXWRAP_HPP
#define AB_CXXWRAP_HPP
/**
* \file
*
* This file contains macros that simplify the wrapping of aqbanking's
* data types in a C++ class. The macros assume the following:
*
* - The wrapped C type is available as a typedef "wrapped_type"
* - The pointer to the wrapped C object is called m_ptr
*
* The only additional assumptions are necessary in the
* AB_CXXWRAP_CONSTRUCTORS() macro.
*/
/** Wraps a getter function with 0 arguments, const */
#define AB_CXXWRAP_GET0_CONST(cxxname, cname) \
cxxname() const \
{ return cname(m_ptr); }
/** Wraps a getter function with 0 arguments */
#define AB_CXXWRAP_GET0(cxxname, cname) \
cxxname() \
{ return cname(m_ptr); }
/** Wraps a getter function with 1 argument, const */
#define AB_CXXWRAP_GET1_CONST(cxxname, type1, cname) \
cxxname(type1 arg1) const \
{ return cname(m_ptr, arg1); }
/** Wraps a getter function with 1 argument */
#define AB_CXXWRAP_GET1(cxxname, type1, cname) \
cxxname(type1 arg1) \
{ return cname(m_ptr, arg1); }
/** Wraps a setter function with 0 argument */
#define AB_CXXWRAP_SET0(cxxname, cname) \
void cxxname() \
{ cname(m_ptr); }
/** Wraps a setter function with 1 argument */
#define AB_CXXWRAP_SET1(cxxname, type1, cname) \
void cxxname(type1 arg1) \
{ cname(m_ptr, arg1); }
/** Wraps the default C++ constructor with zero arguments. This macro
only works if FOO_new() is available. Some of the FOO_new()
functions take additional arguments, in which case this macro
doesn't work. */
#define AB_CXXWRAP_CONSTRUCTOR0(cxxname, cprefix) \
cxxname() \
: m_ptr(cprefix##_new()) {}
/** Wraps the set of C++ constructors, destructor, and assignment operator.
*
* This macro additionally assumes that the C type FOO has a set of
* constructor/ destructor/ copy functions which are called FOO_free()
* and FOO_dup(), respectively.
*/
#define AB_CXXWRAP_CONSTRUCTORS(cxxname, cprefix) \
~cxxname() \
{ cprefix##_free(m_ptr); } \
cxxname(const wrapped_type *other) \
: m_ptr(cprefix##_dup(other)) {} \
cxxname(const cxxname& other) \
: m_ptr(cprefix##_dup(other.m_ptr)) {} \
cxxname& operator=(const cxxname& other) \
{ \
if (&other == this) \
return *this; \
cprefix##_free(m_ptr); \
m_ptr = cprefix##_dup(other.m_ptr); \
return *this; \
} \
operator const wrapped_type*() const \
{ return m_ptr; } \
operator wrapped_type*() \
{ return m_ptr; } \
const wrapped_type* ptr() const \
{ return m_ptr; } \
wrapped_type* ptr() \
{ return m_ptr; }
#endif // AB_CXXWRAP_HPP
|