Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
CStdioFileEx Class Reference

CStdioFileEx reads or write unicode or ansi / utf8 string and convert them to CXString using string conversion if needed. More...

Detailed Description

CStdioFileEx reads or write unicode or ansi / utf8 string and convert them to CXString using string conversion if needed.

#include <StdioFileEx.h>

Inheritance diagram for CStdioFileEx:
CXStdioFile CXFile

Public Types

enum  OpenFlags { modeWriteUnicode = specificFlags }
 Additional flags to CXFile::OpenFlags. More...
 
- Public Types inherited from CXFile
enum  OpenFlags {
  modeRead = 0x00000 , modeWrite = 0x00001 , modeReadWrite = 0x00002 , readFlags = modeRead|modeWrite|modeReadWrite ,
  shareExclusive = 0x00010 , shareDenyWrite = 0x00020 , shareDenyRead = 0x00030 , shareDenyNone = 0x00040 ,
  shareFlags = shareExclusive| shareDenyWrite|shareDenyRead|shareDenyNone , typeUnicode = 0x00400 , typeUtf8 = 0x00800 , modeCreate = 0x01000 ,
  modeNoTruncate = 0x02000 , typeText = 0x04000 , typeBinary = 0x08000 , noException = 0x100000 ,
  specificFlags = 0x10000000
}
 Specify the open mode for file. More...
 
enum  SeekPosition { begin = 0x00 , current = 0x01 , end = 0x02 }
 
typedef enum CXFile::SeekPosition SeekPosition
 

Public Member Functions

 CStdioFileEx (bool allowException=true)
 
 CStdioFileEx (LPCTSTR lpszFileName, unsigned int nOpenFlags)
 
virtual int FScanfS (const LPCTSTR format,...)
 
virtual bool Open (LPCTSTR lpszFileName, unsigned int nOpenFlags, CXFileException *pError=NULL)
 nOpenFlags is a combination of CXFile::OpenFlags
 
virtual bool ReadString (CXString &rString)
 Read a CXString whatever if the file is encoded in unicode or utf8.
 
virtual fileuint Seek (longint lOff, CXFile::SeekPosition nFrom)
 
virtual void WriteString (LPCTSTR lpsz)
 Write a CXString. The string is converted accordingly is the file is opened using modeWriteUnicode.
 
bool IsFileUnicodeText () const
 
bool IsFileUTF8 () const
 
fileuint GetCharCount ()
 
void SkipLines (unsigned int lines, unsigned int nFrom)
 
void SetCodePage (xStringEncoding codPage)
 A code page could be provided on Windows.
 
- Public Member Functions inherited from CXStdioFile
 CXStdioFile (bool allowException=true)
 
 CXStdioFile (FILE *pOpenStream, bool allowException=true)
 
 CXStdioFile (LPCTSTR lpszFileName, unsigned int nOpenFlags)
 nOpenFlags is a combination of CXFile::OpenFlags
 
virtual LPTSTR ReadString (LPTSTR lpsz, unsigned int nMax)
 
virtual fileuint GetPosition () const
 
virtual fileuint GetLength () const
 
virtual unsigned int Read (void *buffer, unsigned int maxByteToRead)
 
virtual void Write (const void *buffer, unsigned int byteToWrite)
 
virtual void Abort ()
 
virtual void Flush ()
 
virtual void Close ()
 
FILEGetStream ()
 
- Public Member Functions inherited from CXFile
 CXFile (bool allowException=true)
 
 CXFile (xFileHandle hFile, bool allowException=true)
 
 CXFile (LPCTSTR lpszFileName, unsigned int openFlags)
 
 CXFile (CFile *pfile, bool allowException=true)
 allowException = false then no exception is send by the class which return false instead
 
virtual CXString GetFileName () const
 
virtual CXString GetFilePath () const
 
virtual void SetFilePath (LPCTSTR lpszNewName)
 
fileuint SeekToEnd ()
 
void SeekToBegin ()
 
virtual bool SetLength (fileuint newlength)
 

Static Public Member Functions

static xStringEncoding GetFileEncoding (const CXString &sFilePath, bool &asBoom)
 Returns the file encoding and check if there is a boom marker.
 

Member Enumeration Documentation

◆ OpenFlags

Additional flags to CXFile::OpenFlags.

Enumerator
modeWriteUnicode 

equivalent to CXFile::typeUnicode

Member Function Documentation

◆ FScanfS()

virtual int CStdioFileEx::FScanfS ( const LPCTSTR  format,
  ... 
)
virtual

It implements a secured version of fscanf on OS that support it: FcanS(_T("%s", SCANS_TEXT_PARAM(buf, _countof(buf)), SCANS_LAST_PARAM);

  • uses SCANS_TEXT_PARAM for each s param
  • terminates the list by NULL (SCANS_LAST_PARAM)
  • the function returned the number of argument scanned

◆ Open()

virtual bool CStdioFileEx::Open ( LPCTSTR  lpszFileName,
unsigned int  nOpenFlags,
CXFileException *  pError = NULL 
)
virtual

nOpenFlags is a combination of CXFile::OpenFlags

Reimplemented from CXStdioFile.

◆ ReadString()

virtual bool CStdioFileEx::ReadString ( CXString rString)
virtual

Read a CXString whatever if the file is encoded in unicode or utf8.

Reimplemented from CXStdioFile.

◆ Seek()

virtual fileuint CStdioFileEx::Seek ( longint  lOff,
CXFile::SeekPosition  nFrom 
)
virtual

Reimplemented from CXStdioFile.

◆ WriteString()

virtual void CStdioFileEx::WriteString ( LPCTSTR  lpsz)
virtual

Write a CXString. The string is converted accordingly is the file is opened using modeWriteUnicode.

Reimplemented from CXStdioFile.


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