ELC in dev
ELC-lang
载入中...
搜索中...
未找到
elc::APIs::str_code_convert 命名空间参考

函数

string_t< char > to_char_str (string_view_t< char_t > a) noexcept
 
string_t< char_tto_char_t_str (string_view_t< char > a) noexcept
 

函数说明

◆ to_char_str()

string_t< char > elc::APIs::str_code_convert::to_char_str ( string_view_t< char_t a)
inlinenoexcept

在文件 all_defs.cpp40519 行定义.

40519 {
40520 string_t<char>aret;
40521 ::std::mbstate_t stat{};
40522 push_and_disable_msvc_warning(26494)//未初始化警告diss
40523 char r[MB_LEN_MAX];
40524 ptrdiff_t s;
40526 for(auto c:a){
40527 s=::std::c32rtomb(r,c,&stat);
40528 if(s < 0)//-1
40529 die_with(locale::str::code_convert_error);
40530 aret+=string_view_t<char>{(char*)r,note::size((size_t)s)};
40531 }
40532 return aret;
40533 }
#define pop_msvc_warning()
Definition all_defs.cpp:478
#define push_and_disable_msvc_warning(...)
Definition all_defs.cpp:479
函数调用图:
这是这个函数的调用关系图:

◆ to_char_t_str()

string_t< char_t > elc::APIs::str_code_convert::to_char_t_str ( string_view_t< char >  a)
inlinenoexcept

在文件 all_defs.cpp40534 行定义.

40534 {
40535 string_t<char_t>aret;
40536 ::std::mbstate_t stat{};
40537 push_and_disable_msvc_warning(26494);//未初始化警告diss
40538 char_t c;
40539 ptrdiff_t s;
40541 auto i=a.cbegin(),e=a.cend();
40542 while(i!=e){
40543 s=::std::mbrtoc32(&c,i,MB_LEN_MAX,&stat);
40544 if(s < 0)//-3 或 -1
40545 die_with(locale::str::code_convert_error);
40546 i+=s;
40547 aret+=c;
40548 }
40549 return aret;
40550 }
char32_t char_t
Definition all_defs.cpp:351
constexpr const_iterator cbegin() const noexcept
constexpr const_iterator cend() const noexcept
函数调用图:
这是这个函数的调用关系图: