From 11da28bcfe30ff3ee88daab78bac15bad643af92 Mon Sep 17 00:00:00 2001 From: "florin.diaconescu" Date: Sat, 13 Apr 2019 12:51:01 +0300 Subject: eel: string: Add documentation This commit adds comments describing the functionality, the parameters and the return values of the functions that were not documented. --- eel/eel-string.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/eel/eel-string.c b/eel/eel-string.c index 6720d0af6..f6498fc9a 100644 --- a/eel/eel-string.c +++ b/eel/eel-string.c @@ -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) -- cgit v1.2.1