diff options
| author | jhurst <jhurst@cinecert.com> | 2010-08-10 23:03:27 +0000 |
|---|---|---|
| committer | jhurst <> | 2010-08-10 23:03:27 +0000 |
| commit | 03f7685c1bc862896fa8e04289f6738749cd5d12 (patch) | |
| tree | 7be0c504dfa971db7b2c47296c47c907056a4da7 /src/KM_platform.h | |
| parent | a40f34416b776f5b20afa967fbcd1eb7ba95304b (diff) | |
corrected test of Py bool
Diffstat (limited to 'src/KM_platform.h')
| -rw-r--r-- | src/KM_platform.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/KM_platform.h b/src/KM_platform.h index a0e6a8c..54d5f27 100644 --- a/src/KM_platform.h +++ b/src/KM_platform.h @@ -184,6 +184,54 @@ namespace Kumu T(const T&); \ T& operator=(const T&) +/* +// Example + class foo + { + KM_NO_COPY_CONSTRUCT(foo); // accessing private mthods will cause compile time error + public: + // ... + }; +*/ + +// Produces copy constructor boilerplate. Implements +// copy and assignment, see example below +# define KM_EXPLICIT_COPY_CONSTRUCT(T) \ + T(const T&); \ + const T& operator=(const T&) + +# define KM_EXPLICIT_COPY_CONSTRUCT_IMPL_START(N, T) \ + void T##_copy_impl(N::T& lhs, const N::T& rhs) \ + { + +#define KM_COPY_ITEM(I) lhs.I = rhs.I; + +# define KM_EXPLICIT_COPY_CONSTRUCT_IMPL_END(N, T) \ + } \ + N::T::T(const N::T& rhs) { T##_copy_impl(*this, rhs); } \ + const N::T& N::T::operator=(const N::T& rhs) { T##_copy_impl(*this, rhs); return *this; } + +/* +// Example +namespace bar { + class foo + { + public: + std::string param_a; + int param_b; + + KM_EXPLICIT_COPY_CONSTRUCT(foo); + // ... + }; +} + +// +KM_EXPLICIT_COPY_CONSTRUCT_IMPL_START(bar, foo) +KM_COPY_ITEM(param_a) +KM_COPY_ITEM(param_b) +KM_EXPLICIT_COPY_CONSTRUCT_IMPL_END(bar, foo) +*/ + #endif // _KM_PLATFORM_H_ // |
