//#include "ffsco.h"

//////////////////////////////////////////////////////////////////////
// ffsco.h: interface for the helper_coffs::ffsco class.
//
//////////////////////////////////////////////////////////////////////
/*
 * Copyright 2004, ??? (www.???.com). All rights reserved.
 * Copyright 1990-2004, ???.
 *
 * See the COPYING file for the terms of usage and distribution.
 */
//////////////////////////////////////////////////////////////////////
// ...
// create@2004-03-17
// by ???
//////////////////////////////////////////////////////////////////////

#ifndef	__FFSCO__
//#if !defined(__FFSCO__)
#define __FFSCO__

#ifndef	WIN32
#error now only for WIN32(platform).
#endif

#include <string>
#include <vector>

#include <sstream>

using namespace std;
#pragma warning(disable:4786)

#ifdef UNICODE
typedef wstring tstring;
#else
typedef string tstring;
#endif

//#include <iostream>
//#include <algorithm>

namespace helper_coffs {

	const int max_limit = 0x100000;	//--1048576
	const int def_limit = 0x10000;	//--65536

	const TCHAR c_pathSeparator = _T('\\');
	const tstring s_pathSeparator = _T("\\");

	//--find files collection
	class ffsco
	{
	public:
		typedef vector<tstring>	typeT;
		virtual int match(tstring fext_, tstring file_);	//--�ļ�ƥ����

	public:
		void test();	//--example
		int find(tstring path_, tstring fext_ = _T(""));

	public:
		tstring get(int i = 0) { return _co.at(i); }
		int count() { return _co_dir.size() + _co_file.size(); }
		//int count() { return _co.size(); }
		typeT co() { return _co; }
		typeT co_dir() { return _co_dir; }
		typeT co_file() { return _co_file; }

	public:
		int limit() { return _limit; }
		void limit(int limit_);	//--���ý���ļ���Ŀ����

	public:
		int dirs() { return _dirs; }	//get
		void dirs(int dirs) { _dirs = dirs; }	//--set
		int dir(tstring s);	//--�ж�s�Ƿ�ΪĿ¼

	private:
		int _limit;	//--limit
		int _dirs;	//--dirs-�Ƿ������Ŀ¼(Ĭ��0-������)
		typeT _co_file;
		typeT _co_dir;
		typeT _co;

	public:
		ffsco();
		virtual ~ffsco();

	private:
		inline int checkcount() { return count() == limit(); }	//--limit test
		inline tstring _uppercase_(tstring s);	//--ת��s����д��ĸ
	};

};	//--namespace helper_coffs

#endif	//--__FFSCO__