#ifndef CFGFILEPARSER_H
#define CFGFILEPARSER_H

#include "AbstractParser.h"
#include "CFGDictionary.h"
#include "SDCardManager.h"
#include "definition.h"
#include "CFGParameterValue.h"

class CFGFileParser : public AbstractParser
{
public:
    CFGFileParser(SDCardManager &sdCardManager, const char *file);
    virtual void *parseFile();
    virtual boolean save(void *data);
protected:
private:
    //This part handles the _buff realloc
    enum State {INIT, COMMENT_SECTION, LINE_BREAK, PARAM_SECTION, ERROR, OPENING_QUOTE, SEPARATION, DONE};
    enum Type {PARAMETER, VALUE};
    State _state;
    Type _type;
    boolean _quotedParameter;
    boolean _quotedValue;
    SDCardManager &_sdCardManager;
};


#endif //CFGFILEPARSER_H
