305 * you ever have a <code>const char*</code> you are really supposed to free. |
310 * you ever have a <code>const char*</code> you are really supposed to free. |
306 * If you encounter such situation, you should double-check your code. |
311 * If you encounter such situation, you should double-check your code. |
307 * |
312 * |
308 * @param str the string to free |
313 * @param str the string to free |
309 */ |
314 */ |
|
315 cx_attr_export |
310 void cx_strfree(cxmutstr *str); |
316 void cx_strfree(cxmutstr *str); |
311 |
317 |
312 /** |
318 /** |
313 * Passes the pointer in this string to the allocators free function. |
319 * Passes the pointer in this string to the allocators free function. |
314 * |
320 * |
969 * @param replmax maximum number of replacements |
1003 * @param replmax maximum number of replacements |
970 * @return the resulting string after applying the replacements |
1004 * @return the resulting string after applying the replacements |
971 */ |
1005 */ |
972 cx_attr_nodiscard |
1006 cx_attr_nodiscard |
973 cx_attr_nonnull |
1007 cx_attr_nonnull |
|
1008 cx_attr_export |
974 cxmutstr cx_strreplacen_a( |
1009 cxmutstr cx_strreplacen_a( |
975 const CxAllocator *allocator, |
1010 const CxAllocator *allocator, |
976 cxstring str, |
1011 cxstring str, |
977 cxstring pattern, |
1012 cxstring pattern, |
978 cxstring replacement, |
1013 cxstring replacement, |
1113 * @param delim array of more delimiters |
1151 * @param delim array of more delimiters |
1114 * @param count number of elements in the array |
1152 * @param count number of elements in the array |
1115 */ |
1153 */ |
1116 cx_attr_nonnull |
1154 cx_attr_nonnull |
1117 cx_attr_access_r(2, 3) |
1155 cx_attr_access_r(2, 3) |
|
1156 cx_attr_export |
1118 void cx_strtok_delim( |
1157 void cx_strtok_delim( |
1119 CxStrtokCtx *ctx, |
1158 CxStrtokCtx *ctx, |
1120 const cxstring *delim, |
1159 const cxstring *delim, |
1121 size_t count |
1160 size_t count |
1122 ); |
1161 ); |
1137 * @param base 2, 8, 10, or 16 |
1176 * @param base 2, 8, 10, or 16 |
1138 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1177 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1139 * @retval zero success |
1178 * @retval zero success |
1140 * @retval non-zero conversion was not possible |
1179 * @retval non-zero conversion was not possible |
1141 */ |
1180 */ |
1142 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1181 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1143 int cx_strtos_lc_(cxstring str, short *output, int base, const char *groupsep); |
1182 int cx_strtos_lc_(cxstring str, short *output, int base, const char *groupsep); |
1144 |
1183 |
1145 /** |
1184 /** |
1146 * Converts a string to a number. |
1185 * Converts a string to a number. |
1147 * |
1186 * |
1154 * @param base 2, 8, 10, or 16 |
1193 * @param base 2, 8, 10, or 16 |
1155 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1194 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1156 * @retval zero success |
1195 * @retval zero success |
1157 * @retval non-zero conversion was not possible |
1196 * @retval non-zero conversion was not possible |
1158 */ |
1197 */ |
1159 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1198 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1160 int cx_strtoi_lc_(cxstring str, int *output, int base, const char *groupsep); |
1199 int cx_strtoi_lc_(cxstring str, int *output, int base, const char *groupsep); |
1161 |
1200 |
1162 /** |
1201 /** |
1163 * Converts a string to a number. |
1202 * Converts a string to a number. |
1164 * |
1203 * |
1171 * @param base 2, 8, 10, or 16 |
1210 * @param base 2, 8, 10, or 16 |
1172 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1211 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1173 * @retval zero success |
1212 * @retval zero success |
1174 * @retval non-zero conversion was not possible |
1213 * @retval non-zero conversion was not possible |
1175 */ |
1214 */ |
1176 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1215 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1177 int cx_strtol_lc_(cxstring str, long *output, int base, const char *groupsep); |
1216 int cx_strtol_lc_(cxstring str, long *output, int base, const char *groupsep); |
1178 |
1217 |
1179 /** |
1218 /** |
1180 * Converts a string to a number. |
1219 * Converts a string to a number. |
1181 * |
1220 * |
1188 * @param base 2, 8, 10, or 16 |
1227 * @param base 2, 8, 10, or 16 |
1189 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1228 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1190 * @retval zero success |
1229 * @retval zero success |
1191 * @retval non-zero conversion was not possible |
1230 * @retval non-zero conversion was not possible |
1192 */ |
1231 */ |
1193 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1232 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1194 int cx_strtoll_lc_(cxstring str, long long *output, int base, const char *groupsep); |
1233 int cx_strtoll_lc_(cxstring str, long long *output, int base, const char *groupsep); |
1195 |
1234 |
1196 /** |
1235 /** |
1197 * Converts a string to a number. |
1236 * Converts a string to a number. |
1198 * |
1237 * |
1205 * @param base 2, 8, 10, or 16 |
1244 * @param base 2, 8, 10, or 16 |
1206 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1245 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1207 * @retval zero success |
1246 * @retval zero success |
1208 * @retval non-zero conversion was not possible |
1247 * @retval non-zero conversion was not possible |
1209 */ |
1248 */ |
1210 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1249 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1211 int cx_strtoi8_lc_(cxstring str, int8_t *output, int base, const char *groupsep); |
1250 int cx_strtoi8_lc_(cxstring str, int8_t *output, int base, const char *groupsep); |
1212 |
1251 |
1213 /** |
1252 /** |
1214 * Converts a string to a number. |
1253 * Converts a string to a number. |
1215 * |
1254 * |
1222 * @param base 2, 8, 10, or 16 |
1261 * @param base 2, 8, 10, or 16 |
1223 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1262 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1224 * @retval zero success |
1263 * @retval zero success |
1225 * @retval non-zero conversion was not possible |
1264 * @retval non-zero conversion was not possible |
1226 */ |
1265 */ |
1227 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1266 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1228 int cx_strtoi16_lc_(cxstring str, int16_t *output, int base, const char *groupsep); |
1267 int cx_strtoi16_lc_(cxstring str, int16_t *output, int base, const char *groupsep); |
1229 |
1268 |
1230 /** |
1269 /** |
1231 * Converts a string to a number. |
1270 * Converts a string to a number. |
1232 * |
1271 * |
1239 * @param base 2, 8, 10, or 16 |
1278 * @param base 2, 8, 10, or 16 |
1240 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1279 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1241 * @retval zero success |
1280 * @retval zero success |
1242 * @retval non-zero conversion was not possible |
1281 * @retval non-zero conversion was not possible |
1243 */ |
1282 */ |
1244 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1283 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1245 int cx_strtoi32_lc_(cxstring str, int32_t *output, int base, const char *groupsep); |
1284 int cx_strtoi32_lc_(cxstring str, int32_t *output, int base, const char *groupsep); |
1246 |
1285 |
1247 /** |
1286 /** |
1248 * Converts a string to a number. |
1287 * Converts a string to a number. |
1249 * |
1288 * |
1256 * @param base 2, 8, 10, or 16 |
1295 * @param base 2, 8, 10, or 16 |
1257 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1296 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1258 * @retval zero success |
1297 * @retval zero success |
1259 * @retval non-zero conversion was not possible |
1298 * @retval non-zero conversion was not possible |
1260 */ |
1299 */ |
1261 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1300 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1262 int cx_strtoi64_lc_(cxstring str, int64_t *output, int base, const char *groupsep); |
1301 int cx_strtoi64_lc_(cxstring str, int64_t *output, int base, const char *groupsep); |
1263 |
1302 |
1264 /** |
1303 /** |
1265 * Converts a string to a number. |
1304 * Converts a string to a number. |
1266 * |
1305 * |
1273 * @param base 2, 8, 10, or 16 |
1312 * @param base 2, 8, 10, or 16 |
1274 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1313 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1275 * @retval zero success |
1314 * @retval zero success |
1276 * @retval non-zero conversion was not possible |
1315 * @retval non-zero conversion was not possible |
1277 */ |
1316 */ |
1278 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1317 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1279 int cx_strtous_lc_(cxstring str, unsigned short *output, int base, const char *groupsep); |
1318 int cx_strtous_lc_(cxstring str, unsigned short *output, int base, const char *groupsep); |
1280 |
1319 |
1281 /** |
1320 /** |
1282 * Converts a string to a number. |
1321 * Converts a string to a number. |
1283 * |
1322 * |
1290 * @param base 2, 8, 10, or 16 |
1329 * @param base 2, 8, 10, or 16 |
1291 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1330 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1292 * @retval zero success |
1331 * @retval zero success |
1293 * @retval non-zero conversion was not possible |
1332 * @retval non-zero conversion was not possible |
1294 */ |
1333 */ |
1295 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1334 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1296 int cx_strtou_lc_(cxstring str, unsigned int *output, int base, const char *groupsep); |
1335 int cx_strtou_lc_(cxstring str, unsigned int *output, int base, const char *groupsep); |
1297 |
1336 |
1298 /** |
1337 /** |
1299 * Converts a string to a number. |
1338 * Converts a string to a number. |
1300 * |
1339 * |
1307 * @param base 2, 8, 10, or 16 |
1346 * @param base 2, 8, 10, or 16 |
1308 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1347 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1309 * @retval zero success |
1348 * @retval zero success |
1310 * @retval non-zero conversion was not possible |
1349 * @retval non-zero conversion was not possible |
1311 */ |
1350 */ |
1312 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1351 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1313 int cx_strtoul_lc_(cxstring str, unsigned long *output, int base, const char *groupsep); |
1352 int cx_strtoul_lc_(cxstring str, unsigned long *output, int base, const char *groupsep); |
1314 |
1353 |
1315 /** |
1354 /** |
1316 * Converts a string to a number. |
1355 * Converts a string to a number. |
1317 * |
1356 * |
1324 * @param base 2, 8, 10, or 16 |
1363 * @param base 2, 8, 10, or 16 |
1325 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1364 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1326 * @retval zero success |
1365 * @retval zero success |
1327 * @retval non-zero conversion was not possible |
1366 * @retval non-zero conversion was not possible |
1328 */ |
1367 */ |
1329 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1368 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1330 int cx_strtoull_lc_(cxstring str, unsigned long long *output, int base, const char *groupsep); |
1369 int cx_strtoull_lc_(cxstring str, unsigned long long *output, int base, const char *groupsep); |
1331 |
1370 |
1332 /** |
1371 /** |
1333 * Converts a string to a number. |
1372 * Converts a string to a number. |
1334 * |
1373 * |
1341 * @param base 2, 8, 10, or 16 |
1380 * @param base 2, 8, 10, or 16 |
1342 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1381 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1343 * @retval zero success |
1382 * @retval zero success |
1344 * @retval non-zero conversion was not possible |
1383 * @retval non-zero conversion was not possible |
1345 */ |
1384 */ |
1346 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1385 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1347 int cx_strtou8_lc_(cxstring str, uint8_t *output, int base, const char *groupsep); |
1386 int cx_strtou8_lc_(cxstring str, uint8_t *output, int base, const char *groupsep); |
1348 |
1387 |
1349 /** |
1388 /** |
1350 * Converts a string to a number. |
1389 * Converts a string to a number. |
1351 * |
1390 * |
1358 * @param base 2, 8, 10, or 16 |
1397 * @param base 2, 8, 10, or 16 |
1359 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1398 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1360 * @retval zero success |
1399 * @retval zero success |
1361 * @retval non-zero conversion was not possible |
1400 * @retval non-zero conversion was not possible |
1362 */ |
1401 */ |
1363 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1402 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1364 int cx_strtou16_lc_(cxstring str, uint16_t *output, int base, const char *groupsep); |
1403 int cx_strtou16_lc_(cxstring str, uint16_t *output, int base, const char *groupsep); |
1365 |
1404 |
1366 /** |
1405 /** |
1367 * Converts a string to a number. |
1406 * Converts a string to a number. |
1368 * |
1407 * |
1375 * @param base 2, 8, 10, or 16 |
1414 * @param base 2, 8, 10, or 16 |
1376 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1415 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1377 * @retval zero success |
1416 * @retval zero success |
1378 * @retval non-zero conversion was not possible |
1417 * @retval non-zero conversion was not possible |
1379 */ |
1418 */ |
1380 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1419 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1381 int cx_strtou32_lc_(cxstring str, uint32_t *output, int base, const char *groupsep); |
1420 int cx_strtou32_lc_(cxstring str, uint32_t *output, int base, const char *groupsep); |
1382 |
1421 |
1383 /** |
1422 /** |
1384 * Converts a string to a number. |
1423 * Converts a string to a number. |
1385 * |
1424 * |
1392 * @param base 2, 8, 10, or 16 |
1431 * @param base 2, 8, 10, or 16 |
1393 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1432 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1394 * @retval zero success |
1433 * @retval zero success |
1395 * @retval non-zero conversion was not possible |
1434 * @retval non-zero conversion was not possible |
1396 */ |
1435 */ |
1397 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1436 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1398 int cx_strtou64_lc_(cxstring str, uint64_t *output, int base, const char *groupsep); |
1437 int cx_strtou64_lc_(cxstring str, uint64_t *output, int base, const char *groupsep); |
1399 |
1438 |
1400 /** |
1439 /** |
1401 * Converts a string to a number. |
1440 * Converts a string to a number. |
1402 * |
1441 * |
1409 * @param base 2, 8, 10, or 16 |
1448 * @param base 2, 8, 10, or 16 |
1410 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1449 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1411 * @retval zero success |
1450 * @retval zero success |
1412 * @retval non-zero conversion was not possible |
1451 * @retval non-zero conversion was not possible |
1413 */ |
1452 */ |
1414 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1453 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1415 int cx_strtoz_lc_(cxstring str, size_t *output, int base, const char *groupsep); |
1454 int cx_strtoz_lc_(cxstring str, size_t *output, int base, const char *groupsep); |
1416 |
1455 |
1417 /** |
1456 /** |
1418 * Converts a string to a single precision floating point number. |
1457 * Converts a string to a single precision floating point number. |
1419 * |
1458 * |
1426 * @param decsep the decimal separator |
1465 * @param decsep the decimal separator |
1427 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1466 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1428 * @retval zero success |
1467 * @retval zero success |
1429 * @retval non-zero conversion was not possible |
1468 * @retval non-zero conversion was not possible |
1430 */ |
1469 */ |
1431 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1470 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1432 int cx_strtof_lc_(cxstring str, float *output, char decsep, const char *groupsep); |
1471 int cx_strtof_lc_(cxstring str, float *output, char decsep, const char *groupsep); |
1433 |
1472 |
1434 /** |
1473 /** |
1435 * Converts a string to a double precision floating point number. |
1474 * Converts a string to a double precision floating point number. |
1436 * |
1475 * |
1443 * @param decsep the decimal separator |
1482 * @param decsep the decimal separator |
1444 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1483 * @param groupsep each character in this string is treated as group separator and ignored during conversion |
1445 * @retval zero success |
1484 * @retval zero success |
1446 * @retval non-zero conversion was not possible |
1485 * @retval non-zero conversion was not possible |
1447 */ |
1486 */ |
1448 cx_attr_access_w(2) cx_attr_nonnull_arg(2) |
1487 cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
1449 int cx_strtod_lc_(cxstring str, double *output, char decsep, const char *groupsep); |
1488 int cx_strtod_lc_(cxstring str, double *output, char decsep, const char *groupsep); |
1450 |
1489 |
1451 /** |
1490 /** |
1452 * Converts a string to a number. |
1491 * Converts a string to a number. |
1453 * |
1492 * |