aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/evil/evil_util.h
blob: e1fdf26387bbeb2746f409d90268fb651f3afac2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#ifndef __EVIL_UTIL_H__
#define __EVIL_UTIL_H__


/**
 * @brief Convert a string from char * to wchar_t *.
 *
 * @param text The string to convert.
 * @return The converted string.
 *
 * Convert a string from char * to wchar_t * and return it. If the
 * allocation or conversion fails, NULL is returned. On success, the
 * returned value must be freed when it is not used anymore.
 *
 * Conformity: Non applicable.
 *
 * Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000,
 * Windows XP.
 *
 * @ingroup Evil
 */
EAPI wchar_t *evil_char_to_wchar(const char *text);

/**
 * @brief Convert a string from wchar_t * to char *.
 *
 * @param text The string to convert.
 * @return The converted string.
 *
 * Convert a string from wchar_t * to char * and return it. If the
 * allocation or conversion fails, NULL is returned. On success, the
 * returned value must be freed when it is not used anymore.
 *
 * Conformity: Non applicable.
 *
 * Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000,
 * Windows XP.
 *
 * @ingroup Evil
 */
EAPI char *evil_wchar_to_char(const wchar_t *text);

/**
 * @brief Convert a string from UTF-16 to UTF-8.
 *
 * @param text The string to convert in UTF-16.
 * @return The converted string in UTF-8.
 *
 * Convert a string from UTF-16 to UTF-8 and return it. If the
 * allocation or conversion fails, NULL is returned. On success, the
 * returned value must be freed when it is not used anymore.
 *
 * Conformity: Non applicable.
 *
 * Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000,
 * Windows XP.
 *
 * @ingroup Evil
 */
EAPI char *evil_utf16_to_utf8(const wchar_t *text);

EAPI const char *evil_format_message(long err);

EAPI const char *evil_last_error_get(void);

/**
 * @brief Return a dir to store temporary files.
 *
 * @return The directory to store temporary files.
 *
 * Return a directory to store temporary files. The function gets
 * the value of the following environment variables, and in that order:
 * - TMP
 * - TEMP
 * - USERPROFILE
 * - WINDIR
 * and returns its value if it exists. If none exists, the function
 * returns "C:\".
 *
 * Conformity: Non applicable.
 *
 * Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000,
 * Windows XP.

 * @deprecated
 * This function is deprecated and returns @c NULL.
 * Use eina_environment_tmp_get() instead.
 *
 * @ingroup Evil
 */
EAPI const char *evil_tmpdir_get(void);

/**
 * @brief Return a dir to store personal files.
 *
 * @return The directory to store personal files.
 *
 * Return a directory to store personal files. The function gets
 * the value of the following environment variables, and in that order:
 * - HOME
 * - USERPROFILE
 * - WINDIR
 * and returns its value if it exists. If none exists, the function
 * returns "C:\".
 *
 * Conformity: Non applicable.
 *
 * Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000,
 * Windows XP.

 * @deprecated
 * This function is deprecated and returns @c NULL.
 * Use eina_environment_home_get() instead.
 *
 * @ingroup Evil
 */
EAPI const char *evil_homedir_get(void);

/**
 * @brief check if the given path is absolute.
 *
 * @param path The path to check.
 * @return 1 if the given path is absolute, 0 otherwise.
 *
 * Check if the path @p path is absolute or not. An absolute path must
 * begin with a letter (upper or lower case), followed by by the char
 * ':', followed by the char '/' or '\'. If @p path is absolute this
 * function returns 1, otherwise it returns 0. If @p path is @c NULL,
 * it returns 0.
 *
 * Conformity: Non applicable.
 *
 * Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000,
 * Windows XP.
 *
 * @since 1.7
 *
 * @ingroup Evil
 */
EAPI int evil_path_is_absolute(const char *path);

#endif /* __EVIL_UTIL_H__ */