Exemplo n.º 1
0
 public function &classes(&$_cl, $params = null)
 {
     $_cl = parent::classes($_cl, $params);
     $cl_params =& $_cl->getParams();
     if ($params != null) {
         if (isset($params['prefix'])) {
             $cl_params['prefix'] = $params['prefix'];
             $_cl->name = $params['prefix'] . $_cl->getName();
         }
         if (isset($params['clean'])) {
             $cl_params['clean'] = $params['clean'];
         }
     }
     $properties =& $_cl->getProperties();
     for ($i = 0; $i < count($properties); $i++) {
         $_property =& $properties[$i];
         $_params =& $_property->getParams();
         if ($_property->isArray()) {
             // If is object and is array, we need to include "import"
             if ($_property->isObject) {
                 $_cl->pushImport('#import "' . $_property->getNameCapitalized() . '.h"');
             }
             $_property->setType("NSMutableArray *");
         } else {
             if ($_property->isObject) {
                 $_cl->pushImport('#import "' . $_property->getNameCapitalized() . '.h"');
                 $_property->setType($_property->getNameCapitalized() . " *");
             }
         }
         $_params['memory'] = "strong";
     }
     $cl_params['year'] = date('Y');
     $cl_params['today'] = date('Y/m/d');
     return $_cl;
 }
Exemplo n.º 2
0
 public function &classes(&$cl, $params = null)
 {
     $cl = parent::classes($cl, $params);
     $clparams =& $cl->getParams();
     $clparams['package'] = "com.example.package";
     if ($params != null) {
         if (isset($params['package']) && trim($params['package']) != '') {
             $clparams['package'] = $params['package'];
         }
         if (isset($params['includeGson'])) {
             $clparams['includeGson'] = $params['includeGson'];
         }
         if (isset($params['clean'])) {
             $cl_params['clean'] = $params['clean'];
         }
     }
     for ($i = 0; $i < count($cl->getProperties()); $i++) {
         $property =& $cl->getProperties()[$i];
         $pparams =& $property->getParams();
         if ($property->isArray()) {
             $cl->pushImport('import java.util.ArrayList;');
         }
         if ($property->isObject) {
             $property->setType($property->getNameCapitalized());
         } else {
             if ($property->isNull) {
                 $property->setType('Object');
             }
         }
         //
         //   switch ($property->getType()) {
         //     case 'Object':
         //     {
         //       $property->setType("ArrayList<" . $property->getNameCapitalized() . ">");
         //       break;
         //     }
         //     case 'Null':
         //     {
         //       $property->setType("ArrayList<Object>");
         //       break;
         //     }
         //     default:
         //     {
         //       $property->setType("ArrayList<" . $property->getType() . ">");
         //       break;
         //     }
         //   }
         // }
         // else
         // {
         //   switch ($property->getType()) {
         //     case 'Object':
         //     {
         //       $property->setType($property->getNameCapitalized());
         //       break;
         //     }
         //     case 'Null':
         //     {
         //       $property->setType('Object');
         //       break;
         //     }
         //     default:
         //       break;
         //   }
         // }
     }
     return $cl;
 }