108 #else |
108 #else |
109 |
109 |
110 /** |
110 /** |
111 * One of two type adjustment functions that return a scstr_t. |
111 * One of two type adjustment functions that return a scstr_t. |
112 * |
112 * |
113 * Used internally to cast a UCX string to an immutable UCX string. |
113 * Used internally to convert a UCX string to an immutable UCX string. |
114 * This variant is used, when the string is already immutable and no operation |
114 * This variant is used, when the string is already immutable and no operation |
115 * needs to be performed. |
115 * needs to be performed. |
116 * |
116 * |
117 * @param str some scstr_t |
117 * @param str some scstr_t |
118 * @return the argument itself |
118 * @return the argument itself |
120 scstr_t ucx_sc2sc(scstr_t str); |
120 scstr_t ucx_sc2sc(scstr_t str); |
121 |
121 |
122 /** |
122 /** |
123 * One of two type adjustment functions that return a scstr_t. |
123 * One of two type adjustment functions that return a scstr_t. |
124 * |
124 * |
125 * Used internally to cast a UCX string to an immutable UCX string. |
125 * Used internally to convert a UCX string to an immutable UCX string. |
126 * |
126 * |
127 * @param str some sstr_t |
127 * @param str some sstr_t |
128 * @return an immutable (scstr_t) version of the provided string. |
128 * @return an immutable (scstr_t) version of the provided string. |
129 */ |
129 */ |
130 scstr_t ucx_ss2sc(sstr_t str); |
130 scstr_t ucx_ss2sc(sstr_t str); |
165 |
165 |
166 /** |
166 /** |
167 * Casts a UCX string to an immutable UCX string (scstr_t). |
167 * Casts a UCX string to an immutable UCX string (scstr_t). |
168 * |
168 * |
169 * This internal function (ab)uses the C standard an expects one single |
169 * This internal function (ab)uses the C standard an expects one single |
170 * argument which is then implicitly casted to scstr_t without a warning. |
170 * argument which is then implicitly converted to scstr_t without a warning. |
171 * |
171 * |
172 * @return the an immutable version of the provided string |
172 * @return the an immutable version of the provided string |
173 */ |
173 */ |
174 scstr_t ucx_ss2c_s(); |
174 scstr_t ucx_ss2c_s(); |
175 |
175 |
264 * @return the cumulated length of all strings |
264 * @return the cumulated length of all strings |
265 */ |
265 */ |
266 size_t scstrnlen(size_t count, ...); |
266 size_t scstrnlen(size_t count, ...); |
267 |
267 |
268 /** |
268 /** |
269 * Alias for scstrnlen() which automatically casts the arguments. |
269 * Alias for scstrnlen() which automatically converts the arguments. |
270 * |
270 * |
271 * @param count the total number of specified strings (so at least 1) |
271 * @param count the total number of specified strings (so at least 1) |
272 * @param ... all strings |
272 * @param ... all strings |
273 * @return the cumulated length of all strings |
273 * @return the cumulated length of all strings |
274 */ |
274 */ |
289 * @return the concatenated string |
289 * @return the concatenated string |
290 */ |
290 */ |
291 sstr_t scstrcat(size_t count, scstr_t s1, ...); |
291 sstr_t scstrcat(size_t count, scstr_t s1, ...); |
292 |
292 |
293 /** |
293 /** |
294 * Alias for scstrcat() which automatically casts the arguments. |
294 * Alias for scstrcat() which automatically converts the arguments. |
295 * |
295 * |
296 * @param count the total number of strings to concatenate |
296 * @param count the total number of strings to concatenate |
297 * @param s1 first string |
297 * @param s1 first string |
298 * @param ... all remaining strings |
298 * @param ... all remaining strings |
299 * @return the concatenated string |
299 * @return the concatenated string |
312 * @return the concatenated string |
312 * @return the concatenated string |
313 */ |
313 */ |
314 sstr_t scstrcat_a(UcxAllocator *a, size_t count, scstr_t s1, ...); |
314 sstr_t scstrcat_a(UcxAllocator *a, size_t count, scstr_t s1, ...); |
315 |
315 |
316 /** |
316 /** |
317 * Alias for scstrcat_a() which automatically casts the arguments. |
317 * Alias for scstrcat_a() which automatically converts the arguments. |
318 * |
318 * |
319 * See sstrcat() for details. |
319 * See sstrcat() for details. |
320 * |
320 * |
321 * @param a the allocator to use |
321 * @param a the allocator to use |
322 * @param count the total number of strings to concatenate |
322 * @param count the total number of strings to concatenate |
469 * present in <code>string</code> |
469 * present in <code>string</code> |
470 */ |
470 */ |
471 sstr_t scstrsstr(sstr_t string, scstr_t match); |
471 sstr_t scstrsstr(sstr_t string, scstr_t match); |
472 |
472 |
473 /** |
473 /** |
474 * Alias for scstrsstr() which automatically casts the match string. |
474 * Alias for scstrsstr() which automatically converts the match string. |
475 * |
475 * |
476 * @param string the string to be scanned |
476 * @param string the string to be scanned |
477 * @param match string containing the sequence of characters to match |
477 * @param match string containing the sequence of characters to match |
478 * @return a substring starting at the first occurrence of |
478 * @return a substring starting at the first occurrence of |
479 * <code>match</code>, or an empty string, if the sequence is not |
479 * <code>match</code>, or an empty string, if the sequence is not |
497 * present in <code>string</code> |
497 * present in <code>string</code> |
498 */ |
498 */ |
499 scstr_t scstrscstr(scstr_t string, scstr_t match); |
499 scstr_t scstrscstr(scstr_t string, scstr_t match); |
500 |
500 |
501 /** |
501 /** |
502 * Alias for scstrscstr() which automatically casts the match string. |
502 * Alias for scstrscstr() which automatically converts the match string. |
503 * |
503 * |
504 * @param string the string to be scanned |
504 * @param string the string to be scanned |
505 * @param match string containing the sequence of characters to match |
505 * @param match string containing the sequence of characters to match |
506 * @return a substring starting at the first occurrence of |
506 * @return a substring starting at the first occurrence of |
507 * <code>match</code>, or an empty string, if the sequence is not |
507 * <code>match</code>, or an empty string, if the sequence is not |
557 * @see scstrsplit_a() |
557 * @see scstrsplit_a() |
558 */ |
558 */ |
559 sstr_t* scstrsplit(scstr_t string, scstr_t delim, ssize_t *count); |
559 sstr_t* scstrsplit(scstr_t string, scstr_t delim, ssize_t *count); |
560 |
560 |
561 /** |
561 /** |
562 * Alias for scstrsplit() which automatically casts the arguments. |
562 * Alias for scstrsplit() which automatically converts the arguments. |
563 * |
563 * |
564 * @param string the string to split |
564 * @param string the string to split |
565 * @param delim the delimiter string |
565 * @param delim the delimiter string |
566 * @param count IN: the maximum size of the resulting array (0 = no limit), |
566 * @param count IN: the maximum size of the resulting array (0 = no limit), |
567 * OUT: the actual size of the array |
567 * OUT: the actual size of the array |
597 */ |
597 */ |
598 sstr_t* scstrsplit_a(UcxAllocator *allocator, scstr_t string, scstr_t delim, |
598 sstr_t* scstrsplit_a(UcxAllocator *allocator, scstr_t string, scstr_t delim, |
599 ssize_t *count); |
599 ssize_t *count); |
600 |
600 |
601 /** |
601 /** |
602 * Alias for scstrsplit_a() which automatically casts the arguments. |
602 * Alias for scstrsplit_a() which automatically converts the arguments. |
603 * |
603 * |
604 * @param allocator the UcxAllocator used for allocating memory |
604 * @param allocator the UcxAllocator used for allocating memory |
605 * @param string the string to split |
605 * @param string the string to split |
606 * @param delim the delimiter string |
606 * @param delim the delimiter string |
607 * @param count IN: the maximum size of the resulting array (0 = no limit), |
607 * @param count IN: the maximum size of the resulting array (0 = no limit), |
627 * <code>memcmp()</code> otherwise (i.e. 0 if the strings match) |
627 * <code>memcmp()</code> otherwise (i.e. 0 if the strings match) |
628 */ |
628 */ |
629 int scstrcmp(scstr_t s1, scstr_t s2); |
629 int scstrcmp(scstr_t s1, scstr_t s2); |
630 |
630 |
631 /** |
631 /** |
632 * Alias for scstrcmp() which automatically casts its arguments. |
632 * Alias for scstrcmp() which automatically converts its arguments. |
633 * |
633 * |
634 * @param s1 the first string |
634 * @param s1 the first string |
635 * @param s2 the second string |
635 * @param s2 the second string |
636 * @return -1, if the length of s1 is less than the length of s2 or 1, if the |
636 * @return -1, if the length of s1 is less than the length of s2 or 1, if the |
637 * length of s1 is greater than the length of s2 or the result of |
637 * length of s1 is greater than the length of s2 or the result of |
653 * specific string comparison function ignoring the case. |
653 * specific string comparison function ignoring the case. |
654 */ |
654 */ |
655 int scstrcasecmp(scstr_t s1, scstr_t s2); |
655 int scstrcasecmp(scstr_t s1, scstr_t s2); |
656 |
656 |
657 /** |
657 /** |
658 * Alias for scstrcasecmp() which automatically casts the arguments. |
658 * Alias for scstrcasecmp() which automatically converts the arguments. |
659 * |
659 * |
660 * @param s1 the first string |
660 * @param s1 the first string |
661 * @param s2 the second string |
661 * @param s2 the second string |
662 * @return -1, if the length of s1 is less than the length of s2 or 1, if the |
662 * @return -1, if the length of s1 is less than the length of s2 or 1, if the |
663 * length of s1 is greater than the length of s2 or the result of the platform |
663 * length of s1 is greater than the length of s2 or the result of the platform |
707 * @see scstrdup() |
707 * @see scstrdup() |
708 */ |
708 */ |
709 sstr_t scstrdup_a(UcxAllocator *allocator, scstr_t string); |
709 sstr_t scstrdup_a(UcxAllocator *allocator, scstr_t string); |
710 |
710 |
711 /** |
711 /** |
712 * Alias for scstrdup_a() which automatically casts the argument. |
712 * Alias for scstrdup_a() which automatically converts the argument. |
713 * |
713 * |
714 * @param allocator a valid instance of a UcxAllocator |
714 * @param allocator a valid instance of a UcxAllocator |
715 * @param string the string to duplicate |
715 * @param string the string to duplicate |
716 * @return a duplicate of the string |
716 * @return a duplicate of the string |
717 * @see scstrdup() |
717 * @see scstrdup() |
764 * @return 1, if and only if the string has the specified prefix, 0 otherwise |
764 * @return 1, if and only if the string has the specified prefix, 0 otherwise |
765 */ |
765 */ |
766 int scstrprefix(scstr_t string, scstr_t prefix); |
766 int scstrprefix(scstr_t string, scstr_t prefix); |
767 |
767 |
768 /** |
768 /** |
769 * Alias for scstrprefix() which automatically casts the arguments. |
769 * Alias for scstrprefix() which automatically converts the arguments. |
770 * |
770 * |
771 * @param string the string to check |
771 * @param string the string to check |
772 * @param prefix the prefix the string should have |
772 * @param prefix the prefix the string should have |
773 * @return 1, if and only if the string has the specified prefix, 0 otherwise |
773 * @return 1, if and only if the string has the specified prefix, 0 otherwise |
774 */ |
774 */ |
781 * @return 1, if and only if the string has the specified suffix, 0 otherwise |
781 * @return 1, if and only if the string has the specified suffix, 0 otherwise |
782 */ |
782 */ |
783 int scstrsuffix(scstr_t string, scstr_t suffix); |
783 int scstrsuffix(scstr_t string, scstr_t suffix); |
784 |
784 |
785 /** |
785 /** |
786 * Alias for scstrsuffix() which automatically casts the arguments. |
786 * Alias for scstrsuffix() which automatically converts the arguments. |
787 * |
787 * |
788 * @param string the string to check |
788 * @param string the string to check |
789 * @param suffix the suffix the string should have |
789 * @param suffix the suffix the string should have |
790 * @return 1, if and only if the string has the specified suffix, 0 otherwise |
790 * @return 1, if and only if the string has the specified suffix, 0 otherwise |
791 */ |
791 */ |
802 * @see scstrdup() |
802 * @see scstrdup() |
803 */ |
803 */ |
804 sstr_t scstrlower(scstr_t string); |
804 sstr_t scstrlower(scstr_t string); |
805 |
805 |
806 /** |
806 /** |
807 * Alias for scstrlower() which automatically casts the argument. |
807 * Alias for scstrlower() which automatically converts the argument. |
808 * |
808 * |
809 * @param string the input string |
809 * @param string the input string |
810 * @return the resulting lower case string |
810 * @return the resulting lower case string |
811 */ |
811 */ |
812 #define sstrlower(string) scstrlower(SCSTR(string)) |
812 #define sstrlower(string) scstrlower(SCSTR(string)) |
824 */ |
824 */ |
825 sstr_t scstrlower_a(UcxAllocator *allocator, scstr_t string); |
825 sstr_t scstrlower_a(UcxAllocator *allocator, scstr_t string); |
826 |
826 |
827 |
827 |
828 /** |
828 /** |
829 * Alias for scstrlower_a() which automatically casts the argument. |
829 * Alias for scstrlower_a() which automatically converts the argument. |
830 * |
830 * |
831 * @param allocator the allocator used for duplicating the string |
831 * @param allocator the allocator used for duplicating the string |
832 * @param string the input string |
832 * @param string the input string |
833 * @return the resulting lower case string |
833 * @return the resulting lower case string |
834 */ |
834 */ |
845 * @see scstrdup() |
845 * @see scstrdup() |
846 */ |
846 */ |
847 sstr_t scstrupper(scstr_t string); |
847 sstr_t scstrupper(scstr_t string); |
848 |
848 |
849 /** |
849 /** |
850 * Alias for scstrupper() which automatically casts the argument. |
850 * Alias for scstrupper() which automatically converts the argument. |
851 * |
851 * |
852 * @param string the input string |
852 * @param string the input string |
853 * @return the resulting upper case string |
853 * @return the resulting upper case string |
854 */ |
854 */ |
855 #define sstrupper(string) scstrupper(SCSTR(string)) |
855 #define sstrupper(string) scstrupper(SCSTR(string)) |
866 * @see scstrdup_a() |
866 * @see scstrdup_a() |
867 */ |
867 */ |
868 sstr_t scstrupper_a(UcxAllocator *allocator, scstr_t string); |
868 sstr_t scstrupper_a(UcxAllocator *allocator, scstr_t string); |
869 |
869 |
870 /** |
870 /** |
871 * Alias for scstrupper_a() which automatically casts the argument. |
871 * Alias for scstrupper_a() which automatically converts the argument. |
872 * |
872 * |
873 * @param allocator the allocator used for duplicating the string |
873 * @param allocator the allocator used for duplicating the string |
874 * @param string the input string |
874 * @param string the input string |
875 * @return the resulting upper case string |
875 * @return the resulting upper case string |
876 */ |
876 */ |