src/cx/properties.h

changeset 1180
4c3a69b9723a
parent 1124
fcd5d86c472f
equal deleted inserted replaced
1179:ca4c6f590a08 1180:4c3a69b9723a
89 typedef struct cx_properties_config_s CxPropertiesConfig; 89 typedef struct cx_properties_config_s CxPropertiesConfig;
90 90
91 /** 91 /**
92 * Default properties configuration. 92 * Default properties configuration.
93 */ 93 */
94 cx_attr_export
94 extern const CxPropertiesConfig cx_properties_config_default; 95 extern const CxPropertiesConfig cx_properties_config_default;
95 96
96 /** 97 /**
97 * Status codes for the properties interface. 98 * Status codes for the properties interface.
98 */ 99 */
325 * @param prop the properties interface 326 * @param prop the properties interface
326 * @param config the properties configuration 327 * @param config the properties configuration
327 * @see cxPropertiesInitDefault() 328 * @see cxPropertiesInitDefault()
328 */ 329 */
329 cx_attr_nonnull 330 cx_attr_nonnull
331 cx_attr_export
330 void cxPropertiesInit(CxProperties *prop, CxPropertiesConfig config); 332 void cxPropertiesInit(CxProperties *prop, CxPropertiesConfig config);
331 333
332 /** 334 /**
333 * Destroys the properties interface. 335 * Destroys the properties interface.
334 * 336 *
339 * add call to this function. 341 * add call to this function.
340 * 342 *
341 * @param prop the properties interface 343 * @param prop the properties interface
342 */ 344 */
343 cx_attr_nonnull 345 cx_attr_nonnull
346 cx_attr_export
344 void cxPropertiesDestroy(CxProperties *prop); 347 void cxPropertiesDestroy(CxProperties *prop);
345 348
346 /** 349 /**
347 * Destroys and re-initializes the properties interface. 350 * Destroys and re-initializes the properties interface.
348 * 351 *
388 * @retval non-zero a memory allocation was necessary but failed 391 * @retval non-zero a memory allocation was necessary but failed
389 * @see cxPropertiesFill() 392 * @see cxPropertiesFill()
390 */ 393 */
391 cx_attr_nonnull 394 cx_attr_nonnull
392 cx_attr_access_r(2, 3) 395 cx_attr_access_r(2, 3)
396 cx_attr_export
393 int cxPropertiesFilln( 397 int cxPropertiesFilln(
394 CxProperties *prop, 398 CxProperties *prop,
395 const char *buf, 399 const char *buf,
396 size_t len 400 size_t len
397 ); 401 );
493 * @param prop the properties interface 497 * @param prop the properties interface
494 * @param buf a pointer to stack memory 498 * @param buf a pointer to stack memory
495 * @param capacity the capacity of the stack memory 499 * @param capacity the capacity of the stack memory
496 */ 500 */
497 cx_attr_nonnull 501 cx_attr_nonnull
502 cx_attr_export
498 void cxPropertiesUseStack( 503 void cxPropertiesUseStack(
499 CxProperties *prop, 504 CxProperties *prop,
500 char *buf, 505 char *buf,
501 size_t capacity 506 size_t capacity
502 ); 507 );
531 * @retval CX_PROPERTIES_INVALID_MISSING_DELIMITER the properties data contains a line without delimiter 536 * @retval CX_PROPERTIES_INVALID_MISSING_DELIMITER the properties data contains a line without delimiter
532 * @retval CX_PROPERTIES_BUFFER_ALLOC_FAILED an internal allocation was necessary but failed 537 * @retval CX_PROPERTIES_BUFFER_ALLOC_FAILED an internal allocation was necessary but failed
533 */ 538 */
534 cx_attr_nonnull 539 cx_attr_nonnull
535 cx_attr_nodiscard 540 cx_attr_nodiscard
541 cx_attr_export
536 CxPropertiesStatus cxPropertiesNext( 542 CxPropertiesStatus cxPropertiesNext(
537 CxProperties *prop, 543 CxProperties *prop,
538 cxstring *key, 544 cxstring *key,
539 cxstring *value 545 cxstring *value
540 ); 546 );
551 * @return the sink 557 * @return the sink
552 * @see cxPropertiesLoad() 558 * @see cxPropertiesLoad()
553 */ 559 */
554 cx_attr_nonnull 560 cx_attr_nonnull
555 cx_attr_nodiscard 561 cx_attr_nodiscard
562 cx_attr_export
556 CxPropertiesSink cxPropertiesMapSink(CxMap *map); 563 CxPropertiesSink cxPropertiesMapSink(CxMap *map);
557 564
558 /** 565 /**
559 * Creates a properties source based on an UCX string. 566 * Creates a properties source based on an UCX string.
560 * 567 *
561 * @param str the string 568 * @param str the string
562 * @return the properties source 569 * @return the properties source
563 * @see cxPropertiesLoad() 570 * @see cxPropertiesLoad()
564 */ 571 */
565 cx_attr_nodiscard 572 cx_attr_nodiscard
573 cx_attr_export
566 CxPropertiesSource cxPropertiesStringSource(cxstring str); 574 CxPropertiesSource cxPropertiesStringSource(cxstring str);
567 575
568 /** 576 /**
569 * Creates a properties source based on C string with the specified length. 577 * Creates a properties source based on C string with the specified length.
570 * 578 *
574 * @see cxPropertiesLoad() 582 * @see cxPropertiesLoad()
575 */ 583 */
576 cx_attr_nonnull 584 cx_attr_nonnull
577 cx_attr_nodiscard 585 cx_attr_nodiscard
578 cx_attr_access_r(1, 2) 586 cx_attr_access_r(1, 2)
587 cx_attr_export
579 CxPropertiesSource cxPropertiesCstrnSource(const char *str, size_t len); 588 CxPropertiesSource cxPropertiesCstrnSource(const char *str, size_t len);
580 589
581 /** 590 /**
582 * Creates a properties source based on a C string. 591 * Creates a properties source based on a C string.
583 * 592 *
589 * @see cxPropertiesLoad() 598 * @see cxPropertiesLoad()
590 */ 599 */
591 cx_attr_nonnull 600 cx_attr_nonnull
592 cx_attr_nodiscard 601 cx_attr_nodiscard
593 cx_attr_cstr_arg(1) 602 cx_attr_cstr_arg(1)
603 cx_attr_export
594 CxPropertiesSource cxPropertiesCstrSource(const char *str); 604 CxPropertiesSource cxPropertiesCstrSource(const char *str);
595 605
596 /** 606 /**
597 * Creates a properties source based on an FILE. 607 * Creates a properties source based on an FILE.
598 * 608 *
603 * @see cxPropertiesLoad() 613 * @see cxPropertiesLoad()
604 */ 614 */
605 cx_attr_nonnull 615 cx_attr_nonnull
606 cx_attr_nodiscard 616 cx_attr_nodiscard
607 cx_attr_access_r(1) 617 cx_attr_access_r(1)
618 cx_attr_export
608 CxPropertiesSource cxPropertiesFileSource(FILE *file, size_t chunk_size); 619 CxPropertiesSource cxPropertiesFileSource(FILE *file, size_t chunk_size);
609 620
610 621
611 /** 622 /**
612 * Loads properties data from a source and transfers it to a sink. 623 * Loads properties data from a source and transfers it to a sink.
635 * @retval CX_PROPERTIES_INVALID_EMPTY_KEY the properties data contains an illegal empty key 646 * @retval CX_PROPERTIES_INVALID_EMPTY_KEY the properties data contains an illegal empty key
636 * @retval CX_PROPERTIES_INVALID_MISSING_DELIMITER the properties data contains a line without delimiter 647 * @retval CX_PROPERTIES_INVALID_MISSING_DELIMITER the properties data contains a line without delimiter
637 * @retval CX_PROPERTIES_BUFFER_ALLOC_FAILED an internal allocation was necessary but failed 648 * @retval CX_PROPERTIES_BUFFER_ALLOC_FAILED an internal allocation was necessary but failed
638 */ 649 */
639 cx_attr_nonnull 650 cx_attr_nonnull
651 cx_attr_export
640 CxPropertiesStatus cxPropertiesLoad( 652 CxPropertiesStatus cxPropertiesLoad(
641 CxProperties *prop, 653 CxProperties *prop,
642 CxPropertiesSink sink, 654 CxPropertiesSink sink,
643 CxPropertiesSource source 655 CxPropertiesSource source
644 ); 656 );

mercurial