aqbanking  5.7.8
cxxwrap.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  $RCSfile$
3  -------------------
4  begin : Mon March 1 2011
5  copyright : (C) 2011 by Christian Stimming
6  email : christian@cstimming.de
7 
8  ***************************************************************************
9  * This file is part of the project "AqBanking". *
10  * Please see toplevel file COPYING of that project for license details. *
11  ***************************************************************************/
12 
13 
14 #ifndef AB_CXXWRAP_HPP
15 #define AB_CXXWRAP_HPP
16 
32 #define AB_CXXWRAP_GET0_CONST(cxxname, cname) \
33  cxxname() const \
34  { return cname(m_ptr); }
35 
37 #define AB_CXXWRAP_GET0(cxxname, cname) \
38  cxxname() \
39  { return cname(m_ptr); }
40 
42 #define AB_CXXWRAP_GET1_CONST(cxxname, type1, cname) \
43  cxxname(type1 arg1) const \
44  { return cname(m_ptr, arg1); }
45 
47 #define AB_CXXWRAP_GET1(cxxname, type1, cname) \
48  cxxname(type1 arg1) \
49  { return cname(m_ptr, arg1); }
50 
52 #define AB_CXXWRAP_SET0(cxxname, cname) \
53  void cxxname() \
54  { cname(m_ptr); }
55 
57 #define AB_CXXWRAP_SET1(cxxname, type1, cname) \
58  void cxxname(type1 arg1) \
59  { cname(m_ptr, arg1); }
60 
65 #define AB_CXXWRAP_CONSTRUCTOR0(cxxname, cprefix) \
66  cxxname() \
67  : m_ptr(cprefix##_new()) {}
68 
75 #define AB_CXXWRAP_CONSTRUCTORS(cxxname, cprefix) \
76  ~cxxname() \
77  { cprefix##_free(m_ptr); } \
78  cxxname(const wrapped_type *other) \
79  : m_ptr(cprefix##_dup(other)) {} \
80  cxxname(const cxxname& other) \
81  : m_ptr(cprefix##_dup(other.m_ptr)) {} \
82  cxxname& operator=(const cxxname& other) \
83  { \
84  if (&other == this) \
85  return *this; \
86  cprefix##_free(m_ptr); \
87  m_ptr = cprefix##_dup(other.m_ptr); \
88  return *this; \
89  } \
90  operator const wrapped_type*() const \
91  { return m_ptr; } \
92  operator wrapped_type*() \
93  { return m_ptr; } \
94  const wrapped_type* ptr() const \
95  { return m_ptr; } \
96  wrapped_type* ptr() \
97  { return m_ptr; }
98 
99 
100 #endif // AB_CXXWRAP_HPP
101