4#include "MRPch/MRBindingMacros.h"
12MR_BIND_IGNORE
MRMESH_API FILE *
fopen(
const std::filesystem::path & filename,
const char * mode );
20 File(
File && r ) : handle_( r.handle_ ) { r.detach(); }
21 File(
const std::filesystem::path & filename,
const char * mode ) { open( filename, mode ); }
25 File& operator =(
File && r ) { close(); handle_ = r.handle_; r.detach();
return *
this; }
27 operator FILE *()
const {
return handle_; }
29 MRMESH_API FILE *
open(
const std::filesystem::path & filename,
const char * mode );
35 void attach( FILE * h ) {
if ( handle_ != h ) { close(); handle_ = h; } }
38 FILE * handle_ =
nullptr;
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
the class to open C FILE handle and automatically close it in the destructor
Definition MRFile.h:16
void attach(FILE *h)
gives control over the handle to this object
Definition MRFile.h:35
MRMESH_API FILE * open(const std::filesystem::path &filename, const char *mode)
File(const File &)=delete
void detach()
the user takes control over the handle
Definition MRFile.h:33
~File()
Definition MRFile.h:22
File(const std::filesystem::path &filename, const char *mode)
Definition MRFile.h:21
File(File &&r)
Definition MRFile.h:20
Definition MRCameraOrientationPlugin.h:8
MR_BIND_IGNORE MRMESH_API FILE * fopen(const std::filesystem::path &filename, const char *mode)
this version of fopen unlike std::fopen supports unicode file names on Windows