Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
83 lines
1.8 KiB
C++
83 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include <winsock2.h>
|
|
#include <windows.h>
|
|
|
|
#include <vector>
|
|
#include <string>
|
|
|
|
class CDelimitedFile
|
|
{
|
|
|
|
public:
|
|
|
|
// MAX Delimiter num is 32;
|
|
CDelimitedFile(const char* pszDelimiter = "\t");
|
|
~CDelimitedFile();
|
|
|
|
enum {
|
|
MAX_LINE_LENGTH = 8192,
|
|
MAX_DELIMITER_NUM = 32
|
|
};
|
|
|
|
enum OpenFlags {
|
|
modeRead = (int) 0x00000,
|
|
modeCreate = (int) 0x01000
|
|
};
|
|
|
|
private:
|
|
|
|
FILE *m_fpFile;
|
|
DWORD m_dwColumn;
|
|
DWORD m_dwColumnCount;
|
|
CHAR m_szLine[MAX_LINE_LENGTH];
|
|
CHAR m_szBackupLine[MAX_LINE_LENGTH];
|
|
|
|
char m_szDelimiter[MAX_DELIMITER_NUM];
|
|
|
|
std::vector<std::string> m_ColumnNames;
|
|
|
|
private:
|
|
int FindColumn(const char *szField );
|
|
BOOL GotoColumn( int nColumn );
|
|
|
|
public:
|
|
BOOL Open(LPCSTR szFilename, int nHeadLine = -1, UINT nOpenFlags = modeRead );
|
|
BOOL ReadLine();
|
|
|
|
BOOL ReadData(double &dNumber);
|
|
BOOL ReadData(float &fNumber);
|
|
|
|
BOOL ReadData(unsigned long &fNumber);
|
|
|
|
BOOL ReadData(int &iNumber);
|
|
BOOL ReadData(unsigned short &iNumber);
|
|
BOOL ReadData(short &iNumber);
|
|
BOOL ReadData(unsigned char &iNumber);
|
|
BOOL ReadData(char &iNumber);
|
|
|
|
BOOL ReadData(__int64 &i64Number);
|
|
BOOL ReadData(DWORD64 &i64Number);
|
|
|
|
BOOL ReadString(char *szString, DWORD dwSize);
|
|
|
|
|
|
BOOL ReadData(const char *szField, double &dNumber);
|
|
BOOL ReadData(const char *szField, float &fNumber);
|
|
|
|
BOOL ReadData(const char *szField, unsigned long &fNumber);
|
|
|
|
BOOL ReadData(const char *szField, int &iNumber);
|
|
BOOL ReadData(const char *szField, unsigned short &iNumber);
|
|
BOOL ReadData(const char *szField, short &iNumber);
|
|
BOOL ReadData(const char *szField, unsigned char &iNumber);
|
|
BOOL ReadData(const char *szField, char &iNumber);
|
|
|
|
BOOL ReadData(const char *szField, __int64 &i64Number);
|
|
BOOL ReadData(const char *szField, DWORD64 &i64Number);
|
|
|
|
BOOL ReadString(const char *szField, char *szString, DWORD dwSize);
|
|
|
|
void Close() ;
|
|
};
|