#ifndef __CSVTOKEN_H__
#define __CSVTOKEN_H__

/*
 * CSV tokenizer
 */

#include <cwchar> // wchar_t

/*
 * SBCS(ASCII)
 */
class scsv_tokenizer {
public:
  typedef char             char_type;
  typedef char_type*       pointer;
  typedef const char_type* const_pointer;

  explicit scsv_tokenizer(const_pointer src);
  pointer next();
  bool empty() const;
private:
  const_pointer src_;
  const_pointer cur_;
  const_pointer max_;
  const_pointer next_comma(const_pointer ind);
};

/*
 * MBCS(Shift_JIS)
 */
class mcsv_tokenizer {
public:
  typedef unsigned char    char_type;
  typedef char_type*       pointer;
  typedef const char_type* const_pointer;

  explicit mcsv_tokenizer(const_pointer src);
  pointer next();
  bool empty() const;
private:
  const_pointer src_;
  const_pointer cur_;
  const_pointer max_;
  const_pointer next_comma(const_pointer ind);
};

/*
 * DBCS(Unicode)
 */
class wcsv_tokenizer {
public:
  typedef wchar_t          char_type;
  typedef char_type*       pointer;
  typedef const char_type* const_pointer;

  explicit wcsv_tokenizer(const_pointer src);
  pointer next();
  bool empty() const;
private:
  const_pointer src_;
  const_pointer cur_;
  const_pointer max_;
  const_pointer next_comma(const wchar_t* ind);
};

#endif

