Skip to content

Commit 62e5ad3

Browse files
committed
Allow force enabling C++11 support in C++ API by defining LSL_CPP11
1 parent 09054c4 commit 62e5ad3

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

docs/Doxyfile_API

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ CLANG_OPTIONS = -I../lslboost
2020
MACRO_EXPANSION = YES
2121
EXPAND_ONLY_PREDEF = YES
2222
ENABLE_PREPROCESSING = YES
23-
PREDEFINED = LIBLSL_C_API
23+
PREDEFINED = LIBLSL_C_API LSL_DOXYGEN
2424
ALPHABETICAL_INDEX = NO
2525
HTML_DYNAMIC_SECTIONS = YES
2626
GENERATE_TREEVIEW = YES

include/lsl_cpp.h

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@
2424
#include <string>
2525
#include <vector>
2626

27+
#ifndef LSL_CPP11
28+
#if __cplusplus > 199711L || _MSC_VER >= 1900 || defined(LSL_DOXYGEN)
29+
/// Feature macro to conditionally enable C++11 features
30+
#define LSL_CPP11 1
31+
#else
32+
#define LSL_CPP11 0
33+
#endif
34+
#endif
35+
2736
extern "C" {
2837
#include "lsl_c.h"
2938
}
@@ -363,7 +372,7 @@ class stream_info {
363372
return *this;
364373
}
365374

366-
#if __cplusplus > 199711L || _MSC_VER >= 1900
375+
#if LSL_CPP11
367376
stream_info(stream_info &&rhs) noexcept : obj(rhs.obj) { rhs.obj = nullptr; }
368377

369378
stream_info &operator=(stream_info &&rhs) noexcept {
@@ -845,6 +854,7 @@ class stream_outlet {
845854
lsl_push_chunk_ctnp(obj, (data_buffer), (unsigned long)data_buffer_elements,
846855
(timestamp_buffer), pushthrough);
847856
}
857+
848858
void push_chunk_multiplexed(const std::string *data_buffer, const double *timestamp_buffer,
849859
std::size_t data_buffer_elements, bool pushthrough = true) {
850860
if (data_buffer_elements) {
@@ -889,7 +899,7 @@ class stream_outlet {
889899
if (obj) lsl_destroy_outlet(obj);
890900
}
891901

892-
#if __cplusplus > 199711L || _MSC_VER >= 1900
902+
#if LSL_CPP11
893903
/// stream_outlet move constructor
894904
stream_outlet(stream_outlet &&res) noexcept : channel_count(res.channel_count), obj(res.obj) {
895905
res.obj = nullptr;
@@ -1031,7 +1041,7 @@ class stream_inlet {
10311041
if (obj) lsl_destroy_inlet(obj);
10321042
}
10331043

1034-
#if __cplusplus > 199711L || _MSC_VER >= 1900
1044+
#if LSL_CPP11
10351045
/// Move constructor for stream_inlet
10361046
stream_inlet(stream_inlet &&rhs) noexcept : channel_count(rhs.channel_count), obj(rhs.obj) {
10371047
rhs.obj = nullptr;
@@ -1491,7 +1501,7 @@ class stream_inlet {
14911501
chunk.reserve(chunk.size() + target * this->channel_count);
14921502
if (timestamps) timestamps->reserve(timestamps->size() + target);
14931503
while ((ts = pull_sample(sample, 0.0)) != 0.0) {
1494-
#if __cplusplus > 199711L || _MSC_VER >= 1900
1504+
#if LSL_CPP11
14951505
chunk.insert(chunk.end(), std::make_move_iterator(sample.begin()),
14961506
std::make_move_iterator(sample.end()));
14971507
#else
@@ -1806,7 +1816,7 @@ class continuous_resolver {
18061816
if (obj) lsl_destroy_continuous_resolver(obj);
18071817
}
18081818

1809-
#if __cplusplus > 199711L || _MSC_VER >= 1900
1819+
#if LSL_CPP11
18101820
/// Move constructor for stream_inlet
18111821
continuous_resolver(continuous_resolver &&rhs) noexcept : obj(rhs.obj) { rhs.obj = nullptr; }
18121822
continuous_resolver &operator=(continuous_resolver &&rhs) noexcept {

0 commit comments

Comments
 (0)