#include "IMFHeader.h"
#include "Exception.h"
#include "Log.h"
#include <unistd.h>

namespace coreutils {

   IMFHeader::IMFHeader(int fd) {}

   virtual int parse() {
      switch(state) {
       case NAME:
	 name << buffer.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-0123456789");
	 if(buffer.ifNext(":"))
	  state = FIELD;
	 else
	   return 2;
       case FIELD:
	 field << buffer.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-;'\"0123456789");
	 if(!buffer.ifNext("\r\n"))
	   if(buffer.eod())
	     return 2;
	 // Right here is where we should check if next line is an extension to the previous line.
	 
      
	 
      }
      
      
   }

}