/*  $Id: directory_scanner.cpp,v 1.12 2004/02/01 02:06:29 mbn Exp $
**
**  ClanLib Game SDK
**  Copyright (C) 2003  The ClanLib Team
**  For a total list of contributers see the file CREDITS.
**
**  This library is free software; you can redistribute it and/or
**  modify it under the terms of the GNU Lesser General Public
**  License as published by the Free Software Foundation; either
**  version 2.1 of the License, or (at your option) any later version.
**
**  This library is distributed in the hope that it will be useful,
**  but WITHOUT ANY WARRANTY; without even the implied warranty of
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
**  Lesser General Public License for more details.
**
**  You should have received a copy of the GNU Lesser General Public
**  License along with this library; if not, write to the Free Software
**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
**
*/

#include "Core/precomp.h"
#include "API/Core/System/cl_assert.h"
#include "API/Core/IOData/directory_scanner.h"
#include "directory_scanner_generic.h"

#ifdef WIN32
#include "../Win32/directory_scanner_win32.h"
#else
#include "../Unix/directory_scanner_unix.h"
#endif

/////////////////////////////////////////////////////////////////////////////
// CL_DirectoryScanner construction:

CL_DirectoryScanner::CL_DirectoryScanner()
{
#ifdef WIN32
	impl = new CL_DirectoryScanner_Win32();
#else
	impl = new CL_DirectoryScanner_Unix();
#endif
}

CL_DirectoryScanner::CL_DirectoryScanner(const CL_DirectoryScanner &copy) : impl(copy.impl)
{
}

CL_DirectoryScanner::~CL_DirectoryScanner()
{
}

/////////////////////////////////////////////////////////////////////////////
// CL_DirectoryScanner attributes:

bool CL_DirectoryScanner::scan(const std::string& pathname) 
{
	return impl->scan (pathname);
}

bool CL_DirectoryScanner::scan(const std::string& pathname, const std::string& pattern)
{
	return impl->scan (pathname, pattern);
}

std::string CL_DirectoryScanner::get_directory_path()
{
	return impl->get_directory_path();
}

int CL_DirectoryScanner::get_size()
{
	return impl->get_size();
}

std::string CL_DirectoryScanner::get_name()
{
	return impl->get_name();
}
	
std::string CL_DirectoryScanner::get_pathname()
{
	return impl->get_pathname();
}
	
bool CL_DirectoryScanner::is_directory()
{
	return impl->is_directory();
}

bool CL_DirectoryScanner::is_hidden()
{
	return impl->is_hidden();
}     

bool CL_DirectoryScanner::is_readable()
{
	return impl->is_readable();
}

 bool CL_DirectoryScanner::is_writable()
{
	return impl->is_writable();
}
/////////////////////////////////////////////////////////////////////////////
// CL_DirectoryScanner operations:

bool CL_DirectoryScanner::next() 
{ 
	return impl->next(); 
}
