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

struct  handle_type
 

函数

bool is_terminal_stream (base_handle_type handle) noexcept
 
handle_type init_output_stream () noexcept
 
handle_type init_input_stream () noexcept
 
handle_type init_error_stream () noexcept
 
bool is_eof (handle_type stream) noexcept
 
bool is_wait_input (handle_type stream) noexcept
 
size_t basic_read_impl (handle_type handle, void *buffer, size_t size) noexcept
 
template<class char_T >
size_t basic_read_impl (handle_type handle, char_T *buffer, size_t size) noexcept
 
size_t basic_write_impl (handle_type handle, const void *buffer, size_t size) noexcept
 
template<class char_T >
size_t basic_write_impl (handle_type handle, const char_T *buffer, size_t size) noexcept
 
size_t basic_read_for_terminal_impl (handle_type handle, base_io_char_type *buffer, size_t size) noexcept
 
size_t basic_write_for_terminal_impl (handle_type handle, const base_io_char_type *buffer, size_t size) noexcept
 
void basic_flush_impl (handle_type handle) noexcept
 
void basic_sync_impl (handle_type handle) noexcept
 
void basic_close_impl (handle_type handle) noexcept
 
int_t basic_tell_impl (handle_type handle) noexcept
 
int_t basic_seek_impl (handle_type handle, int_t offset, stream_n::seek_type type) noexcept
 
auto before_terminal_read (handle_type stream) noexcept
 
void after_terminal_read (handle_type stream, auto something) noexcept
 
auto before_terminal_write (handle_type stream) noexcept
 
void after_terminal_write (handle_type stream, auto something) noexcept
 

变量

typedef base_handle_type
 
constexpr auto zero_base_handle = base_handle_type(0)
 
typedef base_io_char_type
 
constexpr size_t code_convert_buf_size =
 

函数说明

◆ after_terminal_read()

void elc::APIs::streams::after_terminal_read ( handle_type  stream,
auto  something 
)
inlinenoexcept

在文件 all_defs.cpp57995 行定义.

57995 {
57996 #if SYSTEM_TYPE == windows
57997 SetConsoleMode(stream, something);
57998 #elif SYSTEM_TYPE == linux
57999 tcsetattr(stream, TCSANOW, &something);
58000 #endif
58001 }
函数调用图:
这是这个函数的调用关系图:

◆ after_terminal_write()

void elc::APIs::streams::after_terminal_write ( handle_type  stream,
auto  something 
)
inlinenoexcept

在文件 all_defs.cpp58017 行定义.

58017 {
58018 #if SYSTEM_TYPE == windows
58019 SetConsoleMode(stream, something);
58020 #elif SYSTEM_TYPE == linux
58021 //nothing to do
58022 #endif
58023 }
函数调用图:
这是这个函数的调用关系图:

◆ basic_close_impl()

void elc::APIs::streams::basic_close_impl ( handle_type  handle)
inlinenoexcept

在文件 all_defs.cpp57917 行定义.

57917 {
57918 #if SYSTEM_TYPE == windows
57919 CloseHandle(handle);
57920 #elif SYSTEM_TYPE == linux
57921 close(handle);
57922 #endif
57923 }
函数调用图:
这是这个函数的调用关系图:

◆ basic_flush_impl()

void elc::APIs::streams::basic_flush_impl ( handle_type  handle)
inlinenoexcept

在文件 all_defs.cpp57901 行定义.

57901 {
57902 #if SYSTEM_TYPE == windows
57903 FlushFileBuffers(handle);
57904 #elif SYSTEM_TYPE == linux
57905 fsync(handle);
57906 #endif
57907 }
函数调用图:
这是这个函数的调用关系图:

◆ basic_read_for_terminal_impl()

size_t elc::APIs::streams::basic_read_for_terminal_impl ( handle_type  handle,
base_io_char_type buffer,
size_t  size 
)
inlinenoexcept

在文件 all_defs.cpp57879 行定义.

57879 {
57880 #if SYSTEM_TYPE == windows
57881 DWORD read_count;
57882 push_and_disable_msvc_warning(6031);//返回值忽略警告diss
57883 ReadConsoleW(handle, buffer,(DWORD)size, &read_count, nullptr);
57885 return read_count;
57886 #elif SYSTEM_TYPE == linux
57887 return read(handle, buffer, size*sizeof(base_io_char_type))/sizeof(base_io_char_type);
57888 #endif
57889 }
#define pop_msvc_warning()
Definition all_defs.cpp:478
#define push_and_disable_msvc_warning(...)
Definition all_defs.cpp:479
函数调用图:
这是这个函数的调用关系图:

◆ basic_read_impl() [1/2]

template<class char_T >
size_t elc::APIs::streams::basic_read_impl ( handle_type  handle,
char_T *  buffer,
size_t  size 
)
inlinenoexcept

在文件 all_defs.cpp57860 行定义.

57860 {
57861 return basic_read_impl(handle, (void*)buffer, size*sizeof(char_T))/sizeof(char_T);
57862 }
size_t basic_read_impl(handle_type handle, void *buffer, size_t size) noexcept
函数调用图:

◆ basic_read_impl() [2/2]

size_t elc::APIs::streams::basic_read_impl ( handle_type  handle,
void buffer,
size_t  size 
)
inlinenoexcept

在文件 all_defs.cpp57848 行定义.

57848 {
57849 #if SYSTEM_TYPE == windows
57850 DWORD read_count;
57851 push_and_disable_msvc_warning(6031);//返回值忽略警告diss
57852 ReadFile(handle, buffer,(DWORD)size, &read_count, nullptr);
57854 return read_count;
57855 #elif SYSTEM_TYPE == linux
57856 return read(handle, buffer, size);
57857 #endif
57858 }
函数调用图:
这是这个函数的调用关系图:

◆ basic_seek_impl()

int_t elc::APIs::streams::basic_seek_impl ( handle_type  handle,
int_t  offset,
stream_n::seek_type  type 
)
inlinenoexcept

在文件 all_defs.cpp57933 行定义.

57933 {
57934 auto under_type =
57935 #if SYSTEM_TYPE == windows
57936 FILE_BEGIN
57937 #elif SYSTEM_TYPE == linux
57938 SEEK_SET
57939 #endif
57940 ;
57941 using namespace stream_n;
57942 switch(type){//{beg,end,cur};
57943 case beg:
57944 #if SYSTEM_TYPE == windows
57945 under_type = FILE_BEGIN;
57946 #elif SYSTEM_TYPE == linux
57947 under_type = SEEK_SET;
57948 #endif
57949 break;
57950 case end:
57951 #if SYSTEM_TYPE == windows
57952 under_type = FILE_END;
57953 #elif SYSTEM_TYPE == linux
57954 under_type = SEEK_END;
57955 #endif
57956 break;
57957 case cur:
57958 #if SYSTEM_TYPE == windows
57959 under_type = FILE_CURRENT;
57960 #elif SYSTEM_TYPE == linux
57961 under_type = SEEK_CUR;
57962 #endif
57963 break;
57964 }
57965 #if SYSTEM_TYPE == windows
57966 SetFilePointer(handle,(LONG)offset, nullptr, under_type);
57967 return basic_tell_impl(handle);
57968 #elif SYSTEM_TYPE == linux
57969 return lseek(handle, offset, under_type);
57970 #endif
57971 }
函数调用图:
这是这个函数的调用关系图:

◆ basic_sync_impl()

void elc::APIs::streams::basic_sync_impl ( handle_type  handle)
inlinenoexcept

在文件 all_defs.cpp57909 行定义.

57909 {
57910 #if SYSTEM_TYPE == windows
57911 FlushFileBuffers(handle);
57912 #elif SYSTEM_TYPE == linux
57913 fsync(handle);
57914 #endif
57915 }
函数调用图:
这是这个函数的调用关系图:

◆ basic_tell_impl()

int_t elc::APIs::streams::basic_tell_impl ( handle_type  handle)
inlinenoexcept

在文件 all_defs.cpp57925 行定义.

57925 {
57926 #if SYSTEM_TYPE == windows
57927 return SetFilePointer(handle, 0, nullptr, FILE_CURRENT);
57928 #elif SYSTEM_TYPE == linux
57929 return lseek(handle, 0, SEEK_CUR);
57930 #endif
57931 }
函数调用图:
这是这个函数的调用关系图:

◆ basic_write_for_terminal_impl()

size_t elc::APIs::streams::basic_write_for_terminal_impl ( handle_type  handle,
const base_io_char_type buffer,
size_t  size 
)
inlinenoexcept

在文件 all_defs.cpp57891 行定义.

57891 {
57892 #if SYSTEM_TYPE == windows
57893 DWORD write_count;
57894 WriteConsoleW(handle, buffer,(DWORD)size, &write_count, nullptr);
57895 return write_count;
57896 #elif SYSTEM_TYPE == linux
57897 return write(handle, buffer, size*sizeof(base_io_char_type))/sizeof(base_io_char_type);
57898 #endif
57899 }
函数调用图:
这是这个函数的调用关系图:

◆ basic_write_impl() [1/2]

template<class char_T >
size_t elc::APIs::streams::basic_write_impl ( handle_type  handle,
const char_T *  buffer,
size_t  size 
)
inlinenoexcept

在文件 all_defs.cpp57874 行定义.

57874 {
57875 return basic_write_impl(handle, (const void*)buffer, size*sizeof(char_T))/sizeof(char_T);
57876 }
size_t basic_write_impl(handle_type handle, const void *buffer, size_t size) noexcept
函数调用图:

◆ basic_write_impl() [2/2]

size_t elc::APIs::streams::basic_write_impl ( handle_type  handle,
const void buffer,
size_t  size 
)
inlinenoexcept

在文件 all_defs.cpp57864 行定义.

57864 {
57865 #if SYSTEM_TYPE == windows
57866 DWORD write_count;
57867 WriteFile(handle, buffer,(DWORD)size, &write_count, nullptr);
57868 return write_count;
57869 #elif SYSTEM_TYPE == linux
57870 return write(handle, buffer, size);
57871 #endif
57872 }
函数调用图:
这是这个函数的调用关系图:

◆ before_terminal_read()

auto elc::APIs::streams::before_terminal_read ( handle_type  stream)
inlinenoexcept

在文件 all_defs.cpp57973 行定义.

57973 {
57974 //GetConsoleMode if LINE_INPUT_MODE
57975 #if SYSTEM_TYPE == windows
57976 DWORD ConsoleModeBackup;
57977 GetConsoleMode(stream, &ConsoleModeBackup);
57978 //disable line input mode
57979 SetConsoleMode(stream, ConsoleModeBackup & ~ENABLE_LINE_INPUT);
57980 return ConsoleModeBackup;
57981 #elif SYSTEM_TYPE == linux
57982 //no echo and disable line input mode
57983 termios oldt;
57984 tcgetattr(stream, &oldt);
57985 {
57986 auto flgbak = oldt.c_lflag;
57987 oldt.c_lflag &= ~(ECHO | ICANON);
57988 tcsetattr(stream, TCSANOW, &oldt);
57989 oldt.c_lflag = flgbak;
57990 }
57991 return oldt;
57992 #endif
57993 }
函数调用图:
这是这个函数的调用关系图:

◆ before_terminal_write()

auto elc::APIs::streams::before_terminal_write ( handle_type  stream)
inlinenoexcept

在文件 all_defs.cpp58003 行定义.

58003 {
58004 //GetConsoleMode if LINE_INPUT_MODE
58005 #if SYSTEM_TYPE == windows
58006 DWORD ConsoleModeBackup;
58007 GetConsoleMode(stream, &ConsoleModeBackup);
58008 //enable ENABLE_PROCESSED_OUTPUT and ENABLE_WRAP_AT_EOL_OUTPUT ENABLE_VIRTUAL_TERMINAL_PROCESSING
58009 SetConsoleMode(stream, ConsoleModeBackup | ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
58010 return ConsoleModeBackup;
58011 #elif SYSTEM_TYPE == linux
58012 //nothing to do
58013 return 0;
58014 #endif
58015 }
函数调用图:
这是这个函数的调用关系图:

◆ init_error_stream()

handle_type elc::APIs::streams::init_error_stream ( )
inlinenoexcept

在文件 all_defs.cpp57814 行定义.

57814 {
57815 auto aret=
57816 #if SYSTEM_TYPE == windows
57817 GetStdHandle(STD_ERROR_HANDLE);
57818 #elif SYSTEM_TYPE == linux
57819 STDERR_FILENO;
57820 #endif
57821 return aret;
57822 }
函数调用图:
这是这个函数的调用关系图:

◆ init_input_stream()

handle_type elc::APIs::streams::init_input_stream ( )
inlinenoexcept

在文件 all_defs.cpp57805 行定义.

57805 {
57806 auto aret=
57807 #if SYSTEM_TYPE == windows
57808 GetStdHandle(STD_INPUT_HANDLE);
57809 #elif SYSTEM_TYPE == linux
57810 STDIN_FILENO;
57811 #endif
57812 return aret;
57813 }
函数调用图:
这是这个函数的调用关系图:

◆ init_output_stream()

handle_type elc::APIs::streams::init_output_stream ( )
inlinenoexcept

在文件 all_defs.cpp57796 行定义.

57796 {
57797 auto aret=
57798 #if SYSTEM_TYPE == windows
57799 GetStdHandle(STD_OUTPUT_HANDLE);
57800 #elif SYSTEM_TYPE == linux
57801 STDOUT_FILENO;
57802 #endif
57803 return aret;
57804 }
函数调用图:
这是这个函数的调用关系图:

◆ is_eof()

bool elc::APIs::streams::is_eof ( handle_type  stream)
inlinenoexcept

在文件 all_defs.cpp57825 行定义.

57825 {
57826 #if SYSTEM_TYPE == windows
57827 push_and_disable_msvc_warning(6031);//返回值忽略警告diss
57828 ReadFile(stream, nullptr, 0, nullptr, nullptr);
57830 return GetLastError() == ERROR_HANDLE_EOF;
57831 #elif SYSTEM_TYPE == linux
57832 return feof(stream);
57833 #endif
57834 }
函数调用图:
这是这个函数的调用关系图:

◆ is_terminal_stream()

bool elc::APIs::streams::is_terminal_stream ( base_handle_type  handle)
inlinenoexcept

在文件 all_defs.cpp57755 行定义.

57755 {
57756 #if SYSTEM_TYPE == windows
57757 return GetFileType(handle)==FILE_TYPE_CHAR;
57758 #elif SYSTEM_TYPE == linux
57759 return isatty(handle);
57760 #endif
57761 }
函数调用图:
这是这个函数的调用关系图:

◆ is_wait_input()

bool elc::APIs::streams::is_wait_input ( handle_type  stream)
inlinenoexcept

在文件 all_defs.cpp57836 行定义.

57836 {
57837 #if SYSTEM_TYPE == windows
57838 if(stream.is_terminal())
57839 return WaitForSingleObject(stream, 0) == WAIT_OBJECT_0;
57840 else
57841 return false;
57842 #elif SYSTEM_TYPE == linux
57843 return false;
57844 #endif
57845 }
bool is_terminal() const noexcept
函数调用图:
这是这个函数的调用关系图:

变量说明

◆ base_handle_type

typedef elc::APIs::streams::base_handle_type

在文件 all_defs.cpp57749 行定义.

◆ base_io_char_type

typedef elc::APIs::streams::base_io_char_type

在文件 all_defs.cpp57785 行定义.

◆ code_convert_buf_size

constexpr size_t elc::APIs::streams::code_convert_buf_size =
constexpr

在文件 all_defs.cpp57787 行定义.

◆ zero_base_handle

constexpr auto elc::APIs::streams::zero_base_handle = base_handle_type(0)
inlineconstexpr

在文件 all_defs.cpp57752 行定义.