Add a few more UCStrVal functions
This commit is contained in:
+23
-2
@@ -24,7 +24,7 @@ struct UCStrStr {
|
||||
#define UC_VS_TERMINATOR {-1, NULL}
|
||||
#define UC_SS_TERMINATOR {NULL, NULL}
|
||||
|
||||
/** find @val in @array.
|
||||
/** Find @val in @array.
|
||||
* the last .str in @array must be a null pointer.
|
||||
* (does a linear search)
|
||||
*
|
||||
@@ -34,6 +34,17 @@ struct UCStrStr {
|
||||
*/
|
||||
const char *uc_val_2_str(unsigned int val, const struct UCValStr *array);
|
||||
|
||||
|
||||
/** Find @val in @array.
|
||||
* the last .str in @array must be a null pointer.
|
||||
* (does a linear search)
|
||||
*
|
||||
* @param val value to find
|
||||
* @param array array to search
|
||||
* @return The found struct UCValStr, which will be the last senitel
|
||||
* in the array if no match was found
|
||||
*/
|
||||
const struct UCValStr *uc_val_2_str_vs(unsigned int val, const struct UCValStr *array);
|
||||
/** Find @val in @array.
|
||||
* @array must be sorted on val and must not be empty
|
||||
* (does a binary search)
|
||||
@@ -46,7 +57,7 @@ const char *uc_val_2_str_bs(unsigned int val,
|
||||
const struct UCValStr *array,
|
||||
size_t array_len);
|
||||
|
||||
/** find @val in @array.
|
||||
/** Find @val in @array.
|
||||
* the last .val in @array must be a null pointer.
|
||||
* (does a linear search)
|
||||
*
|
||||
@@ -56,4 +67,14 @@ const char *uc_val_2_str_bs(unsigned int val,
|
||||
*/
|
||||
const char *uc_str_2_str(const char *restrict val, const struct UCStrStr *array);
|
||||
|
||||
/** Find @val in @array, case insensitive
|
||||
* the last .val in @array must be a null pointer.
|
||||
* (does a linear search)
|
||||
*
|
||||
* @param val value to find, using strcasecmp
|
||||
* @param array array to search
|
||||
* @return the string associated with @val or null
|
||||
*/
|
||||
const char *uc_str_2_str_ci(const char *restrict val, const struct UCStrStr *array);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user