Shaka Player Embedded
macros.h
Go to the documentation of this file.
1 // Copyright 2017 Google LLC
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 // https://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 SHAKA_EMBEDDED_MACROS_H_
16 #define SHAKA_EMBEDDED_MACROS_H_
17 
18 #ifdef BUILDING_SHAKA
19 # if __GNUC__ >= 4
20 # define SHAKA_EXPORT __attribute__((visibility("default")))
21 # elif defined(_WIN32)
22 # define SHAKA_EXPORT __declspec(dllexport)
23 # else
24 # define SHAKA_EXPORT
25 # endif
26 #else
27 # ifdef _WIN32
28 # define SHAKA_EXPORT __declspec(dllimport)
29 # else
30 # define SHAKA_EXPORT
31 # endif
32 #endif
33 
34 #define SHAKA_DECLARE_STRUCT_SPECIAL_METHODS(Type) \
35  Type(); \
36  Type(const Type&); \
37  Type(Type&&); \
38  ~Type(); \
39  Type& operator=(const Type&); \
40  Type& operator=(Type&&)
41 
42 
43 #define SHAKA_NON_COPYABLE_TYPE(Type) \
44  Type(const Type&) = delete; \
45  Type& operator=(const Type&) = delete
46 
47 #define SHAKA_NON_MOVABLE_TYPE(Type) \
48  Type(Type&&) = delete; \
49  Type& operator=(Type&&) = delete
50 
51 #define SHAKA_NON_COPYABLE_OR_MOVABLE_TYPE(Type) \
52  SHAKA_NON_COPYABLE_TYPE(Type); \
53  SHAKA_NON_MOVABLE_TYPE(Type)
54 
55 #define SHAKA_DECLARE_INTERFACE_METHODS(Type) \
56  Type(); \
57  virtual ~Type(); \
58  SHAKA_NON_COPYABLE_OR_MOVABLE_TYPE(Type)
59 
60 
61 #endif // SHAKA_EMBEDDED_MACROS_H_