Logo
中文版
详情联系: neusar-support@reachauto.com
ara::per::ReadWriteAccessor类 参考

用于读写文件数据的类 更多...

#include <read_write_accessor.h>

类 ara::per::ReadWriteAccessor 继承关系图:
Inheritance graph
ara::per::ReadWriteAccessor 的协作图:
Collaboration graph

Public 成员函数

 ReadWriteAccessor (const std::shared_ptr< fileaccess::ReadAccessorImpl > &impl_ptr, std::shared_ptr< fileaccess::IFileStream > &stream)
 construtor of ReadWriteAccessor 更多...
 
 ReadWriteAccessor ()=delete
 The default constructor for ReadWriteAccessor shall not be used. 更多...
 
ara::core::Result< void > SyncToFile () noexcept
 Triggers flushing of the current file content to the physical storage. 更多...
 
ara::core::Result< void > SetFileSize (std::uint64_t size) noexcept
 Reduces the size of the file to ’size’, effectively removing the current content of the file beyond this size. 更多...
 
ara::core::Result< void > WriteText (ara::core::StringView s) noexcept
 Writes the content of a StringView to the file 更多...
 
ara::core::Result< void > WriteBinary (ara::core::Span< const ara::core::Byte > b) noexcept
 Writes the content of a Span of Byte to the file. 更多...
 
ReadWriteAccessoroperator<< (ara::core::StringView s) noexcept
 Writes the content of a StringView to the file. 更多...
 
- Public 成员函数 继承自 ara::per::ReadAccessor
 ReadAccessor (const std::shared_ptr< fileaccess::ReadAccessorImpl > &impl_ptr)
 construtor of ReadAccessor 更多...
 
 ReadAccessor ()=delete
 The default constructor for ReadAccessor shall not be used. 更多...
 
 ReadAccessor (ReadAccessor &&ra)=delete
 The move constructor for ReadAccessor shall not be used. 更多...
 
ReadAccessoroperator= (ReadAccessor &&ra) &=delete
 The move assignment operator for ReadAccessor shall not be used. 更多...
 
 ReadAccessor (const ReadAccessor &)=delete
 The copy constructor for ReadAccessor shall not be used. 更多...
 
ReadAccessoroperator= (const ReadAccessor &)=delete
 The copy assignment operator for ReadAccessor shall not be used. 更多...
 
 ~ReadAccessor () noexcept=default
 Destructor for ReadAccessor. 更多...
 
ara::core::Result< char > PeekChar () noexcept
 Returns the character at the current position of the file. 更多...
 
ara::core::Result< ara::core::Byte > PeekByte () const noexcept
 Returns the byte at the current position of the file. 更多...
 
ara::core::Result< char > GetChar () noexcept
 Returns the character at the current position of the file, advancing the current position 更多...
 
ara::core::Result< ara::core::Byte > GetByte () noexcept
 Returns the byte at the current position of the file, advancing the current position. 更多...
 
ara::core::Result< ara::core::String > ReadText (uint64_t n) noexcept
 Reads a number of characters into a String, starting from the current position. 更多...
 
ara::core::Result< ara::core::String > ReadText () noexcept
 Reads all remaining characters into a String, starting from the current position. 更多...
 
ara::core::Result< ara::core::Vector< ara::core::Byte > > ReadBinary () noexcept
 Reads all remaining bytes into a Vector of Byte, starting from the current position. 更多...
 
ara::core::Result< ara::core::Vector< ara::core::Byte > > ReadBinary (uint64_t n) noexcept
 Reads a number of bytes into a Vector of Byte, starting from the current position. 更多...
 
ara::core::Result< ara::core::String > ReadLine (char delimiter='\n') noexcept
 Reads a complete line of characters into a String, advancing the current position accordingly 更多...
 
uint64_t GetPosition () const noexcept
 Returns the current position relative to the beginning of the file. 更多...
 
ara::core::Result< void > SetPosition (uint64_t position) noexcept
 Sets the current position relative to the beginning of the file. 更多...
 
ara::core::Result< uint64_t > MovePosition (Origin const origin, int64_t const offset) noexcept
 Moves the current position in the file relative to the Origin. 更多...
 
bool IsEof () const noexcept
 Checks if the current position is at end of file.。 更多...
 
uint64_t GetSize () const noexcept
 Returns the current size of a file in bytes 更多...
 

详细描述

用于读写文件数据的类

Swsid
SWS_PER_00343
符合标准
Yes
非标原因
N/A
种类
class
符号
ara::per::ReadWriteAccessor
范围
namespace ara::per
基类
N/A
分类
ara
头文件
注解
代码示例及类句柄的获取说明: 见FileStorage class相应的示例获取的proxy句柄。 auto accessor = proxy->OpenFileReadWrite(StringView("filename")); if (!accessor) { 以读写方式打开文件失败,信息为:accessor.Error().Message(); 相应处理 } auto ac = std::move(accessor).Value(); ac即为此类的指针。
模板参数
N/A@uptrace{N/A}

在文件 第 行定义.

构造及析构函数说明

◆ ReadWriteAccessor()

ara::per::ReadWriteAccessor::ReadWriteAccessor ( const std::shared_ptr< fileaccess::ReadAccessorImpl > &  impl_ptr,
std::shared_ptr< fileaccess::IFileStream > &  stream 
)
inline

construtor of ReadWriteAccessor

模板参数
N/A
参数
[in]impl_ptrshared_ptr of ReadAccessorImpl class
[in]streamshared_ptr of IFileStream class
[out]N/A
[in,out]N/A
返回
N/A
注解
construtor of ReadWriteAccessor
异常
N/A
Swsid
N/A
符合标准
yes
非标原因
N/A
种类
function
可见
public
线程安全
no
Fireandforget
no
错误
N/A
头文件
ara/per/readwrite_accessor.h
异常安全
N/A
分类
ara
范围
namespace ara::per::ReadWriteAccessor @uptrace{N/A}

在文件 第 行定义.