00001 #ifndef SDXCSVSTREAMREADER_H
00002 #define SDXCSVSTREAMREADER_H
00003
00004
00005 #include <string>
00006 #include <vector>
00007
00008 #include "SDXStreamReader.h"
00009
00010 namespace SDX {
00011 namespace Formats {
00036 class CsvStreamReader : public SDX::Helpers::StreamReader {
00037 public:
00041 CsvStreamReader(std::istream* iStream = 0, SDX::ContentHandler* contentHandler = 0);
00042
00046 void setFieldNames(std::vector<std::string> fieldNames);
00047
00051 void setRowName(std::string rowName);
00052 private:
00053 void startProcessing();
00054 bool processLine(std::string& line);
00055
00056 size_t findNextQuote(std::string& line);
00057 void setError(std::string message);
00058
00059 std::vector<std::string> m_fieldNames;
00060 std::string m_rowName;
00061 bool m_fieldNamesSet;
00062
00063 std::istream* m_iStream;
00064 };
00065 }
00066 }
00067
00068 #endif
00069
00070