Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ScopedFileHelper::ScopedFile Class Reference

File object type. More...

#include <ScopedFileHelper.h>

Public Member Functions

std::string getFileName () const
 Getter for the filename with path. More...
 
ScopedFileoperator= (const ScopedFile &other)
 Assignement. More...
 
void release () const
 Release the resource from management. More...
 
 ScopedFile (const ScopedFile &other)
 Copy construction. More...
 
 ScopedFile (const std::string &fileContents, const std::string &fileName)
 Constructor generates the file. More...
 
 ScopedFile (const std::string &fileContents, const std::string &fileName, const std::string &fileDirectory)
 Constructor generates the file. More...
 
 ~ScopedFile ()
 Free up resources. More...
 

Private Member Functions

void doCreateFile (const std::string &fileContents, const Poco::Path &fileNameAndPath)
 Common method used by all constructors. More...
 
void operator delete (void *)
 
void operator delete[] (void *)
 
void * operator new (size_t)
 
void * operator new[] (size_t)
 

Private Attributes

std::ofstream m_file
 
std::string m_filename
 

Detailed Description

File object type.

Provides exception save file creation/destruction.

This is a resource management type. Objects of this type are limited to stack allocation.

Definition at line 24 of file ScopedFileHelper.h.

Constructor & Destructor Documentation

◆ ScopedFile() [1/3]

ScopedFileHelper::ScopedFile::ScopedFile ( const std::string &  fileContents,
const std::string &  fileName 
)

Constructor generates the file.

Sets location to be the temp directory

Definition at line 21 of file ScopedFileHelper.cpp.

References doCreateFile(), and Mantid::Kernel::SingletonHolder< T >::Instance().

◆ ScopedFile() [2/3]

ScopedFileHelper::ScopedFile::ScopedFile ( const std::string &  fileContents,
const std::string &  fileName,
const std::string &  fileDirectory 
)

Constructor generates the file.

Sets location as defined by the fileDirectory.

Definition at line 30 of file ScopedFileHelper.cpp.

References doCreateFile().

◆ ScopedFile() [3/3]

ScopedFileHelper::ScopedFile::ScopedFile ( const ScopedFile other)

Copy construction.

Definition at line 52 of file ScopedFileHelper.cpp.

References m_filename.

◆ ~ScopedFile()

ScopedFileHelper::ScopedFile::~ScopedFile ( )

Free up resources.

Definition at line 78 of file ScopedFileHelper.cpp.

References m_file, and m_filename.

Member Function Documentation

◆ doCreateFile()

void ScopedFileHelper::ScopedFile::doCreateFile ( const std::string &  fileContents,
const Poco::Path &  fileNameAndPath 
)
private

Common method used by all constructors.

Creates a file containing the ASCII file contents and 'remembers' the location of that file.

Definition at line 61 of file ScopedFileHelper.cpp.

References m_file, and m_filename.

Referenced by ScopedFile().

◆ getFileName()

std::string ScopedFileHelper::ScopedFile::getFileName ( ) const

Getter for the filename with path.

Returns
File name and path.

Definition at line 75 of file ScopedFileHelper.cpp.

References m_filename.

◆ operator delete()

void ScopedFileHelper::ScopedFile::operator delete ( void *  )
private

◆ operator delete[]()

void ScopedFileHelper::ScopedFile::operator delete[] ( void *  )
private

◆ operator new()

void * ScopedFileHelper::ScopedFile::operator new ( size_t  )
private

◆ operator new[]()

void * ScopedFileHelper::ScopedFile::operator new[] ( size_t  )
private

◆ operator=()

ScopedFile & ScopedFileHelper::ScopedFile::operator= ( const ScopedFile other)

Assignement.

Definition at line 42 of file ScopedFileHelper.cpp.

References m_file, and m_filename.

◆ release()

void ScopedFileHelper::ScopedFile::release ( ) const

Release the resource from management.

Definition at line 39 of file ScopedFileHelper.cpp.

References m_filename.

Member Data Documentation

◆ m_file

std::ofstream ScopedFileHelper::ScopedFile::m_file
private

Definition at line 38 of file ScopedFileHelper.h.

Referenced by doCreateFile(), operator=(), and ~ScopedFile().

◆ m_filename

std::string ScopedFileHelper::ScopedFile::m_filename
mutableprivate

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