src/cx/properties.h

changeset 988
15b3ca7ee33f
parent 985
68754c7de906
equal deleted inserted replaced
987:53e22f112b11 988:15b3ca7ee33f
394 CxProperties *prop, 394 CxProperties *prop,
395 const char *buf, 395 const char *buf,
396 size_t len 396 size_t len
397 ); 397 );
398 398
399 #ifdef __cplusplus
400 } // extern "C"
401 /**
402 * Fills the input buffer with a string.
403 *
404 * Currently unprocessed data is copied to a temporary buffer.
405 * This temporary buffer is allocated on the heap, unless you specified
406 * a buffer on the stack with #cxPropertiesUseStack().
407 * In that case, the stack buffer is used, until the capacity is not sufficient
408 * anymore.
409 *
410 * @param prop the properties interface
411 * @param str the string
412 * @return non-zero when a memory allocation was necessary but failed
413 */
414 cx_attr_nonnull
415 static inline int cxPropertiesFill(
416 CxProperties *prop,
417 cxstring str
418 ) {
419 return cxPropertiesFilln(prop, str.ptr, str.length);
420 }
421
422 /**
423 * Fills the input buffer with a string.
424 *
425 * Currently unprocessed data is copied to a temporary buffer.
426 * This temporary buffer is allocated on the heap, unless you specified
427 * a buffer on the stack with #cxPropertiesUseStack().
428 * In that case, the stack buffer is used, until the capacity is not sufficient
429 * anymore.
430 *
431 * @param prop the properties interface
432 * @param str the string
433 * @return non-zero when a memory allocation was necessary but failed
434 */
435 cx_attr_nonnull
436 static inline int cxPropertiesFill(
437 CxProperties *prop,
438 cxmutstr str
439 ) {
440 return cxPropertiesFilln(prop, str.ptr, str.length);
441 }
442
443 /**
444 * Fills the input buffer with a string.
445 *
446 * Currently unprocessed data is copied to a temporary buffer.
447 * This temporary buffer is allocated on the heap, unless you specified
448 * a buffer on the stack with #cxPropertiesUseStack().
449 * In that case, the stack buffer is used, until the capacity is not sufficient
450 * anymore.
451 *
452 * @param prop the properties interface
453 * @param str the string
454 * @return non-zero when a memory allocation was necessary but failed
455 */
456 cx_attr_nonnull
457 cx_attr_cstr_arg(2)
458 static inline int cxPropertiesFill(
459 CxProperties *prop,
460 const char *str
461 ) {
462 return cxPropertiesFilln(prop, str, strlen(str));
463 }
464
465 extern "C" {
466 #else // __cplusplus
399 /** 467 /**
400 * Fills the input buffer with a string. 468 * Fills the input buffer with a string.
401 * 469 *
402 * Currently unprocessed data is copied to a temporary buffer. 470 * Currently unprocessed data is copied to a temporary buffer.
403 * This temporary buffer is allocated on the heap, unless you specified 471 * This temporary buffer is allocated on the heap, unless you specified
459 CxProperties *prop, 527 CxProperties *prop,
460 const char *str 528 const char *str
461 ) { 529 ) {
462 return cxPropertiesFilln(prop, str, strlen(str)); 530 return cxPropertiesFilln(prop, str, strlen(str));
463 } 531 }
532 #endif
464 533
465 /** 534 /**
466 * Specifies stack memory that shall be used by #cxPropertiesFill(). 535 * Specifies stack memory that shall be used by #cxPropertiesFill().
467 * 536 *
468 * @param prop the properties interface 537 * @param prop the properties interface

mercurial