1 | /* Copyright 2016 Google Inc. |
2 | |
3 | Licensed under the Apache License, Version 2.0 (the "License"); |
4 | you may not use this file except in compliance with the License. |
5 | You may obtain a copy of the License at |
6 | |
7 | http://www.apache.org/licenses/LICENSE-2.0 |
8 | |
9 | Unless required by applicable law or agreed to in writing, software |
10 | distributed under the License is distributed on an "AS IS" BASIS, |
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | See the License for the specific language governing permissions and |
13 | limitations under the License. */ |
14 | |
15 | #ifndef NSYNC_PUBLIC_NSYNC_CPP_H_ |
16 | #define NSYNC_PUBLIC_NSYNC_CPP_H_ |
17 | |
18 | /* This header file permits compilation via a C++ compiler using the macros |
19 | NSYNC_CPP_START_, NSYNC_CPP_END_, and NSYNC_CPP_USING_. |
20 | |
21 | NSYNC_CPP_START_ and NSYNC_CPP_END_ surround C code in the public library. |
22 | They put all public symbols into the "nsync" name space. |
23 | |
24 | NSYNC_CPP_USING_ is used before C code (used for testing) that might use |
25 | public exports from this package. It makes symbols in the "nsync" |
26 | name space available without the "nsync::" prefix. |
27 | |
28 | NSYNC_C_START_ and NSYNC_C_END_ surround C code in the C++ modules. |
29 | */ |
30 | |
31 | #if defined(__cplusplus) |
32 | #define NSYNC_CPP_START_ namespace nsync { |
33 | #define NSYNC_CPP_END_ } |
34 | #define NSYNC_CPP_USING_ using namespace nsync; |
35 | #define NSYNC_C_START_ extern "C" { |
36 | #define NSYNC_C_END_ } |
37 | #else |
38 | #define NSYNC_CPP_START_ |
39 | #define NSYNC_CPP_END_ |
40 | #define NSYNC_CPP_USING_ |
41 | #define NSYNC_C_START_ |
42 | #define NSYNC_C_END_ |
43 | #endif |
44 | |
45 | #endif /*NSYNC_PUBLIC_NSYNC_CPP_H_*/ |
46 | |