|  | @@ -260,6 +260,15 @@ char* get_index(JsonParser* this, int index){
 | 
	
		
			
				|  |  |      return val;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +int get_pos(JsonParser* this, char* key){
 | 
	
		
			
				|  |  | +    //Recup index
 | 
	
		
			
				|  |  | +    int index;
 | 
	
		
			
				|  |  | +    if((index = search_index(this, key)) == JSON_ERROR){
 | 
	
		
			
				|  |  | +        return JSON_ERROR;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    return index;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  int get_type(JsonParser* this, char* key){
 | 
	
		
			
				|  |  |      //Recup index
 | 
	
		
			
				|  |  |      int index;
 | 
	
	
		
			
				|  | @@ -269,15 +278,113 @@ int get_type(JsonParser* this, char* key){
 | 
	
		
			
				|  |  |      return this->type[index];
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -char* get(JsonParser* this, char* key){
 | 
	
		
			
				|  |  | +char* get_value(JsonParser* this, char* key){
 | 
	
		
			
				|  |  | +    //Recup index
 | 
	
		
			
				|  |  | +    int index;
 | 
	
		
			
				|  |  | +    if((index = search_index(this, key)) == JSON_ERROR){
 | 
	
		
			
				|  |  | +        return NULL;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    return get_index(this, index);
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +double get_number(JsonParser* this, char* key){
 | 
	
		
			
				|  |  | +    //Recup index
 | 
	
		
			
				|  |  | +    int index;
 | 
	
		
			
				|  |  | +    if((index = search_index(this, key)) == JSON_ERROR){
 | 
	
		
			
				|  |  | +        return JSON_ERROR;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    //Verif type
 | 
	
		
			
				|  |  | +    if(this->type[index] != JSON_NUMBER){
 | 
	
		
			
				|  |  | +        return JSON_ERROR;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    //Recup valeur
 | 
	
		
			
				|  |  | +    char* val;
 | 
	
		
			
				|  |  | +    val = get_index(this, index);
 | 
	
		
			
				|  |  | +    //Cast et retoure
 | 
	
		
			
				|  |  | +    double res;
 | 
	
		
			
				|  |  | +    res = atof(val);
 | 
	
		
			
				|  |  | +    free(val);
 | 
	
		
			
				|  |  | +    return res;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +int get_integer(JsonParser* this, char* key){
 | 
	
		
			
				|  |  | +    //Recup index
 | 
	
		
			
				|  |  | +    int index;
 | 
	
		
			
				|  |  | +    if((index = search_index(this, key)) == JSON_ERROR){
 | 
	
		
			
				|  |  | +        return JSON_ERROR;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    //Verif type
 | 
	
		
			
				|  |  | +    if(this->type[index] != JSON_NUMBER){
 | 
	
		
			
				|  |  | +        return JSON_ERROR;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    //Recup valeur
 | 
	
		
			
				|  |  | +    char* val;
 | 
	
		
			
				|  |  | +    val = get_index(this, index);
 | 
	
		
			
				|  |  | +    //Cast et retoure
 | 
	
		
			
				|  |  | +    int res;
 | 
	
		
			
				|  |  | +    res = atoi(val);
 | 
	
		
			
				|  |  | +    free(val);
 | 
	
		
			
				|  |  | +    return res;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +boolean get_boolean(JsonParser* this, char* key){
 | 
	
		
			
				|  |  | +    //Recup index
 | 
	
		
			
				|  |  | +    int index;
 | 
	
		
			
				|  |  | +    if((index = search_index(this, key)) == JSON_ERROR){
 | 
	
		
			
				|  |  | +        return false;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    //Verif type
 | 
	
		
			
				|  |  | +    if(this->type[index] != JSON_BOOLEAN){
 | 
	
		
			
				|  |  | +        return false;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    //Recup valeur
 | 
	
		
			
				|  |  | +    char* val;
 | 
	
		
			
				|  |  | +    val = get_index(this, index);
 | 
	
		
			
				|  |  | +    //Cast et retoure
 | 
	
		
			
				|  |  | +    if(val[0] == 't'){
 | 
	
		
			
				|  |  | +        return true;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    return false;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +char* get_array(JsonParser* this, char* key){
 | 
	
		
			
				|  |  |      //Recup index
 | 
	
		
			
				|  |  |      int index;
 | 
	
		
			
				|  |  |      if((index = search_index(this, key)) == JSON_ERROR){
 | 
	
		
			
				|  |  |          return NULL;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +    //Verif type
 | 
	
		
			
				|  |  | +    if(this->type[index] != JSON_ARRAY){
 | 
	
		
			
				|  |  | +        return NULL;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    //Retour pas de gestion de tableau actuellement
 | 
	
		
			
				|  |  |      return get_index(this, index);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +JsonParser* get_object(JsonParser* this, char* key){
 | 
	
		
			
				|  |  | +    //Recup index
 | 
	
		
			
				|  |  | +    int index;
 | 
	
		
			
				|  |  | +    if((index = search_index(this, key)) == JSON_ERROR){
 | 
	
		
			
				|  |  | +        return NULL;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    //Verif type
 | 
	
		
			
				|  |  | +    if(this->type[index] != JSON_OBJECT){
 | 
	
		
			
				|  |  | +        return NULL;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    //Recup valeur
 | 
	
		
			
				|  |  | +    char* val;
 | 
	
		
			
				|  |  | +    val = get_index(this, index);
 | 
	
		
			
				|  |  | +    //Parse
 | 
	
		
			
				|  |  | +    JsonParser* json;
 | 
	
		
			
				|  |  | +    json = malloc(sizeof(JsonParser));
 | 
	
		
			
				|  |  | +    if(json_parse(json, val) == JSON_ERROR){
 | 
	
		
			
				|  |  | +        return NULL;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    //Retour JSON utilisable
 | 
	
		
			
				|  |  | +    free(val);
 | 
	
		
			
				|  |  | +    return json;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  void clean_json_parser(JsonParser* this) {
 | 
	
		
			
				|  |  |      free(this->key);
 | 
	
		
			
				|  |  |      free(this->key_length);
 |