Commit 60a45ac1 authored by Johnny Jazeix's avatar Johnny Jazeix
Browse files

Debut de débogage.

parent a90ffaef
#include "ParserEventDecoder.hpp"
#include "ParserEventDecoder.hpp"
//#define INSTANCIATE(nom_de_champPaje,type,nom_variable,nom_variable_is_initialized) if (fields[i-1].name == nom_de_champPaje) { \
// if(!String::instanciate(current_value, nom_variable)) { \
......@@ -74,55 +74,37 @@ void ParserEventDecoder::store_event(const Definition &definition,Line &line, Tr
}
else if (fields[i-1]._name == "Alias") {
if(alias = current_value) {
cout << "warning : incompatible value" << endl;
return;
}
alias = current_value;
alias_is_initialized = true;
}
else if (fields[i-1]._name == "Name") {
if(name = current_value) {
cout << "warning : incompatible value" << endl;
return;
}
name = current_value;
name_is_initialized = true;
}
else if (fields[i-1]._name == "ContainerType") {
if(container_type = current_value) {
cout << "warning : incompatible value" << endl;
return;
}
container_type = current_value;
container_type_is_initialized = true;
}
else if (fields[i-1]._name == "SourceContainerType") {
if(source_container_type = current_value) {
cout << "warning : incompatible value" << endl;
return;
}
source_container_type = current_value;
source_container_type_is_initialized = true;
}
else if (fields[i-1]._name == "DestContainerType") {
if(dest_container_type = current_value) {
cout << "warning : incompatible value" << endl;
return;
}
dest_container_type = current_value;
dest_container_type_is_initialized = true;
}
else if (fields[i-1]._name == "EntityType") {
if(entity_type = current_value) {
cout << "warning : incompatible value" << endl;
return;
}
entity_type = current_value;
entity_type_is_initialized = true;
}
else if (fields[i-1]._name == "Time") {
if(!instantiate(current_value, time_type) {
if(!instantiate(current_value, time_type)) {
cout << "warning : incompatible value" << endl;
return;
}
......@@ -130,34 +112,25 @@ void ParserEventDecoder::store_event(const Definition &definition,Line &line, Tr
}
else if (fields[i-1]._name == "Type") {
if(type = current_value) {
cout << "warning : incompatible value" << endl;
return;
}
type = current_value;
type_is_initialized = true;
}
else if (fields[i-1]._name == "Container") {
if(container = current_value) {
cout << "warning : incompatible value" << endl;
return;
}
container = current_value;
container_is_initialized = true;
}
else if (fields[i-1]._name == "Value") {
if(fields[i-1]._type == "double") {
if(!instantiate(current_value, value_double) {
if(!instantiate(current_value, value_double)) {
cout << "warning : incompatible value" << endl;
return;
}
value_double_is_initialized = true;
}
else {
if(value_string = current_value) {
cout << "warning : incompatible value" << endl;
return;
}
value_string = current_value;
value_string_is_initialized = true;
}
}
......@@ -171,33 +144,24 @@ void ParserEventDecoder::store_event(const Definition &definition,Line &line, Tr
}
else if (fields[i-1]._name == "DestContainer") {
if(dest_container = current_value) {
cout << "warning : incompatible value" << endl;
return;
}
dest_container = current_value;
dest_container_is_initialized = true;
}
else if (fields[i-1]._name == "Key") {
if(key = current_value) {
cout << "warning : incompatible value" << endl;
return;
}
key = current_value;
key_is_initialized = true;
}
else {
if(fields[i-1]._type == "string") {
String value;
if(value = current_value) {
cout << "warning : incompatible value" << endl;
return;
}
value = current_value;
extra_fields.push_back(value)
}
else if(fields[i-1]._type == "double") {
Double value;
if(!instantiate(current_value, value) {
if(!instantiate(current_value, value)) {
cout << "warning : incompatible value" << endl;
return;
}
......@@ -205,23 +169,23 @@ void ParserEventDecoder::store_event(const Definition &definition,Line &line, Tr
}
else if(fields[i-1]._type == "hex") {
Hex value;
if(!instantiate(current_value, value) {
if(!instantiate(current_value, value)) {
cout << "warning : incompatible value" << endl;
return;
}
extra_fields.push_back(value)
extra_fields.push_back(value);
}
else if(fields[i-1]._type == "date") {
Date value;
if(!instantiate(current_value, value) {
if(!instantiate(current_value, value)) {
cout << "warning : incompatible value" << endl;
return;
}
extra_fields.push_back(value)
extra_fields.push_back(value);
}
else if(fields[i-1]._type == "integer") {
Integer value;
if(!instantiate(current_value, value) {
if(!instantiate(current_value, value)) {
cout << "warning : incompatible value" << endl;
return;
}
......@@ -229,11 +193,11 @@ void ParserEventDecoder::store_event(const Definition &definition,Line &line, Tr
}
else if(fields[i-1]._type == "color") {
Color value;
if(!instantiate(current_value, value) {
if(!instantiate(current_value, value)) {
cout << "warning : incompatible value" << endl;
return;
}
extra_fields.push_back(value)
extra_fields.push_back(value);
}
else {
cout << "warning : unknown type" << endl;
......@@ -248,7 +212,7 @@ void ParserEventDecoder::store_event(const Definition &definition,Line &line, Tr
cout << "warning : extra value(s)" << endl;
}
\\A faire : remplir un "Name alias_name" avec alias et name
//A faire : remplir un "Name alias_name" avec alias et name
string event_name = definition.get_event_name();
......@@ -312,7 +276,7 @@ void ParserEventDecoder::store_event(const Definition &definition,Line &line, Tr
}
}
\\A faire : encore des type d'evenement a definir + chercher les parents et types des parents quand il le faut
//A faire : encore des type d'evenement a definir + chercher les parents et types des parents quand il le faut
else {
cout << "warning : unknown evenement" << endl;
......
......@@ -8,6 +8,11 @@ String::String(std::string value){
_value = value;
}
bool String::instantiate(const std::string &value, String &out){
out = String(value);
return true;
}
std::string String::to_string() const{
return _value;
}
......
......@@ -32,6 +32,18 @@ public:
* \brief Constructor
*/
String(std::string);
/*!
*
* \fn instantiate
* \brief Convert a string to a String
* \param in string to convert
* \param out String to be initialized
* \return true for coherence with the other values
*
*/
static bool instantiate(const std::string &in, String &out);
/*!
* \fn to_string
......
Markdown is supported
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