Debian Codegraph @

sys/oo_CAN_WRITE_AS_ENCODING.h

raw symbols SCIP
1 /* oo_CAN_WRITE_AS_ENCODING.h
2 *
3 * Copyright (C) 2007,2009,2011-2020,2022,2024,2026 Paul Boersma
4 *
5 * This code is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or (at
8 * your option) any later version.
9 *
10 * This code is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this work. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include "oo_undef.h"
20
21 #define oo_SIMPLE(type, storage, x)
22
23 #define oo_SET(type, storage, x, setType)
24
25 #define oo_ANYVEC(type, storage, x, sizeExpression)
26
27 #define oo_ANYMAT(type, storage, x, nrowExpression, ncolExpression)
28
29 #define oo_ANYTEN3(type, storage, x, ndim1Expression, ndim2Expression, ndim3Expression)
30
31 #define oo_ENUMx(kType, storage, x)
32
33 //#define oo_ENUMx_SET(kType, storage, x, setType)
34
35 #define oo_STRINGx(storage, x) \
36 if (our x && ! Melder_isEncodable (our x.get(), encoding)) \
37 return false;
38
39 #define oo_STRINGx_SET(storage, x, setType) \
40 for (int _i = 0; _i <= setType::MAX; _i ++) \
41 if (our x [_i] && ! Melder_isEncodable (our x [_i].get(), encoding)) \
42 return false;
43
44 #define oo_STRINGx_VECTOR(storage, x, sizeExpression) \
45 { \
46 const integer _size = (sizeExpression); \
47 Melder_assert (_size == our x.size); \
48 if (our x) { \
49 for (integer _i = 1; _i <= _size; _i ++) { \
50 if (our x [_i] && ! Melder_isEncodable (our x [_i].get(), encoding)) \
51 return false; \
52 } \
53 } \
54 }
55
56 #define oo_STRUCT(Type, x) \
57 if (! our x. canWriteAsEncoding (encoding)) \
58 return false;
59
60 #define oo_STRUCT_SET(Type, x, setType) \
61 for (int _i = 0; _i <= (int) setType::MAX; _i ++) { \
62 if (! our x [_i]. canWriteAsEncoding (encoding)) \
63 return false; \
64 }
65
66 #define oo_STRUCTVEC(Type, x, sizeExpression) \
67 { \
68 const integer _size = (sizeExpression); \
69 Melder_assert (_size == our x.size); \
70 for (integer _i = 1; _i <= _size; _i ++) { \
71 if (! our x [_i]. canWriteAsEncoding (encoding)) \
72 return false; \
73 } \
74 }
75
76 #define oo_STRUCTMAT(Type, x, nrowExpression, ncolExpression) \
77 { \
78 const integer _nrow = (nrowExpression), _ncol = (nrowExpression); \
79 Melder_assert (_nrow == our x.nrow && _ncol == our x.ncol); \
80 for (integer _irow = 1; _irow <= _nrow; _irow ++) { \
81 for (integer _icol = 1; _icol <= _ncol; _icol ++) { \
82 if (! our x [_irow] [_icol]. canWriteAsEncoding (encoding)) \
83 return false; \
84 } \
85 } \
86 }
87
88 #define oo_OBJECT(Class, version, x) \
89 if (our x && ! Data_canWriteAsEncoding (our x.get(), encoding)) \
90 return false;
91
92 #define oo_COLLECTION_OF(Class, x, ItemClass, version) \
93 for (integer _i = 1; _i <= x.size; _i ++) { \
94 if (our x.at [_i] && ! Data_canWriteAsEncoding (our x.at [_i], encoding)) \
95 return false; \
96 }
97
98 #define oo_COLLECTION(Class, x, ItemClass, version) \
99 if (our x && ! Data_canWriteAsEncoding (our x.get(), encoding)) \
100 return false;
101
102 #define oo_TRANSIENT_FILE(x) \
103 return true; // because it won't actually be written
104
105 #define oo_TRANSIENT_FOLDER(x) \
106 return true; // because it won't actually be written
107
108 #define oo_UNSAFE_BORROWED_TRANSIENT_CONST_OBJECT_REFERENCE(Class, x) \
109 return true; // because it won't actually be written
110
111 #define oo_UNSAFE_BORROWED_TRANSIENT_MUTABLE_OBJECT_REFERENCE(Class, x) \
112 return true; // because it won't actually be written
113
114 #define oo_DEFINE_STRUCT(Type) \
115 bool struct##Type :: canWriteAsEncoding (int encoding) { \
116 (void) encoding;
117
118 #define oo_END_STRUCT(Type) \
119 return true; \
120 }
121
122 #define oo_DEFINE_CLASS(Class, Parent) \
123 bool struct##Class :: v1_canWriteAsEncoding (int encoding) { \
124 if (! Class##_Parent :: v1_canWriteAsEncoding (encoding)) \
125 return false;
126
127 #define oo_END_CLASS(Class) \
128 return true; \
129 }
130
131 #define oo_FROM(from)
132
133 #define oo_ENDFROM
134
135 #define oo_DECLARING 0
136 #define oo_DESTROYING 0
137 #define oo_COPYING 0
138 #define oo_COMPARING 0
139 #define oo_VALIDATING_ENCODING 1
140 #define oo_READING 0
141 #define oo_READING_TEXT 0
142 #define oo_READING_BINARY 0
143 #define oo_WRITING 0
144 #define oo_WRITING_TEXT 0
145 #define oo_WRITING_BINARY 0
146 #define oo_DESCRIBING 0
147
148 /* End of file oo_CAN_WRITE_AS_ENCODING.h */