FRX SDK Documentation 2025 SP0
Loading...
Searching...
No Matches
addMFCClass.h
Go to the documentation of this file.
1#pragma once
2
3//
4// (C) Copyright 2005-2024 by Graebert GmbH.
5//
6// Permission to use, copy, modify, and distribute this software in
7// object code form for any purpose and without fee is hereby granted,
8// provided that the above copyright notice appears in all copies and
9// that both that copyright notice and the limited warranty and
10// restricted rights notice below appear in all supporting
11// documentation.
12//
13// GRAEBERT PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
14// GRAEBERT SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
15// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. GRAEBERT GMBH
16// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
17// UNINTERRUPTED OR ERROR FREE.
18
20
22{
23public:
26 bool attachBuffer(void *, unsigned );
28 bool hasBuffer() const;
29 unsigned byteCount() const;
30 void * pointer() const;
31 void * requestBytes(unsigned );
32 unsigned takeBytes(unsigned );
33 bool reset();
34private:
35 void * mpBuf;
36 unsigned mnBufSz;
37 unsigned mBytesCount;
38 unsigned mByteReq;
39};
40
42{
43public:
44 enum
45 {
46 kUnknown = 0,
52 kUtf32BE
53 };
54 AdCharFormatter(unsigned, bool, bool);
57 static unsigned lookupBOM(unsigned);
58 static int getBOM(unsigned& , unsigned);
59 bool getUseCIF() const;
60 bool getExpandLF() const;
61 unsigned getFormat() const;
62 bool setUseCIF(bool);
63 bool setExpandLF(bool);
64 unsigned setFormat(unsigned);
65 static unsigned wcsLength(const wchar_t *);
66 static unsigned wcharToAnsiOrUtf8(wchar_t wch, char *pDestBuf, unsigned nDestBufSize, bool bToAnsi, bool bUseCIF, bool bExpandLF);
67 static unsigned wcharToUtf16(wchar_t wch, char * pDestBuf, unsigned nDestBufSize, bool bLittleEndian, bool bExpandLF);
68 unsigned wcharToBytes(wchar_t wch, char *pDestBuf, unsigned nDestBufSize) const;
69
70private:
71 unsigned mFormat;
72 bool mUseCIF;
73 bool mExpandLF;
74};
75
76class AcFILEImpl;
78{
79public:
83 bool isOpen() const;
84 int fprintf(ACHAR*, ... );
85 FILE * fopen( ACHAR const *, ACHAR const * );
86 ACHAR* fgets( ACHAR *, int );
87 int fclose( );
88 int fgetc();
89
90 unsigned getCharFormat() const;
91 unsigned setCharFormat(unsigned);
92 bool getUseCIF() const;
93 bool setUseCIF(bool);
94 bool getExpandLF() const;
95 bool setExpandLF(bool);
96 bool readBOM();
97 bool writeBOM();
98 int fputc(wchar_t c);
99 int fputs(const wchar_t *);
100 void attach(FILE *);
102 int fprintf(const wchar_t *, ...);
103 int vfprintf(const wchar_t *, va_list);
104 int fscanf(const wchar_t *, ...);
105 FILE * fsopen( const wchar_t *, const wchar_t *, int);
106 FILE * pFILE() const;
107 int ungetc( wchar_t );
108
109private:
110 FILE * m_pFptr;
111 AdCharFormatter mCharFormtr;
112 AcFILEImpl* m_pImpl;
113};
114
115class AcCFile : public CFile
116{
117public:
121 virtual ~AcCFile();
122
123 virtual UINT Read(void *lpBuf, UINT nCount);
124 virtual void Write(const void *lpBuf, UINT nCount);
125
126 virtual UINT Read(LPTSTR lpBuf, UINT nCount);
127 virtual void Write(LPCTSTR pString, UINT nCount);
128 virtual void Write(LPCTSTR pString);
129
130 unsigned getCharFormat() const;
131 unsigned setCharFormat(unsigned nFmt);
132 bool getUseCIF() const;
133 bool setUseCIF(bool bUseCIF);
134 bool getExpandLF() const;
136 bool readBOM();
137 bool writeBOM();
138
139 bool attachBuffer(void *pBufer, unsigned);
142 bool hasBuffer() const;
143
144private:
145 AdCharFormatter mCharFormtr;
146 AcOutputBufMgr mOutBufMgr;
147};
148
149class ARX_API AcCStdioFile : public CStdioFile
150{
151public:
155 virtual ~AcCStdioFile();
157 virtual void Flush();
158 virtual void Close();
159
160 virtual void WriteString(LPCTSTR);
164 unsigned getCharFormat()const;
165 unsigned setCharFormat(unsigned );
166 bool getUseCIF() const;
167 bool setUseCIF(bool );
168 bool getExpandLF() const;
169 bool setExpandLF(bool );
170 bool readBOM();
171 bool writeBOM();
172 bool attachBuffer(void *pBufer, unsigned);
175 bool hasBuffer() const;
176
177private:
178 AdCharFormatter mCharFormtr;
179 AcOutputBufMgr mOutBufMgr;
180 FileIOFormatter_Impl* m_pfilefrmtr;
181};
AcCFile(HANDLE hFile)
virtual void Write(LPCTSTR pString, UINT nCount)
unsigned setCharFormat(unsigned nFmt)
virtual UINT Read(LPTSTR lpBuf, UINT nCount)
bool hasBuffer() const
bool setExpandLF(bool bExpandLF)
bool getExpandLF() const
virtual ~AcCFile()
virtual void Write(const void *lpBuf, UINT nCount)
unsigned getCharFormat() const
virtual UINT Read(void *lpBuf, UINT nCount)
bool detachBuffer()
bool attachBuffer(void *pBufer, unsigned)
bool setUseCIF(bool bUseCIF)
AcCFile(LPCTSTR lpszFileName, UINT nOpenFlags)
bool writeBOM()
virtual void Write(LPCTSTR pString)
bool readBOM()
bool flushBytes()
bool getUseCIF() const
virtual BOOL Open(LPCTSTR, UINT, CFileException *=NULL)
virtual BOOL ReadString(CString &)
bool readBOM()
virtual ~AcCStdioFile()
AcCStdioFile(LPCTSTR, UINT)
bool hasBuffer() const
bool getExpandLF() const
bool setUseCIF(bool)
virtual LPTSTR ReadString(LPTSTR, UINT)
virtual void Close()
bool setExpandLF(bool)
ULONGLONG Seek(LONGLONG param_1, UINT param_2) override
bool writeBOM()
virtual void WriteString(LPCTSTR)
bool flushBytes()
bool attachBuffer(void *pBufer, unsigned)
bool getUseCIF() const
virtual void Flush()
unsigned getCharFormat() const
bool detachBuffer()
AcCStdioFile(FILE *)
unsigned setCharFormat(unsigned)
int fputc(wchar_t c)
bool writeBOM()
ACHAR * fgets(ACHAR *, int)
bool getExpandLF() const
int fprintf(const wchar_t *,...)
AcFILE(FILE *)
bool getUseCIF() const
bool isOpen() const
FILE * fsopen(const wchar_t *, const wchar_t *, int)
int vfprintf(const wchar_t *, va_list)
FILE * fopen(ACHAR const *, ACHAR const *)
FILE * pFILE() const
FILE * detach()
void attach(FILE *)
int fscanf(const wchar_t *,...)
unsigned getCharFormat() const
int fclose()
bool setUseCIF(bool)
bool setExpandLF(bool)
bool readBOM()
unsigned setCharFormat(unsigned)
int fgetc()
int fputs(const wchar_t *)
int ungetc(wchar_t)
int fprintf(ACHAR *,...)
unsigned takeBytes(unsigned)
bool hasBuffer() const
void * requestBytes(unsigned)
void * pointer() const
unsigned byteCount() const
bool detachBuffer()
bool attachBuffer(void *, unsigned)
bool setExpandLF(bool)
bool getExpandLF() const
bool setUseCIF(bool)
AdCharFormatter & operator=(const AdCharFormatter &)
static unsigned wcharToUtf16(wchar_t wch, char *pDestBuf, unsigned nDestBufSize, bool bLittleEndian, bool bExpandLF)
unsigned wcharToBytes(wchar_t wch, char *pDestBuf, unsigned nDestBufSize) const
unsigned setFormat(unsigned)
AdCharFormatter(unsigned, bool, bool)
unsigned getFormat() const
static unsigned wcharToAnsiOrUtf8(wchar_t wch, char *pDestBuf, unsigned nDestBufSize, bool bToAnsi, bool bUseCIF, bool bExpandLF)
static int getBOM(unsigned &, unsigned)
static unsigned wcsLength(const wchar_t *)
bool getUseCIF() const
static unsigned lookupBOM(unsigned)