aboutsummaryrefslogtreecommitdiff
path: root/dep/CascLib/src/common/Csv.h
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2021-06-27 20:20:51 +0200
committerShauren <shauren.trinity@gmail.com>2021-06-27 20:20:51 +0200
commitb70f34b696c75dee9af1387d2e1536cd9edffa4b (patch)
treec53d89e5c84264d183cea463f6a214f5c0963911 /dep/CascLib/src/common/Csv.h
parent0bbf3f7300895008a37796f3d5be7e8f23c9a143 (diff)
Dep/CascLib: Update to ladislav-zezula/CascLib@37a948bdb5f493b6a0959489baa07e1636002c3b
Diffstat (limited to 'dep/CascLib/src/common/Csv.h')
-rw-r--r--dep/CascLib/src/common/Csv.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/dep/CascLib/src/common/Csv.h b/dep/CascLib/src/common/Csv.h
index 2fcee847703..8df99c63456 100644
--- a/dep/CascLib/src/common/Csv.h
+++ b/dep/CascLib/src/common/Csv.h
@@ -20,6 +20,13 @@
#define CSV_HASH_TABLE_SIZE 0x80
//-----------------------------------------------------------------------------
+// Interface for finding of next text element (line, column)
+
+// The function must find the next (line|column), put zero there and return begin
+// of the next (line|column). In case there is no next (line|column), the function returns NULL
+typedef char * (*CASC_CSV_NEXTPROC)(void * pvUserData, char * szLine);
+
+//-----------------------------------------------------------------------------
// Class for CSV line
class CASC_CSV;
@@ -69,6 +76,12 @@ class CASC_CSV
CASC_CSV(size_t nLinesMax, bool bHasHeader);
~CASC_CSV();
+ DWORD SetNextLineProc(CASC_CSV_NEXTPROC PfnNextLineProc, CASC_CSV_NEXTPROC PfnNextColProc = NULL, void * pvUserData = NULL);
+ CASC_CSV_NEXTPROC GetNextColumnProc()
+ {
+ return PfnNextColumn;
+ }
+
DWORD Load(LPBYTE pbData, size_t cbData);
DWORD Load(LPCTSTR szFileName);
bool LoadNextLine();
@@ -79,6 +92,11 @@ class CASC_CSV
size_t GetHeaderColumns() const;
size_t GetColumnIndex(const char * szColumnName) const;
+ void * GetUserData() const
+ {
+ return m_pvUserData;
+ }
+
size_t GetLineCount() const
{
return m_nLines;
@@ -90,9 +108,13 @@ class CASC_CSV
bool LoadNextLine(CASC_CSV_LINE & Line);
bool ParseCsvData();
+ CASC_CSV_NEXTPROC PfnNextLine;
+ CASC_CSV_NEXTPROC PfnNextColumn;
+
CASC_CSV_LINE * m_pLines;
CASC_CSV_LINE Header;
BYTE HashTable[CSV_HASH_TABLE_SIZE];
+ void * m_pvUserData;
char * m_szCsvFile;
char * m_szCsvPtr;
size_t m_nCsvFile;