@@ -1180,7 +1180,17 @@ private CharSequence generateArrayProperty(
1180
1180
token .arrayLength ()));
1181
1181
1182
1182
sb .append (String .format ("\n " +
1183
- indent + " const char *%1$s() const\n " +
1183
+ indent + " const char *%1$s() const SBE_NOEXCEPT\n " +
1184
+ indent + " {\n " +
1185
+ "%2$s" +
1186
+ indent + " return (m_buffer + m_offset + %3$d);\n " +
1187
+ indent + " }\n " ,
1188
+ propertyName ,
1189
+ generateTypeFieldNotPresentCondition (token .version (), indent ),
1190
+ offset ));
1191
+
1192
+ sb .append (String .format ("\n " +
1193
+ indent + " char *%1$s() SBE_NOEXCEPT\n " +
1184
1194
indent + " {\n " +
1185
1195
"%2$s" +
1186
1196
indent + " return (m_buffer + m_offset + %3$d);\n " +
@@ -1196,7 +1206,7 @@ private CharSequence generateArrayProperty(
1196
1206
indent );
1197
1207
1198
1208
sb .append (String .format ("\n " +
1199
- indent + " %1$s %2$s(const std::uint64_t index) const\n " +
1209
+ indent + " %1$s %2$s(std::uint64_t index) const\n " +
1200
1210
indent + " {\n " +
1201
1211
indent + " if (index >= %3$d)\n " +
1202
1212
indent + " {\n " +
@@ -1218,7 +1228,7 @@ private CharSequence generateArrayProperty(
1218
1228
indent );
1219
1229
1220
1230
sb .append (String .format ("\n " +
1221
- indent + " %1$s %2$s(const std::uint64_t index, const %3$s value)\n " +
1231
+ indent + " %1$s %2$s(std::uint64_t index, %3$s value)\n " +
1222
1232
indent + " {\n " +
1223
1233
indent + " if (index >= %4$d)\n " +
1224
1234
indent + " {\n " +
@@ -1234,7 +1244,7 @@ private CharSequence generateArrayProperty(
1234
1244
storeValue ));
1235
1245
1236
1246
sb .append (String .format ("\n " +
1237
- indent + " std::uint64_t get%1$s(char *dst, const std::uint64_t length) const\n " +
1247
+ indent + " std::uint64_t get%1$s(char *dst, std::uint64_t length) const\n " +
1238
1248
indent + " {\n " +
1239
1249
indent + " if (length > %2$d)\n " +
1240
1250
indent + " {\n " +
@@ -1251,7 +1261,7 @@ private CharSequence generateArrayProperty(
1251
1261
cppTypeName ));
1252
1262
1253
1263
sb .append (String .format ("\n " +
1254
- indent + " %1$s &put%2$s(const char *src)\n " +
1264
+ indent + " %1$s &put%2$s(const char *src) SBE_NOEXCEPT \n " +
1255
1265
indent + " {\n " +
1256
1266
indent + " std::memcpy(m_buffer + m_offset + %3$d, src, sizeof(%4$s) * %5$d);\n " +
1257
1267
indent + " return *this;\n " +
@@ -1275,11 +1285,31 @@ private CharSequence generateArrayProperty(
1275
1285
token .arrayLength ()));
1276
1286
1277
1287
sb .append (String .format ("\n " +
1278
- indent + " %1$s &put%2$s(const std::string& str)\n " +
1288
+ indent + " #if __cplusplus >= 201703L\n " +
1289
+ indent + " std::string_view get%1$sAsStringView() const SBE_NOEXCEPT\n " +
1290
+ indent + " {\n " +
1291
+ indent + " std::string_view result(m_buffer + m_offset + %2$d, %3$d);\n " +
1292
+ indent + " return result;\n " +
1293
+ indent + " }\n " +
1294
+ indent + " #endif\n " ,
1295
+ toUpperFirstChar (propertyName ),
1296
+ offset ,
1297
+ token .arrayLength ()));
1298
+
1299
+ sb .append (String .format ("\n " +
1300
+ indent + " #if __cplusplus >= 201703L\n " +
1301
+ indent + " %1$s &put%2$s(std::string_view str) SBE_NOEXCEPT\n " +
1279
1302
indent + " {\n " +
1280
1303
indent + " std::memcpy(m_buffer + m_offset + %3$d, str.c_str(), %4$d);\n " +
1281
1304
indent + " return *this;\n " +
1282
- indent + " }\n " ,
1305
+ indent + " }\n " +
1306
+ indent + " #else\n " +
1307
+ indent + " %1$s &put%2$s(const std::string& str) SBE_NOEXCEPT\n " +
1308
+ indent + " {\n " +
1309
+ indent + " std::memcpy(m_buffer + m_offset + %3$d, str.c_str(), %4$d);\n " +
1310
+ indent + " return *this;\n " +
1311
+ indent + " }\n " +
1312
+ indent + " #endif\n " ,
1283
1313
containingClassName ,
1284
1314
toUpperFirstChar (propertyName ),
1285
1315
offset ,
0 commit comments