aqbanking  5.0.24.0-git
Defines
cxxwrap.hpp File Reference

Go to the source code of this file.

Defines

#define AB_CXXWRAP_GET0_CONST(cxxname, cname)
#define AB_CXXWRAP_GET0(cxxname, cname)
#define AB_CXXWRAP_GET1_CONST(cxxname, type1, cname)
#define AB_CXXWRAP_GET1(cxxname, type1, cname)
#define AB_CXXWRAP_SET0(cxxname, cname)
#define AB_CXXWRAP_SET1(cxxname, type1, cname)
#define AB_CXXWRAP_CONSTRUCTOR0(cxxname, cprefix)
#define AB_CXXWRAP_CONSTRUCTORS(cxxname, cprefix)

Detailed Description

This file contains macros that simplify the wrapping of aqbanking's data types in a C++ class. The macros assume the following:

The only additional assumptions are necessary in the AB_CXXWRAP_CONSTRUCTORS() macro.

Definition in file cxxwrap.hpp.


Define Documentation

#define AB_CXXWRAP_CONSTRUCTOR0 (   cxxname,
  cprefix 
)
Value:
cxxname()                                                                                 \
        : m_ptr(cprefix##_new()) {}

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.

Definition at line 65 of file cxxwrap.hpp.

#define AB_CXXWRAP_CONSTRUCTORS (   cxxname,
  cprefix 
)
Value:
~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; }

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.

Definition at line 75 of file cxxwrap.hpp.

#define AB_CXXWRAP_GET0 (   cxxname,
  cname 
)
Value:
cxxname()                                                                               \
  { return cname(m_ptr); }

Wraps a getter function with 0 arguments

Definition at line 37 of file cxxwrap.hpp.

#define AB_CXXWRAP_GET0_CONST (   cxxname,
  cname 
)
Value:
cxxname() const                                                         \
  { return cname(m_ptr); }

Wraps a getter function with 0 arguments, const

Definition at line 32 of file cxxwrap.hpp.

#define AB_CXXWRAP_GET1 (   cxxname,
  type1,
  cname 
)
Value:
cxxname(type1 arg1)                                                     \
  { return cname(m_ptr, arg1); }

Wraps a getter function with 1 argument

Definition at line 47 of file cxxwrap.hpp.

#define AB_CXXWRAP_GET1_CONST (   cxxname,
  type1,
  cname 
)
Value:
cxxname(type1 arg1) const                                                               \
  { return cname(m_ptr, arg1); }

Wraps a getter function with 1 argument, const

Definition at line 42 of file cxxwrap.hpp.

#define AB_CXXWRAP_SET0 (   cxxname,
  cname 
)
Value:
void cxxname()                                                          \
  { cname(m_ptr); }

Wraps a setter function with 0 argument

Definition at line 52 of file cxxwrap.hpp.

#define AB_CXXWRAP_SET1 (   cxxname,
  type1,
  cname 
)
Value:
void cxxname(type1 arg1)                                                \
  { cname(m_ptr, arg1); }

Wraps a setter function with 1 argument

Definition at line 57 of file cxxwrap.hpp.