Commit a7011f4d896dd17e47b5d1682727e61e88e0cb48

Authored by Benjamin Renard
1 parent e9165342

Generated list for arguments of a templated parameter

Showing 1 changed file with 15 additions and 2 deletions   Show diff stats
src/InputOutput/IHMImpl/Tools/IHMParamTemplateClass.php
@@ -18,6 +18,9 @@ class IHMParamTemplateClass @@ -18,6 +18,9 @@ class IHMParamTemplateClass
18 protected static $paramTemplateArgumentKeyAtt = 'key'; 18 protected static $paramTemplateArgumentKeyAtt = 'key';
19 protected static $paramTemplateArgumentNameAtt = 'name'; 19 protected static $paramTemplateArgumentNameAtt = 'name';
20 protected static $paramTemplateArgumentTypeAtt = 'type'; 20 protected static $paramTemplateArgumentTypeAtt = 'type';
  21 + protected static $paramTemplateArgumentMinKeyAtt = 'minkey';
  22 + protected static $paramTemplateArgumentMaxKeyAtt = 'maxkey';
  23 + protected static $paramTemplateArgumentNameTplAtt = 'nametpl';
21 protected static $paramTemplateArgumentDefaultAtt = 'default'; 24 protected static $paramTemplateArgumentDefaultAtt = 'default';
22 protected static $paramTemplateArgumentListItemNode = 'item'; 25 protected static $paramTemplateArgumentListItemNode = 'item';
23 protected static $paramTemplateArgumentListItemKeyAtt = 'key'; 26 protected static $paramTemplateArgumentListItemKeyAtt = 'key';
@@ -263,6 +266,9 @@ class IHMParamTemplateClass @@ -263,6 +266,9 @@ class IHMParamTemplateClass
263 $argumentName = $argumentNode->getAttribute(self::$paramTemplateArgumentNameAtt); 266 $argumentName = $argumentNode->getAttribute(self::$paramTemplateArgumentNameAtt);
264 $argumentType = $argumentNode->getAttribute(self::$paramTemplateArgumentTypeAtt); 267 $argumentType = $argumentNode->getAttribute(self::$paramTemplateArgumentTypeAtt);
265 $argumentDefault = $argumentNode->getAttribute(self::$paramTemplateArgumentDefaultAtt); 268 $argumentDefault = $argumentNode->getAttribute(self::$paramTemplateArgumentDefaultAtt);
  269 + $argumentMinKey = $argumentNode->getAttribute(self::$paramTemplateArgumentMinKeyAtt);
  270 + $argumentMaxKey = $argumentNode->getAttribute(self::$paramTemplateArgumentMaxKeyAtt);
  271 + $argumentNameTpl = $argumentNode->getAttribute(self::$paramTemplateArgumentNameTplAtt);
266 272
267 if (empty($argumentKey) || empty($argumentType)) 273 if (empty($argumentKey) || empty($argumentType))
268 continue; 274 continue;
@@ -285,7 +291,14 @@ class IHMParamTemplateClass @@ -285,7 +291,14 @@ class IHMParamTemplateClass
285 continue; 291 continue;
286 $arguments[$argumentKey]['items'][$itemKey] = (empty($itemName) ? $itemKey : $itemName); 292 $arguments[$argumentKey]['items'][$itemKey] = (empty($itemName) ? $itemKey : $itemName);
287 } 293 }
288 - 294 + break;
  295 + case "generated-list":
  296 + $arguments[$argumentKey]['type'] = 'list';
  297 + $arguments[$argumentKey]['items'] = array();
  298 + for ($key = intval($argumentMinKey) ; $key <= intval($argumentMaxKey); ++$key) {
  299 + $itemName = str_replace('##key##',$key,$argumentNameTpl);
  300 + $arguments[$argumentKey]['items'][strval($key)] = $itemName;
  301 + }
289 break; 302 break;
290 default: 303 default:
291 //Nothing to do 304 //Nothing to do
@@ -300,4 +313,4 @@ class IHMParamTemplateClass @@ -300,4 +313,4 @@ class IHMParamTemplateClass
300 313
301 } 314 }
302 } 315 }
303 -}  
304 \ No newline at end of file 316 \ No newline at end of file
  317 +}