/ghost/csvparser.h

http://ghostcb.googlecode.com/ · C Header · 53 lines · 18 code · 4 blank · 31 comment · 0 complexity · 54c7ee490fd5d3bb3d9719dc22f2eec4 MD5 · raw file

  1. #ifndef __CSVPARSE_H_2001_06_07__
  2. #define __CSVPARSE_H_2001_06_07__
  3. /*
  4. Copyright (c) 2001, Mayukh Bose
  5. All rights reserved.
  6. Redistribution and use in source and binary forms, with or without
  7. modification, are permitted provided that the following conditions are
  8. met:
  9. * Redistributions of source code must retain the above copyright notice,
  10. this list of conditions and the following disclaimer.
  11. * Redistributions in binary form must reproduce the above copyright
  12. notice, this list of conditions and the following disclaimer in the
  13. documentation and/or other materials provided with the distribution.
  14. * Neither the name of Mayukh Bose nor the names of other
  15. contributors may be used to endorse or promote products derived from
  16. this software without specific prior written permission.
  17. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  18. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  19. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  20. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  21. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  22. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  23. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  24. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  25. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  27. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. */
  29. #include <string>
  30. using namespace std;
  31. class CSVParser {
  32. private:
  33. string m_sData;
  34. string::size_type m_nPos;
  35. void SkipSpaces(void);
  36. public:
  37. CSVParser();
  38. const CSVParser & operator << (const string &sIn);
  39. const CSVParser & operator << (const char *sIn);
  40. CSVParser & operator >> (int &nOut);
  41. CSVParser & operator >> (double &nOut);
  42. CSVParser & operator >> (string &sOut);
  43. };
  44. #endif