aboutsummaryrefslogtreecommitdiff
path: root/src/csvreader.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-02-11 00:38:09 +0000
committerMike Buland <eichlan@xagasoft.com>2010-02-11 00:38:09 +0000
commitd61161061bd5998ef4b1fc2aaad2cf4bbd78e90d (patch)
treef4ea64381d4f0b3b7a9610758c034183098c2e96 /src/csvreader.h
parent79b7b631750b69cbe06daedb0453306595dea6ad (diff)
downloadlibbu++-d61161061bd5998ef4b1fc2aaad2cf4bbd78e90d.tar.gz
libbu++-d61161061bd5998ef4b1fc2aaad2cf4bbd78e90d.tar.bz2
libbu++-d61161061bd5998ef4b1fc2aaad2cf4bbd78e90d.tar.xz
libbu++-d61161061bd5998ef4b1fc2aaad2cf4bbd78e90d.zip
Started working on a CSV reader, it's pretty much done, the CSV writer is just
a shell, but I may finish it soon, and started work on NewLine, a filter that converts newlines in text streams between the different OS standards. Also added some more helper operators to fbasicstring.
Diffstat (limited to 'src/csvreader.h')
-rw-r--r--src/csvreader.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/csvreader.h b/src/csvreader.h
new file mode 100644
index 0000000..d89fabe
--- /dev/null
+++ b/src/csvreader.h
@@ -0,0 +1,38 @@
1#ifndef BU_CSV_READER_H
2#define BU_CSV_READER_H
3
4#include "bu/fstring.h"
5#include "bu/array.h"
6#include "bu/signals.h"
7
8namespace Bu
9{
10 class Stream;
11 typedef Bu::Array<Bu::FString> StrArray;
12
13 class CsvReader
14 {
15 public:
16 typedef Bu::Signal1<Bu::FString, Bu::FString::iterator &> DecodeSignal;
17 enum Style
18 {
19 styleExcel, ///< Excel style quotes around things that need em
20 styleC ///< Escape things that need it C-style
21 };
22
23 CsvReader( Stream &sIn, Style eStyle=styleExcel );
24 CsvReader( Stream &sIn, DecodeSignal sDecode );
25 virtual ~CsvReader();
26
27 StrArray readLine();
28
29 private:
30 Stream &sIn;
31 DecodeSignal sDecode;
32
33 static Bu::FString decodeExcel( Bu::FString::iterator &i );
34 static Bu::FString decodeC( Bu::FString::iterator &i );
35 };
36};
37
38#endif