Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
temp_file_fixture Struct Reference

Public Member Functions

 temp_file_fixture ()
 
 ~temp_file_fixture ()
 
std::string create_temp_file (const std::string &contents)
 
std::string create_temp_file (const void *data, size_t size)
 
 temp_file_fixture ()
 
 ~temp_file_fixture ()
 
std::string create_temp_file (const std::string &contents)
 

Public Attributes

std::list< bfs::path > paths
 

Detailed Description

Definition at line 15 of file test_compressed_file.cpp.

Constructor & Destructor Documentation

◆ temp_file_fixture() [1/2]

temp_file_fixture::temp_file_fixture ( )
inline

Definition at line 16 of file test_compressed_file.cpp.

16{}

◆ ~temp_file_fixture() [1/2]

temp_file_fixture::~temp_file_fixture ( )
inline

Definition at line 18 of file test_compressed_file.cpp.

18 {
19 for (const auto& p: paths) {
20 if (bfs::exists(p)) {
21 bfs::remove(p);
22 }
23 }
24 }
const mie::Vuint & p
Definition bn.cpp:27
std::list< bfs::path > paths

◆ temp_file_fixture() [2/2]

temp_file_fixture::temp_file_fixture ( )
inline

Definition at line 16 of file test_configuration_utils.cpp.

16{}

◆ ~temp_file_fixture() [2/2]

temp_file_fixture::~temp_file_fixture ( )
inline

Definition at line 18 of file test_configuration_utils.cpp.

18 {
19 for (const auto& p: paths) {
20 if (bfs::exists(p)) {
21 bfs::remove(p);
22 }
23 }
24 }

Member Function Documentation

◆ create_temp_file() [1/3]

std::string temp_file_fixture::create_temp_file ( const std::string & contents)
inline

Definition at line 26 of file test_compressed_file.cpp.

26 {
27 auto path = bfs::temp_directory_path() / bfs::unique_path();
28 auto os = bfs::ofstream(path, std::ios_base::out);
29 os << contents;
30 os.close();
31 return paths.emplace_back(std::move(path)).generic_string();
32 }
wraps boost::filesystem::path to provide platform independent path manipulation.
os_t os

◆ create_temp_file() [2/3]

std::string temp_file_fixture::create_temp_file ( const std::string & contents)
inline

Definition at line 26 of file test_configuration_utils.cpp.

26 {
27 auto path = bfs::temp_directory_path() / bfs::unique_path();
28 auto os = bfs::ofstream(path, std::ios_base::out);
29 os << contents;
30 os.close();
31 return paths.emplace_back(std::move(path)).generic_string();
32 }

◆ create_temp_file() [3/3]

std::string temp_file_fixture::create_temp_file ( const void * data,
size_t size )
inline

Definition at line 34 of file test_compressed_file.cpp.

34 {
35 auto path = bfs::temp_directory_path() / bfs::unique_path();
36 auto os = bfs::ofstream(path, std::ios_base::out|std::ios_base::binary);
37 if (data && size)
38 os.write(reinterpret_cast<const char*>(data), size);
39 os.close();
40 return paths.emplace_back(std::move(path)).generic_string();
41 }

Member Data Documentation

◆ paths

std::list< bfs::path > temp_file_fixture::paths

Definition at line 43 of file test_compressed_file.cpp.


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