Commit 1e653e6f241959a39cf59ef89905f6b40a78a419

Authored by Benjamin Renard
1 parent c119af21

Add subtype definition for list arguments of a templated parameter

Showing 1 changed file with 18 additions and 0 deletions   Show diff stats
src/InputOutput/IHMImpl/Tools/IHMParamTemplateClass.php
... ... @@ -18,6 +18,7 @@ class IHMParamTemplateClass
18 18 protected static $paramTemplateArgumentKeyAtt = 'key';
19 19 protected static $paramTemplateArgumentNameAtt = 'name';
20 20 protected static $paramTemplateArgumentTypeAtt = 'type';
  21 + protected static $paramTemplateArgumentSubTypeAtt = 'subtype';
21 22 protected static $paramTemplateArgumentMinKeyAtt = 'minkey';
22 23 protected static $paramTemplateArgumentMaxKeyAtt = 'maxkey';
23 24 protected static $paramTemplateArgumentNameTplAtt = 'nametpl';
... ... @@ -93,12 +94,27 @@ class IHMParamTemplateClass
93 94 case 'bool' :
94 95 $args_format .= "%d";
95 96 break;
  97 + case 'list' :
  98 + switch($arg["subtype"]) {
  99 + case 'float' :
  100 + case 'double' :
  101 + $args_format .= "%f";
  102 + break;
  103 + case 'int' :
  104 + case 'bool' :
  105 + $args_format .= "%d";
  106 + break;
  107 + default:
  108 + $args_format .= "%s";
  109 + }
  110 + break;
96 111 default:
97 112 $args_format .= "%s";
98 113 }
99 114 }
100 115  
101 116 $exploded_args = sscanf($template_args_str , $args_format);
  117 + error_log($exploded_args);
102 118  
103 119 if ($exploded_args === -1)
104 120 return FALSE;
... ... @@ -329,6 +345,7 @@ class IHMParamTemplateClass
329 345 $argumentKey = $argumentNode->getAttribute(self::$paramTemplateArgumentKeyAtt);
330 346 $argumentName = $argumentNode->getAttribute(self::$paramTemplateArgumentNameAtt);
331 347 $argumentType = $argumentNode->getAttribute(self::$paramTemplateArgumentTypeAtt);
  348 + $argumentSubType = $argumentNode->getAttribute(self::$paramTemplateArgumentSubTypeAtt);
332 349 $argumentDefault = $argumentNode->getAttribute(self::$paramTemplateArgumentDefaultAtt);
333 350 $argumentMinKey = $argumentNode->getAttribute(self::$paramTemplateArgumentMinKeyAtt);
334 351 $argumentMaxKey = $argumentNode->getAttribute(self::$paramTemplateArgumentMaxKeyAtt);
... ... @@ -340,6 +357,7 @@ class IHMParamTemplateClass
340 357 $arguments[$argumentKey] = array(
341 358 "name" => (empty($argumentName) ? $argumentKey : $argumentName),
342 359 "type" => $argumentType,
  360 + "subtype" => $argumentSubType,
343 361 "default" => $argumentDefault
344 362 );
345 363  
... ...