aboutsummaryrefslogtreecommitdiff
path: root/src/csvwriter.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/csvwriter.h')
-rw-r--r--src/csvwriter.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/csvwriter.h b/src/csvwriter.h
new file mode 100644
index 0000000..82f36d7
--- /dev/null
+++ b/src/csvwriter.h
@@ -0,0 +1,36 @@
1#ifndef BU_CSV_WRITER_H
2#define BU_CSV_WRITER_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 CsvWriter
14 {
15 public:
16 typedef Bu::Signal1<Bu::FString, const Bu::FString &> EncodeSignal;
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 CsvWriter( Stream &sOut, Style eStyle=styleExcel );
24 CsvWriter( Stream &sOut, EncodeSignal sEncode );
25 virtual ~CsvWriter();
26
27 private:
28 Stream &sOut;
29 EncodeSignal sEncode;
30
31 static Bu::FString encodeExcel( const Bu::FString &sIn );
32 static Bu::FString encodeC( const Bu::FString &sIn );
33 };
34};
35
36#endif