LayOut C API

- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
common.h
Go to the documentation of this file.
1 // Copyright 2015-2024 Trimble Inc. All rights reserved.
2 // This file is intended for public distribution.
3
8 #ifndef SKETCHUP_COMMON_H_
9 #define SKETCHUP_COMMON_H_
10
15 enum SUResult {
16 SU_ERROR_NONE = 0,
17
18 SU_ERROR_NULL_POINTER_INPUT,
19
20 SU_ERROR_INVALID_INPUT,
21
22
23 SU_ERROR_NULL_POINTER_OUTPUT,
24
25 SU_ERROR_INVALID_OUTPUT,
26
27
28 SU_ERROR_OVERWRITE_VALID,
29
30
31
32 SU_ERROR_GENERIC,
33
34 SU_ERROR_SERIALIZATION,
35
36
37 SU_ERROR_OUT_OF_RANGE,
38
39
40 SU_ERROR_NO_DATA,
41
42
43
44 SU_ERROR_INSUFFICIENT_SIZE,
45
46
47 SU_ERROR_UNKNOWN_EXCEPTION,
48
49 SU_ERROR_MODEL_INVALID,
50
51 SU_ERROR_MODEL_VERSION,
52
53
54 SU_ERROR_LAYER_LOCKED,
55
56 SU_ERROR_DUPLICATE,
57
58 SU_ERROR_PARTIAL_SUCCESS,
59
60
61
62 SU_ERROR_UNSUPPORTED,
63
64 SU_ERROR_INVALID_ARGUMENT,
65
66 SU_ERROR_ENTITY_LOCKED,
67
68 SU_ERROR_INVALID_OPERATION,
69 };
70
71 // Define a platform-independent UTF16 type.
72 #if defined(__APPLE__) || defined(__LINUX__)
73 #ifndef FOUNDATION_IMPORT
74 typedef unsigned short unichar;
75 #endif // FOUNDATION_IMPORT
76 #else // WIN32
77 #include <wtypes.h>
78 typedef wchar_t unichar;
79 #endif
80
81 #ifndef DOXYGEN_SHOULD_SKIP_THIS
82
83 #define SU_EXPORT
84 #if defined WIN32 && !defined GSLAPI_NO_EXPORTS
85 #undef SU_EXPORT
86 #ifdef GSLAPI_API_EXPORTS
87 #define SU_EXPORT __declspec(dllexport)
88 #else
89 #define SU_EXPORT __declspec(dllimport)
90 #endif // GSLAPI_API_EXPORTS
91 #endif // WINDOWS
92
93 #if defined __APPLE__ && !defined GSLAPI_NO_EXPORTS
94 #undef SU_EXPORT
95 #define SU_EXPORT __attribute__((visibility("default")))
96 #endif // #if defined __APPLE__
97
98 #define DEFINE_SU_TYPE(TYPENAME) \
99 typedef struct { \
100 void* ptr; \
101 } TYPENAME;
102
103 #endif // DOXYGEN_SHOULD_SKIP_THIS
104
108 #define SU_RESULT SU_EXPORT enum SUResult
109
114 #define SU_INVALID \
115 { 0 }
116
121 #define SUIsValid(VARIABLE) ((VARIABLE).ptr != 0)
122
127 #define SUIsInvalid(VARIABLE) ((VARIABLE).ptr == 0)
128
132 #define SUSetInvalid(VARIABLE) (VARIABLE).ptr = 0
133
137 #define SUAreEqual(VARIABLE1, VARIABLE2) ((VARIABLE1).ptr == (VARIABLE2).ptr)
138
139 #include <stddef.h> // for size_t
140
141 #if !defined(__STDC_HOSTED__) || (__STDC_HOSTED__ == 0)
142 // The host compiler does not implement C99
143 #ifdef WIN32
144 typedef __int64 int64_t;
145 typedef __int32 int32_t;
146 typedef __int16 int16_t;
147 typedef unsigned __int32 uint32_t;
148 #else
149 #error Unsupported compiler!
150 #endif
151 #else
152 #include <stdint.h>
153 #endif // #if !defined(__STDC_HOSTED__) || (__STDC_HOSTED__ == 0)
154
155 #ifndef __cplusplus
156 // C compilers need this header for the bool type.
157 // This header maps bool to C99's _Bool type.
158 #include <stdbool.h>
159 #endif
160
166 #ifndef SU_SUPPRESS_DEPRECATION_WARNINGS
167 #ifdef WIN32
168 #define SU_DEPRECATED_FUNCTION(version_num) \
169 __declspec(deprecated("first deprecated in " version_num))
170 #else
171 #define SU_DEPRECATED_FUNCTION(version_num) \
172 __attribute__((deprecated("first deprecated in " version_num)))
173 #endif
174 #else
175 #define SU_DEPRECATED_FUNCTION(version_num)
176 #endif
177
178 #endif // SKETCHUP_COMMON_H_