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>
92 lines
2.0 KiB
C++
92 lines
2.0 KiB
C++
#ifndef _DELIMITED_FILE_H_
|
|
#define _DELIMITED_FILE_H_
|
|
|
|
#pragma once
|
|
|
|
#include <winsock2.h>
|
|
#include <windows.h>
|
|
#include <vector>
|
|
|
|
class CDelimitedFile
|
|
{
|
|
|
|
public:
|
|
|
|
// MAX Delimiter num is 32;
|
|
CDelimitedFile(const char* pszDelimiter = "\t");
|
|
~CDelimitedFile();
|
|
|
|
enum {
|
|
MAX_LINE_LENGTH = 8192,
|
|
MAX_DELIMITER_NUM = 32,
|
|
MAX_COLUMN_LENGHT = 64,
|
|
DEFAULT_COLUMN_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];
|
|
|
|
typedef std::vector<char*> ColumnArray;
|
|
ColumnArray 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(bool &bNumber);
|
|
|
|
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();
|
|
};
|
|
|
|
|
|
#endif |