eel: string: Add documentation

This commit adds comments describing the functionality,
the parameters and the return values of the functions that were not
documented.
This commit is contained in:
florin.diaconescu 2019-04-13 12:51:01 +03:00 committed by Ernestas Kulik
parent a6ce1d1e65
commit 11da28bcfe

View file

@ -109,6 +109,15 @@ eel_str_capitalize (const char *string)
return capitalized;
}
/**
* eel_str_middle_truncate:
* @string: (not nullable): input string
* truncate_length: length of the truncated string
*
* Returns: (transfer full): a newly-allocated copy of @string with its middle
* truncated and replaced with ellipsis to fit into @truncate_length characters.
* If length of @string is already small enough, returns a copy of @string.
*/
gchar *
eel_str_middle_truncate (const gchar *string,
guint truncate_length)
@ -151,6 +160,15 @@ eel_str_middle_truncate (const gchar *string,
return g_strconcat (left_substring, ellipsis, right_substring, NULL);
}
/**
* eel_str_strip_substring_and_after:
* @string: input string
* @substring: (not nullable): substring to use in search
*
* Returns: (transfer full): a copy of @string with the first occurence of
* @substring removed, along with any trailing characters.
* If @string is %NULL, returns %NULL.
*/
char *
eel_str_strip_substring_and_after (const char *string,
const char *substring)
@ -175,6 +193,15 @@ eel_str_strip_substring_and_after (const char *string,
substring_position - string);
}
/**
* eel_str_replace_substring:
* @string: input string
* @substring: (not nullable): string to be replaced
* @replacement: string used as replacement
*
* Returns: (transfer full): a copy of @string with all occurences of @substring
* replaced with @replacement.
*/
char *
eel_str_replace_substring (const char *string,
const char *substring,
@ -285,6 +312,15 @@ get_common_prefix_length (char *str_a,
return matching_chars;
}
/**
* eel_str_get_common_prefix:
* @strs: a list of strings
* @min_required_len: the minimum number of characters required in prefix
*
* Returns: (transfer full): the common prefix for strings in @strs.
* If no such prefix exists or if the common prefix is smaller than
* @min_required_len, %NULL is returned.
*/
char *
eel_str_get_common_prefix (GList *strs,
int min_required_len)