diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2010-02-11 00:38:09 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2010-02-11 00:38:09 +0000 |
| commit | d61161061bd5998ef4b1fc2aaad2cf4bbd78e90d (patch) | |
| tree | f4ea64381d4f0b3b7a9610758c034183098c2e96 /src/csvwriter.h | |
| parent | 79b7b631750b69cbe06daedb0453306595dea6ad (diff) | |
| download | libbu++-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/csvwriter.h')
| -rw-r--r-- | src/csvwriter.h | 36 |
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 | |||
| 8 | namespace 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 | ||
