summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflorin.diaconescu <florin.diaconescu@protonmail.com>2019-04-13 12:51:01 +0300
committerErnestas Kulik <ekulik@redhat.com>2019-05-27 11:42:43 +0200
commit11da28bcfe30ff3ee88daab78bac15bad643af92 (patch)
tree6dc17b4817f00ca88cf1d65f602e2bd9c069b7bb
parenta6ce1d1e65fc8af88fcf65aec681375b08cff4f7 (diff)
downloadnautilus-11da28bcfe30ff3ee88daab78bac15bad643af92.tar.gz
eel: string: Add documentation
This commit adds comments describing the functionality, the parameters and the return values of the functions that were not documented.
-rw-r--r--eel/eel-string.c36
1 files changed, 36 insertions, 0 deletions
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)