DCL 4.0
Loading...
Searching...
No Matches
__strumbs.h
Go to the documentation of this file.
1#ifndef __DCL_UNIX_WCS_H__
2#define __DCL_UNIX_WCS_H__ 20110117
3
7
8__DCL_BEGIN_NAMESPACE
9
10String __mbstostr(const char* _src, size_t n = (size_t) -1)
12
13// nt: not throw
14// ER: error return
15
16size_t __mbstostr_nt(const char* _mbs, size_t _nmbs, String& _str);
17size_t __strtombs_nt(const String& _str, char* _mbs, size_t _nmbs);
18
19#define MBSTOSTR_ER(mbs, nmbs, str) \
20 if (__mbstostr_nt(mbs, nmbs, str) == (size_t)-1) { \
21 errno = EILSEQ; \
22 return -1; \
23 }
24
25#define STRTOMBS(str, mbs) \
26 size_t n##mbs = __strtombs_nt(str, NULL, (size_t)-1); \
27 char* mbs = NULL; \
28 if (n##mbs != (size_t)-1) { \
29 mbs = (char*)alloca((n##mbs + 1) * sizeof(char)); \
30 n##mbs = __strtombs_nt(str, mbs, n##mbs + 1); \
31 }
32
33#define STRTOMBS_ER(str, mbs) \
34 STRTOMBS(str, mbs) \
35 else { \
36 errno = EILSEQ; \
37 return -1; \
38 }
39
40__DCL_END_NAMESPACE
41
42#endif // __DCL_UNIX_WCS_H__
size_t __strtombs_nt(const String &_str, char *_mbs, size_t _nmbs)
Definition __strumbs.cpp:27
size_t __mbstostr_nt(const char *_mbs, size_t _nmbs, String &_str)
Definition __strumbs.cpp:15
__DCL_BEGIN_NAMESPACE String __mbstostr(const char *_src, size_t n=(size_t) -1) __DCL_THROWS1(CharsetConvertException *)
Definition __strumbs.cpp:8
#define __DCL_THROWS1(e)
Definition Config.h:167
void CharsetConvertException *size_t n
Definition SQLField.cpp:253