cgma
CubitFile Class Reference

#include <CubitFile.hpp>

List of all members.

Public Member Functions

 CubitFile ()
 CubitFile (const CubitString &file, const char *mode)
virtual ~CubitFile ()
bool open (const CubitString &file, const char *mode)
void close ()
FILE * file () const
 operator bool () const
int error ()

Protected Attributes

FILE * mFile
int mError

Detailed Description

Definition at line 14 of file CubitFile.hpp.


Constructor & Destructor Documentation

Definition at line 7 of file CubitFile.cpp.

  : mFile(NULL), mError(0)
{
}
CubitFile::CubitFile ( const CubitString file,
const char *  mode 
)

Definition at line 12 of file CubitFile.cpp.

  : mFile(NULL)
{
  open(file, mode);
}
CubitFile::~CubitFile ( ) [virtual]

Definition at line 18 of file CubitFile.cpp.

{
  close();
}

Member Function Documentation

void CubitFile::close ( )

Definition at line 42 of file CubitFile.cpp.

{
  if(mFile)
  {
    fclose(mFile);
  }
  mFile = NULL;
  mError = 0;
}

Definition at line 62 of file CubitFile.cpp.

{
  return this->mError;
}
FILE * CubitFile::file ( ) const

Definition at line 52 of file CubitFile.cpp.

{
  return this->mFile;
}
bool CubitFile::open ( const CubitString file,
const char *  mode 
)

Definition at line 23 of file CubitFile.cpp.

{
  close();

  this->mError = 0;

#ifdef _WIN32
  this->mFile = _wfopen(CubitString::toUtf16(file).c_str(), CubitString::toUtf16(mode).c_str());
#else
  this->mFile = fopen(file.c_str(), mode);
#endif
  if(!this->mFile)
  {
    this->mError = errno;
  }

  return mError == 0;
}
CubitFile::operator bool ( ) const

Definition at line 57 of file CubitFile.cpp.

{
  return this->mFile != NULL;
}

Member Data Documentation

int CubitFile::mError [protected]

Definition at line 45 of file CubitFile.hpp.

FILE* CubitFile::mFile [protected]

Definition at line 44 of file CubitFile.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines