4
* Copyright (c) 2006 Ryo Dairiki <ryo-dairiki@users.sourceforge.net>
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation and
10
* appearing in the file LICENSE.LGPL included in the package of this file.
11
* You can also redistribute it and/or modify it under the terms of
12
* the GNU General Public License as published by the Free Software Foundation and
13
* appearing in the file LICENSE.GPL included in the package of this file.
15
* This library is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22
* @author Ryo Dairiki <ryo-dairiki@users.sourceforge.net>
23
* @brief This is the header for the functions to manupulate strings.
26
#ifndef SCIMBRIDGESTRING_H_
27
#define SCIMBRIDGESTRING_H_
33
#include "scim-bridge.h"
40
#ifndef __STDC_ISO_10646__
42
* The type for wide string.
44
typedef uint32_t wchar;
47
* The type for wide string.
49
typedef wchar_t wchar;
53
* Translate an utf8 string into an ucs4 wide string.
55
* @param str String to translate.
56
* @param wstr The destination for the new wide string.
57
* @return The length of the new wide string. -1 means that it failed to translate.
59
ssize_t scim_bridge_string_to_wstring (wchar **wstr, const char *str);
62
* Translate an ucs4 wide string into an utf8 string.
64
* @param wstr Wide string to translate.
65
* @param str The destination for the new string.
66
* @return The length of the new string. -1 means that it failed to translate.
68
ssize_t scim_bridge_wstring_to_string (char **str, const wchar *wstr);
71
* Get the length of a string.
73
* @param str The string.
74
* @return The length of the string.
76
ssize_t scim_bridge_string_get_length (const char *str);
79
* Get the length of a wide string.
81
* @param str The wide string.
82
* @return The length of the wide string.
84
ssize_t scim_bridge_wstring_get_length (const wchar *wstr);
87
* Translate a string into an unsigned integer.
89
* @param str The string to translate.
90
* @param dst The destination pointer of uint.
91
* @return It returns RETVAL_SUCCEEDED if succeeded, otherwise it returns RETVAIL_FAILED.
93
retval_t scim_bridge_string_to_uint (unsigned int *dst, const char *str);
96
* Translate a string into a integer.
98
* @param str The string to translate.
99
* @param dst The destination pointer of int.
100
* @return It returns RETVAL_SUCCEEDED if succeeded, otherwise it returns RETVAIL_FAILED.
102
retval_t scim_bridge_string_to_int (int *dst, const char *str);
105
* Translate a string into a boolean.
107
* @param str The string to translate.
108
* @param dst The destination pointer of boolean.
109
* @return It returns RETVAL_SUCCEEDED if succeeded, otherwise it returns RETVAIL_FAILED.
111
retval_t scim_bridge_string_to_boolean (boolean *dst, const char *str);
114
* Translate an unsigned integer into a string.
116
* @param value The value to translate.
117
* @param str The destination pointer for the new string.
118
* @return The length of the new string if succeeded, otherwise it returns -1.
120
size_t scim_bridge_string_from_uint (char **str, unsigned int value);
123
* Translate a integer into a string.
125
* @param value The value to translate.
126
* @param str The destination pointer for the new string.
127
* @return The length of the new string if succeeded, otherwise it returns -1.
129
size_t scim_bridge_string_from_int (char **str, int value);
132
* Translate a boolean into a string.
134
* @param value The value to translate.
135
* @param str The destination pointer for the new string.
136
* @return The length of the new string if succeeded, otherwise it returns -1.
138
size_t scim_bridge_string_from_boolean (char **str, boolean value);
143
#endif /*SCIMBRIDGESTRING_H_*/