*/ class LSioFormat { var $config=False; var $driver=False; /** * Constructor * * @param[in] string $LSobject The LSobject type name * @param[in] string $ioFormat The ioFormat name * * @retval void **/ public function __construct($LSobject, $ioFormat) { $conf=LSconfig::get('LSobjects.'.$LSobject.".ioFormat.".$ioFormat); if(is_array($conf)) { $this -> config=$conf; if (isset($this -> config['driver']) && LSsession :: loadLSclass('LSioFormat'.$this -> config['driver'])) { $driverClass='LSioFormat'.$this -> config['driver']; $driverOptions=array(); if (isset($this -> config['driver_options'])) $driverOptions = $this -> config['driver_options']; $this -> driver = new $driverClass($driverOptions); } else { LSerror :: addErrorCode('LSioFormat_01',$this -> config['driver']); } } } /** * Check if ioFormat driver is ready * * @retval boolean True if ioFormat driver is ready, false otherwise **/ public function ready() { return (is_array($this -> config) && $this -> driver !== False); } /** * Load and valid file * * @param[in] string $file The file path to load * * @retval boolean True if file is loaded and valid, false otherwise **/ public function loadFile($file) { if ($this -> driver -> loadFile($file)) { return $this -> driver -> isValid(); } return False; } /** * Retreive all objects contained by the loaded file * * @retval array The objects contained by the loaded file **/ public function getAll() { return $this -> driver -> getAllFormated($this -> config['fields'],$this -> config['generated_fields']); } } LSerror :: defineError('LSioFormat_01', _("LSioFormat : IOformat driver %{driver} invalid or unavailable.") );