From 20a1360bd87c9be583fd9fc540a8097ff2022781 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Wed, 10 Dec 2008 17:08:56 +0100 Subject: Add new plugin "relay", new function "string_format_size" in plugin API --- doc/en/dev/plugin_c_api.en.xml | 73 +++++++++++++++++++++++++++++++++++------- 1 file changed, 62 insertions(+), 11 deletions(-) (limited to 'doc/en/dev/plugin_c_api.en.xml') diff --git a/doc/en/dev/plugin_c_api.en.xml b/doc/en/dev/plugin_c_api.en.xml index 097e8d80c..58eabed6f 100644 --- a/doc/en/dev/plugin_c_api.en.xml +++ b/doc/en/dev/plugin_c_api.en.xml @@ -722,7 +722,9 @@ char *weechat_string_strip ( Example: - char *str = weechat_strip (string, " ", 0, 1); /* remove spaces at end of string */ + +char *str = weechat_string_strip (string, " ", 0, 1); /* remove spaces at end of string */ + @@ -857,7 +859,7 @@ char **weechat_string_explode ( Examples: - + char **argv; int argc; argv = weechat_string_explode ("abc de fghi", " ", 0, 0, &argc); @@ -877,7 +879,7 @@ argv = weechat_string_explode ("abc de fghi", " ", 1, 0, &argc); argc == 3 */ weechat_string_free_exploded (argv); - + @@ -909,13 +911,13 @@ void weechat_string_free_exploded (char **exploded_string); Example: - + char *argv; int argc; argv = weechat_string_explode (string, " ", 0, 0, &argc); ... weechat_string_free_exploded (, argv); - + @@ -959,13 +961,13 @@ char *weechat_string_build_with_exploded ( Example: - + char **argv; int argc; argv = weechat_string_explode ("abc def ghi", " ", 0, 0, &argc); char *string = weechat_string_build_with_exploded (argv, ";"); /* string == "abc;def;ghi" */ - + @@ -1040,11 +1042,60 @@ void weechat_string_free_splitted_command (char **splitted_command); Example: - + char **argv = weechat_string_split_command ("/command1;/command2", ';'); ... weechat_string_free_splitted_command (argv); - + + + + +
+ weechat_string_format_size + + + Prototype: + +char *weechat_string_format_size (unsigned long size); + + + + Build a string with formated size and translated unit. + + + Arguments: + + + + : size + + + + + + Return value: string with formated size and translated unit. + + + + Result has to be free by a call to "free" after use. + + + + Example: + +char *str = weechat_string_format_size (0); /* str == "0 byte" (english locale) */ +if (str) + free (str); +char *str = weechat_string_format_size (200); /* str == "200 bytes" (english locale) */ +if (str) + free (str); +char *str = weechat_string_format_size (1536); /* str == "1.5 KB" (english locale) */ +if (str) + free (str); +char *str = weechat_string_format_size (2097152); /* str == "2 MB" (english locale) */ +if (str) + free (str); +
@@ -1123,10 +1174,10 @@ int weechat_utf8_is_valid (const char *string, char **error); Example: - + char *error; if (weechat_utf8_is_valid (string, &error)) ... - + -- cgit v1.2.3