📄 transactionfile.h
字号:
#if !defined(TransactionFile_H)
#define TransactionFile_H
#include <string>
using namespace std;
#include "Lock.h"
#include "SysEvent.h"
////////////////////////////////////////////////////////////////////////////////
// TransactionFile
//
// Purpose: text file class
//##ModelId=424BB63F023A
class TransactionFile :
public Lock,
public SysEvent
{
//##ModelId=424BB63F024B
long m_readOffset; // current read offset
//##ModelId=424BB63F0259
long m_writeOffset; // current write offset
//##ModelId=424BB63F025A
DWORD m_readWait; // time (ms) to wait after read
//##ModelId=424BB63F0269
DWORD m_writeWait; // time (ms) to wait after write
//##ModelId=424BB63F0278
DWORD m_openFlags; // flags used to open file
//##ModelId=424BB63F027A
string m_name; // name of file
public:
//##ModelId=424BB63F0288
HANDLE m_hFile;
//##ModelId=424BB63F0289
TransactionFile ();
//##ModelId=424BB63F0298
~TransactionFile ();
// show error
//##ModelId=424BB63F0299
void showLastError ();
//##ModelId=424BB63F029A
bool invalidFile ();
// open methods
//##ModelId=424BB63F029B
bool create ( string & fileName );
//##ModelId=424BB63F02A8
bool open ( string & fileName );
//##ModelId=424BB63F02AA
bool openAlways ( string & fileName );
//##ModelId=424BB63F02B8
bool open ( string & fileName, DWORD openFlags );
//##ModelId=424BB63F02C6
void close ();
// file info/position methods
//##ModelId=424BB63F02C7
bool setPosition ( DWORD position, bool read = true );
//##ModelId=424BB63F02D6
long size ();
//##ModelId=424BB63F02D7
bool offsetPosition ( DWORD offset, bool read = true );
// clear the file
//##ModelId=424BB63F02E6
void clear ();
// read/write methods
//##ModelId=424BB63F02E7
bool write ( LPTSTR pBuffer, DWORD noToWrite, bool wait = true );
//##ModelId=424BB63F02F6
bool read ( LPTSTR pBuffer, DWORD noToRead, bool wait = true );
//##ModelId=424BB63F0306
void operator << ( string & buffer )
{
write( (LPTSTR) buffer.c_str(), buffer.size() );
}
//##ModelId=424BB63F0308
operator HANDLE ()
{
return m_hFile;
}
//##ModelId=424BB63F0309
void setReadWait ( DWORD wait )
{ m_readWait = wait; }
//##ModelId=424BB63F0316
void setWriteWait ( DWORD wait )
{ m_writeWait = wait; }
};
void operator << ( stringstream & strm, TransactionFile & file );
void operator << ( TransactionFile & file, stringstream & strm );
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -