<?php
/**
 * ZipArchiveのラッパークラス。
 * これにより、PHP4でもPHP5でも、同じ関数で利用できる。
 * $Id: ZipArchiveWrapper.inc,v 1.1 2015/10/08 11:18:56 wanggb Exp $
 * @package jp.aimslib2.io
 */

class ZipArchiveWrapper {
	
	public $zip_archive;
	
	
	public function ZipArchiveWrapper() {
		
		$version = 4;
		if (preg_match("/^(\d+)\./", phpversion(), $m)) {
			$version = $m[1];
		}
		
		if ($version >= 5) {
			$this->zip_archive = new ZipArchive();
			
		} else {
			$this->zip_archive = new ZipArchivePhp4Impl();
		}
		
	}

	public function addEmptyDir($dirname) {
		$this->zip_archive->addEmptyDir($dirname);
	}
	
	public function addFile($filename, $localname = null) {
		$this->zip_archive->addFile($filename, $localname);
	}
	
	public function addFromString($localname, $contents) {
		$this->zip_archive->addFromString($localname, $contents);
	}
	
	public function close() {
		$this->zip_archive->close();
	}
	
	public function deleteIndex($index) {
		$this->zip_archive->deleteIndex($index);
	}
	
	public function deleteName($name) {
		$this->zip_archive->deleteName($name);
	}
	
	public function extractTo($destination, $entries = null) {
		$this->zip_archive->extractTo($destination, $entries);
	}
	
	public function getArchiveComment() {
		$this->zip_archive->getArchiveComment();
	}
	
	public function getCommentIndex($index, $flags = null) {
		$this->zip_archive->getCommentIndex($index, $flags);
	}
	
	public function getCommentName($name, $flags = null) {
		$this->zip_archive->getCommentName($name, $flags);
	}
	
	public function getFromIndex($index, $flags = null) {
		$this->zip_archive->getFromIndex($index, $flags);
	}
	
	public function getFromName($name, $flags = null) {
		$this->zip_archive->getFromName($name, $flags);
	}
	
	public function getNameIndex($index) {
		$this->zip_archive->getNameIndex($index);
	}
	
	public function getStream($name) {
		$this->zip_archive->getStream($name);
	}
	
	public function locateName($name) {
		$this->zip_archive->locateName($name);
	}
	
	public function open($filename, $flags = null) {
		$this->zip_archive->open($filename, $flags);
	}
	
	public function renameIndex($index, $newname) {
		$this->zip_archive->renameIndex($index, $newname);
	}
	
	public function renameName($name, $newname) {
		$this->zip_archive->renameName($name, $newname);
	}
	
	public function setArchiveComment($comment) {
		$this->zip_archive->setArchiveComment($comment);
	}
	
	public function setCommentIndex($index, $comment) {
		$this->zip_archive->setCommentIndex($index, $comment);
	}
	
	public function setCommentName($name, $comment) {
		$this->zip_archive->setCommentName($name, $comment);
	}
	
	public function statIndex($index, $flags = null) {
		$this->zip_archive->statIndex($index, $flags);
	}
	
	public function statName($name, $flags = null) {
		$this->zip_archive->statName($name, $flags);
	}
	
	public function unchangeAll() {
		$this->zip_archive->unchangeAll();
	}
	
	public function unchangeArchive() {
		$this->zip_archive->unchangeArchive();
	}
	
	public function unchangeIndex($index) {
		$this->zip_archive->unchangeIndex($index);
	}
	
	public function unchangeName($name) {
		$this->zip_archive->unchangeName($name);
	}
	
}
?>