1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Add file wrappers.

This commit is contained in:
Bartosz Taudul
2017-09-30 16:19:50 +02:00
parent e2cd3106ae
commit 2021b7460a
4 changed files with 80 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
#ifndef __TRACYFILEREAD_HPP__
#define __TRACYFILEREAD_HPP__
#include <stdio.h>
namespace tracy
{
class FileRead
{
public:
static FileRead* Open( const char* fn )
{
auto f = fopen( fn, "rb" );
return f ? new FileRead( f ) : nullptr;
}
~FileRead()
{
fclose( m_file );
}
size_t Read( void* ptr, size_t size )
{
return fread( ptr, 1, size, m_file );
}
private:
FileRead( FILE* f ) : m_file( f ) {}
FILE* m_file;
};
}
#endif