/***************************************************************
|			PROJET SIRO
|			DAMASE Romain - POMMIER Simon
|			Copyright 2008
|			PARSER.CPP
|			November 21th 2008
|
|			Définition d'un Parser
|
/***************************************************************/

#include "Parser.h"

	/*--------------------------------------------------------
						CONSTRUCTEURS
	--------------------------------------------------------*/
	
	Parser::Parser(char _sep)
	{
		this->sep = _sep;
		this->pos = 0;
	}

	Parser::~Parser()
	{
		
	}


	/*--------------------------------------------------------
						METHODES
	--------------------------------------------------------*/

	//Donner une ligne à parser
	Parser & Parser::operator<< (string line)
	{
		this->ch = line;

		return *this;
	}


	//Rendre le résultat parsé
	Parser & Parser::operator>> (string & out)
	{
		while(ch[pos]!=sep && ch[pos] != '\n' && ch[pos] != '\0')
		{
			out+=ch[pos++];
		}
		
		if(ch[pos]==sep) pos++;	//manger le separateur

		return *this;
	}






