aqbanking
5.0.22
|
00001 /*************************************************************************** 00002 $RCSfile$ 00003 ------------------- 00004 begin : Mon March 1 2011 00005 copyright : (C) 2011 by Christian Stimming 00006 email : christian@cstimming.de 00007 00008 *************************************************************************** 00009 * This file is part of the project "AqBanking". * 00010 * Please see toplevel file COPYING of that project for license details. * 00011 ***************************************************************************/ 00012 00013 00014 #ifndef AB_CXXWRAP_HPP 00015 #define AB_CXXWRAP_HPP 00016 00032 #define AB_CXXWRAP_GET0_CONST(cxxname, cname) \ 00033 cxxname() const \ 00034 { return cname(m_ptr); } 00035 00037 #define AB_CXXWRAP_GET0(cxxname, cname) \ 00038 cxxname() \ 00039 { return cname(m_ptr); } 00040 00042 #define AB_CXXWRAP_GET1_CONST(cxxname, type1, cname) \ 00043 cxxname(type1 arg1) const \ 00044 { return cname(m_ptr, arg1); } 00045 00047 #define AB_CXXWRAP_GET1(cxxname, type1, cname) \ 00048 cxxname(type1 arg1) \ 00049 { return cname(m_ptr, arg1); } 00050 00052 #define AB_CXXWRAP_SET0(cxxname, cname) \ 00053 void cxxname() \ 00054 { cname(m_ptr); } 00055 00057 #define AB_CXXWRAP_SET1(cxxname, type1, cname) \ 00058 void cxxname(type1 arg1) \ 00059 { cname(m_ptr, arg1); } 00060 00065 #define AB_CXXWRAP_CONSTRUCTOR0(cxxname, cprefix) \ 00066 cxxname() \ 00067 : m_ptr(cprefix##_new()) {} 00068 00075 #define AB_CXXWRAP_CONSTRUCTORS(cxxname, cprefix) \ 00076 ~cxxname() \ 00077 { cprefix##_free(m_ptr); } \ 00078 cxxname(const wrapped_type *other) \ 00079 : m_ptr(cprefix##_dup(other)) {} \ 00080 cxxname(const cxxname& other) \ 00081 : m_ptr(cprefix##_dup(other.m_ptr)) {} \ 00082 cxxname& operator=(const cxxname& other) \ 00083 { \ 00084 if (&other == this) \ 00085 return *this; \ 00086 cprefix##_free(m_ptr); \ 00087 m_ptr = cprefix##_dup(other.m_ptr); \ 00088 return *this; \ 00089 } \ 00090 operator const wrapped_type*() const \ 00091 { return m_ptr; } \ 00092 operator wrapped_type*() \ 00093 { return m_ptr; } \ 00094 const wrapped_type* ptr() const \ 00095 { return m_ptr; } \ 00096 wrapped_type* ptr() \ 00097 { return m_ptr; } 00098 00099 00100 #endif // AB_CXXWRAP_HPP 00101