ELC in dev
ELC-lang
载入中...
搜索中...
未找到
elc::defs::stream_n::memory_stream结构体 参考
类 elc::defs::stream_n::memory_stream 继承关系图:
[图例]
elc::defs::stream_n::memory_stream 的协作图:
[图例]

Public 成员函数

 memory_stream () noexcept
 
 ~memory_stream () noexcept
 
size_t bufsize () const noexcept
 
virtual voidseek (seek_type st, int_t offsize) noexcept override
 
virtual void seek_to (void *p) noexcept override
 
virtual void sync () noexcept override
 
virtual void flush () noexcept override
 
virtual void close () noexcept override
 
virtual void write (const byte *buf, size_t size) noexcept override
 
virtual size_t read (byte *buf, size_t size) noexcept override
 
- Public 成员函数 继承自 elc::defs::stream_n::base_stream_t
virtual ~base_stream_t ()=default
 
- Public 成员函数 继承自 elc::defs::stream_n::noexcept_stream_t
virtual int_t tell () noexcept override
 
virtual bool seek_to (int_t) noexcept override=0
 
- Public 成员函数 继承自 elc::defs::stream_n::noexcept_not_unreadable_istream_t
virtual bool is_end () noexcept override=0
 
virtual bool waitting_for_data () noexcept override=0
 
virtual operator bool () noexcept override
 

Public 属性

constexpr size_t buf_size =pow(10,BIT_POSSIBILITY)
 
byte_m
 
size_t _s
 
size_t _pos
 

详细描述

在文件 all_defs.cpp52894 行定义.

构造及析构函数说明

◆ memory_stream()

elc::defs::stream_n::memory_stream::memory_stream ( )
inlinenoexcept

在文件 all_defs.cpp52899 行定义.

52899 {
52900 _m = get<byte>[buf_size]();
52901 _pos = 0;
52902 _s = 0;
52903 }
constexpr T down_cast(U a) noexcept
向下转型至

◆ ~memory_stream()

elc::defs::stream_n::memory_stream::~memory_stream ( )
inlinenoexcept

在文件 all_defs.cpp52904 行定义.

52904 {
52905 unget(_m);
52906 }
constexpr struct elc::defs::memory::get_n::unget_t unget

成员函数说明

◆ bufsize()

size_t elc::defs::stream_n::memory_stream::bufsize ( ) const
inlinenoexcept

在文件 all_defs.cpp52907 行定义.

52907 {
52908 return get_size_of_get(_m);
52909 }
constexpr struct elc::defs::memory::get_n::get_size_of_get_t get_size_of_get

◆ close()

virtual void elc::defs::stream_n::memory_stream::close ( )
inlineoverridevirtualnoexcept

实现了 elc::defs::stream_n::base_stream_t.

在文件 all_defs.cpp52934 行定义.

52934 {
52935 unget(_m);
52936 _m = nullptr;
52937 _s = 0;
52938 }

◆ flush()

virtual void elc::defs::stream_n::memory_stream::flush ( )
inlineoverridevirtualnoexcept

实现了 elc::defs::stream_n::base_stream_t.

在文件 all_defs.cpp52931 行定义.

52931 {
52932 //do nothing
52933 }

◆ read()

virtual size_t elc::defs::stream_n::memory_stream::read ( byte buf,
size_t  size 
)
inlineoverridevirtualnoexcept

在文件 all_defs.cpp52946 行定义.

52946 {
52947 if(_pos+size>_s)
52948 size = _s-_pos;
52949 ::std::memcpy(buf,_m+_pos,size);
52950 _pos += size;
52951 return size;
52952 }
constexpr size_t size(::size_t v)

◆ seek()

virtual void * elc::defs::stream_n::memory_stream::seek ( seek_type  st,
int_t  offsize 
)
inlineoverridevirtualnoexcept

实现了 elc::defs::stream_n::base_stream_t.

在文件 all_defs.cpp52910 行定义.

52910 {
52911 switch(st){
52912 case beg:
52913 _pos = 0;
52914 return _m;
52915 case cur:
52917 return _m + _pos;
52918 case end:
52919 _pos = _s;
52920 return _m+_pos;
52921 default:
52922 return nullptr;
52923 }
52924 }

◆ seek_to()

virtual void elc::defs::stream_n::memory_stream::seek_to ( void p)
inlineoverridevirtualnoexcept

在文件 all_defs.cpp52925 行定义.

52925 {
52926 _pos = ((byte*)p)-_m;
52927 }

◆ sync()

virtual void elc::defs::stream_n::memory_stream::sync ( )
inlineoverridevirtualnoexcept

实现了 elc::defs::stream_n::base_stream_t.

在文件 all_defs.cpp52928 行定义.

52928 {
52929 //do nothing
52930 }

◆ write()

virtual void elc::defs::stream_n::memory_stream::write ( const byte buf,
size_t  size 
)
inlineoverridevirtualnoexcept

在文件 all_defs.cpp52939 行定义.

52939 {
52940 if(size>this->bufsize()-_pos)
52942 ::std::memcpy(_m+_pos,buf,size);
52943 _pos += size;
52944 _s = max(_pos,_s);
52945 }
constexpr size_T get_next_gold_size_to_resize_for_array(size_T size) noexcept
已知当前array的size,求下一个合适的提前分配大小
constexpr struct elc::defs::base::max_t max
constexpr struct elc::defs::memory::get_n::get_resize_t get_resize
size_t bufsize() const noexcept

类成员变量说明

◆ _m

byte* elc::defs::stream_n::memory_stream::_m

在文件 all_defs.cpp52896 行定义.

◆ _pos

size_t elc::defs::stream_n::memory_stream::_pos

在文件 all_defs.cpp52898 行定义.

◆ _s

size_t elc::defs::stream_n::memory_stream::_s

在文件 all_defs.cpp52897 行定义.

◆ buf_size

constexpr size_t elc::defs::stream_n::memory_stream::buf_size =pow(10,BIT_POSSIBILITY)
constexpr

在文件 all_defs.cpp52895 行定义.


该结构体的文档由以下文件生成: