00001 #ifndef __CSVPARSE_H_2001_06_07__ 00002 #define __CSVPARSE_H_2001_06_07__ 00003 00004 #include <string> 00005 #include "../PartB/yieldCurve.h" 00006 #include "../PartF/creditCurve.h" 00007 using namespace std; 00008 00009 /* 00010 Copyright (c) 2001, Mayukh Bose 00011 All rights reserved. 00012 00013 Redistribution and use in source and binary forms, with or without 00014 modification, are permitted provided that the following conditions are 00015 met: 00016 00017 * Redistributions of source code must retain the above copyright notice, 00018 this list of conditions and the following disclaimer. 00019 00020 * Redistributions in binary form must reproduce the above copyright 00021 notice, this list of conditions and the following disclaimer in the 00022 documentation and/or other materials provided with the distribution. 00023 00024 * Neither the name of Mayukh Bose nor the names of other 00025 contributors may be used to endorse or promote products derived from 00026 this software without specific prior written permission. 00027 00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00029 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00030 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00031 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00032 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00033 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00034 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00035 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00036 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00037 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00038 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00039 */ 00040 00041 /* alokem - added some methods for parsing terreneuve types */ 00042 00043 class CSVParser { 00044 private: 00045 string m_sData; 00046 string::size_type m_nPos; 00047 void SkipSpaces(void); 00048 public: 00049 CSVParser(); 00050 const CSVParser & operator << (const string &sIn); 00051 const CSVParser & operator << (const char *sIn); 00052 CSVParser & operator >> (int &nOut); 00053 CSVParser & operator >> (Natural &nOut); 00054 CSVParser & operator >> (double &nOut); 00055 CSVParser & operator >> (string &sOut); 00056 CSVParser & operator >> (TypeOfRate &tOut); 00057 CSVParser & operator >> (CreditSpreadType &tOut); 00058 CSVParser & operator >> (Date &dOut); 00059 }; 00060 00061 #endif