![]() | ![]() | ![]() | Evolution API Reference: libedataserver, utility library | ![]() |
---|
Utility FunctionsUtility Functions — Miscellaneous utility functions for evolution-data-server. |
#include <libedataserver/e-util.h> int e_util_mkdir_hier (const char *path, mode_t mode); gchar* e_util_strstrcase (const gchar *haystack, const gchar *needle); gchar* e_util_unicode_get_utf8 (const gchar *text, gunichar *out); const gchar* e_util_utf8_strstrcase (const gchar *haystack, const gchar *needle); const gchar* e_util_utf8_strstrcasedecomp (const gchar *haystack, const gchar *needle); size_t e_strftime (char *s, size_t max, const char *fmt, const struct tm *tm); size_t e_utf8_strftime (char *s, size_t max, const char *fmt, const struct tm *tm);
int e_util_mkdir_hier (const char *path, mode_t mode);
Creates a directory hierarchy based on the string path
. If path
is prefixed by a '/', the directories will be created relative to
the root of the file system; otherwise, the directories will be
created relative to the current directory.
path : | The directory hierarchy to create. |
mode : | The permissions to use for the directories. |
Returns : | 0 on success; -1 on failure. |
gchar* e_util_strstrcase (const gchar *haystack, const gchar *needle);
Find the first instance of needle
in haystack
, ignoring case.
haystack : | The string to search in. |
needle : | The string to search for. |
Returns : | A pointer to the start of needle in haystack , or NULL if
needle is not found.
|
gchar* e_util_unicode_get_utf8 (const gchar *text, gunichar *out);
Get a UTF-8 character from the beginning of text
.
text : | The string to take the UTF-8 character from. |
out : | The location to store the UTF-8 character in. |
Returns : | A pointer to the next character in text after out .
|
const gchar* e_util_utf8_strstrcase (const gchar *haystack, const gchar *needle);
Find the first instance of needle
in haystack
, ignoring
case. Both needle
and haystack
are UTF-8 strings.
haystack : | The string to search in. |
needle : | The string to search for. |
Returns : | A pointer to the first instance of needle in haystack , or
NULL if either of the strings are not legal UTF-8 strings.
|
const gchar* e_util_utf8_strstrcasedecomp (const gchar *haystack, const gchar *needle);
Find the first instance of needle
in haystack
, where both needle
and haystack
are UTF-8 strings. Both strings are stripped and
decomposed for comparison, and case is ignored.
haystack : | The string to search in. |
needle : | The string to search for. |
Returns : | A pointer to the first instance of needle in haystack , or
NULL if either of the strings are not legal UTF-8 strings.
|
size_t e_strftime (char *s, size_t max, const char *fmt, const struct tm *tm);
This function is a wrapper around the strftime(3) function, which converts the %l and %k (12h and 24h) format variables if necessary.
s : | The string array to store the result in. |
max : | The size of array s .
|
fmt : | The formatting to use on tm .
|
tm : | The time value to format. |
Returns : | The number of characters placed in s .
|
size_t e_utf8_strftime (char *s, size_t max, const char *fmt, const struct tm *tm);
The UTF-8 equivalent of e_strftime()
.
s : | The string array to store the result in. |
max : | The size of array s .
|
fmt : | The formatting to use on tm .
|
tm : | The time value to format. |
Returns : | The number of characters placed in s .
|
<< ETrie | EUrl >> |