Commit 7840eff8 authored by Pascal Noisette's avatar Pascal Noisette
Browse files

codage

parent 0991dd10
#include "ParserDefinitionDecoder"
using namespace std;
int ParserDefinitionDecoder::definitions_number(){
return definitions.size();
}
void ParserDefinitionDecoder::store_definition(Line &line, ifstream &file){
//read header of one definition
string &tokens = line.read_token();
Definition d = Definition(token[2]);
Definitions[tokens[3]] = d;
//read list of parameters
while (line.store(f))
{
if(line == "%EndEventDef")
break;
tokens = line.read_token();
if (tokens.length()!=3)
//warning();
;
d.store(token[1],token[2]);
}
}
Definition& ParserDefinitionDecoder::get_definition(int i){
return Definitions[i];
}
#ifndef DEFINITION_HPP
#define DEFINITION_HPP
#include <vector>
#define INTEGER 0
#define COLOR 1
#define STRING 2
#define DATE 3
class Definition
{
struct champs {
std::string name;
int type;
};
std::vector<champs> compulsory;
std::vector<champs> notcompulsory;
std::string Eventname;
private:
/*!
* \brief : convert to store the code instead of a string
* \param : string
*/
int typetoint(std::string);
public:
/*!
* \brief : add a field
* \param : name
* \param : value
*/
store(std::string name,std::string value);
void print()
}
#endif // DEFINITION_HPP
......@@ -2,7 +2,7 @@
#define LINE_HPP
#include <string>
#include <vector>
/*! \class Line Line.hpp "../parser/src/Line.hpp"
* Contains the definition of a line.
......@@ -11,8 +11,8 @@
class Line{
private:
std::string _content;
std::vector<std::string> token;
public:
/*!
* \brief Constructor
......@@ -35,7 +35,24 @@ public:
* \param : the string we want to know if the line starts with it
* \return : true if ths line starts with the param, false else
*/
bool Starts_with(std::string &);
bool starts_with(std::string &);
/*!
* \brief store() read the next line and divide into tokens
*
*/
bool store(std::ifstream &);
/*!
* \brief next token if exist
*
*/
std::string operator[] ();
bool operator== (std::string &);
int length();
};
#endif // LINE_HPP
......@@ -16,9 +16,10 @@ private:
Map<int,Definition> Definitions;/*! \brief Hash table to retrive easily event in Parser Event*/
public:
int definitions_number();
void store_definition(Ligne &, ifstream &);
Definition get_definition(int i);
operator[](int i);
Definition& get_definition(int i);
//operator[](int i);
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment