ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
file_operations::file_data Class Reference

Read-only contents of a file, either bundled into the ESBMC binary or read from disk. More...

#include <filesystem.h>

Public Member Functions

 file_data ()=default
 file_data (const file_data &)=delete
file_data & operator= (const file_data &)=delete
 file_data (file_data &&)=default
file_data & operator= (file_data &&)=default
std::string_view view () const noexcept
size_t size () const noexcept
bool is_bundled () const noexcept

Static Public Member Functions

static file_data bundled (const char *data, size_t size)
 Borrows size bytes of static storage without copying them.
static file_data owned (std::string data)
 Takes ownership of contents read from disk.

Detailed Description

Read-only contents of a file, either bundled into the ESBMC binary or read from disk.

Bundled contents are borrowed from .rodata, so reading one costs no allocation; contents read from disk are owned. Either way view() is NUL-terminated at size(), which clang's Lexer requires of buffers handed to it directly – for bundled files that comes from the sentinel flail appends.

Constructor & Destructor Documentation

◆ file_data() [1/3]

file_operations::file_data::file_data ( )
default

◆ file_data() [2/3]

file_operations::file_data::file_data ( const file_data & )
delete

◆ file_data() [3/3]

file_operations::file_data::file_data ( file_data && )
default

Member Function Documentation

◆ bundled()

file_data file_data::bundled ( const char * data,
size_t size )
static

Borrows size bytes of static storage without copying them.

data[size] must be '\0'; pass the _size symbol flail generates, which excludes the sentinel it appends.

◆ is_bundled()

bool file_data::is_bundled ( ) const
noexcept

◆ operator=() [1/2]

file_data & file_operations::file_data::operator= ( const file_data & )
delete

◆ operator=() [2/2]

file_data & file_operations::file_data::operator= ( file_data && )
default

◆ owned()

file_data file_data::owned ( std::string data)
static

Takes ownership of contents read from disk.

◆ size()

size_t file_data::size ( ) const
noexcept

◆ view()

std::string_view file_data::view ( ) const
noexcept

The documentation for this class was generated from the following files: