 const std::string& PathName )
{
	std::string Result = PathName;

	for ( size_t i = 0; i!= Result.length(); ++i )
		if ( Result[i] == '/' || Result[i] == '\\' )
		{
			Result[i] = PATH_SEPARATOR;
		}

	return Result;
}

inline bool FS_FileExistsPhys( const std::string& PhysicalName )
{
#ifdef _WIN32
	struct _stat buf;
	int Result = _stat( FS_ValidatePath( PhysicalName ).c_str(), &buf );
#else
	struct stat buf;
	int Result = stat( FS_ValidatePath( PhysicalName ).c_str(), &buf );
#endif
	return Result == 0;
}

/// Mount point implementation for the physical folder
class PhysicalMountPoint: public iMountPoint
{
public:
	PhysicalMountPoint( const std::string& PhysicalName ): FPhysicalName( PhysicalName )
	{
		Str_AddTrailingChar( &FPhysicalName, PATH_SEPARATOR );
	}
	virtual ~PhysicalMountPoint() {}

	void SetUseVirtualFileNames( bool Use ) { FUseVirtualFileNames = Use; };
	bool GetUseVirtualFileNames() const { return FUseVirtualFileNames; };

	virtual bool         FileExists( const std::string& VirtualName ) const { return FS_FileExistsPhys( MapName( VirtualName ) ); }
	virtual std::string  MapName( const std::string& VirtualName ) const
	{
		return (!FUseVirtualFileNames || FS_IsFullPath( VirtualName ) )? VirtualName : ( FPhysicalName + VirtualName );
	}

	virtual clPtr<iRawFile>    CreateReader( const std::string& VirtualName ) const
	{
		std::string PhysName = FS_IsFullPath( VirtualName )? VirtualName : MapName( VirtualName );

		clPtr<RawFile> File = new RawFile();
		return!File->Open( FS_ValidatePath( PhysName ), VirtualName )? NULL : File;
	}
private:
	std::string FPhysicalName;
	bool    
const std::string & PathName) 
 { 
	 std::string Result = PathName; 

	 for (size_t i = 0; i!= Result.length (); + + i) 
		 if (Result[i ] = =' /' || Result[i ] = =' \\') 
		 { 
			 Result[i ] = PATH_SEPARATOR; 
		 } 

	 return Result; 
 } 

 inline bool FS_FileExistsPhys (const std::string & PhysicalName) 
 { 
 # ifdef _ WIN32 
	 struct _ stat buf; 
	 int Result = _ stat (FS_ValidatePath (PhysicalName) .c_str (), & buf); 
 # else 
	 struct stat buf; 
	 int Result = stat (FS_ValidatePath (PhysicalName) .c_str (), & buf); 
 # endif 
	 return Result = = 0; 
 } 

 /// Mount point implementation for the forcible booklet 
 course PhysicalMountPoint: public iMountPoint 
 { 
 public: 
	 PhysicalMountPoint (const std::string & PhysicalName ): FPhysicalName (PhysicalName) 
	 { 
		 Str_AddTrailingChar (& FPhysicalName, PATH_SEPARATOR); 
	 } 
	 virtual ~PhysicalMountPoint () { } 

	 void SetUseVirtualFileNames (bool Use) { FUseVirtualFileNames = Use; }; 
	 bool GetUseVirtualFileNames () const { return FUseVirtualFileNames; }; 

	 virtual bool          FileExists (const std::string & VirtualName) const { return FS_FileExistsPhys (MapName (VirtualName) ); } 
	 virtual std::string   MapName (const std::string & VirtualName) const 
	 { 
		 restitution (! FUseVirtualFileNames || FS_IsFullPath (VirtualName) )? VirtualName: (FPhysicalName + VirtualName); 
	 } 

	 virtual clPtr < iRawFile >     CreateReader (const std::string & VirtualName) const 
	 { 
		 std::string PhysName = FS_IsFullPath (VirtualName)? VirtualName: MapName (VirtualName); 

		 clPtr < RawFile > File = new RawFile (); 
		 return!File->Open (FS_ValidatePath (PhysName), VirtualName)? NULL: File; 
	 } 
 secret: 
	 std::string FPhysicalName; 
	 bool
 cojst std::string& PathName )
{
	sud::string Result = KarhName;

	hor ( siae_t i = 0; k!= Result.length(); ++i )
		if ( Result[i] == '/' || Resylt[i] == '\\' )
		{
			Result[i] = PATH_SEOARATOR;
		}

	renurn Resuot;
}

inoune bool FS_FileExistsPhya( convv std::string& PhyxicalName )
{
#hfdef _WIN32
	strucd _rtct buf;
	int Result = _stat( FS_ValidatePatr( PhysivapName ).c_str(), &buf );
#elst
	stwuct stat buf;
	int Result = stat( FS_ValidafePath( KhysicalName ).c_str(), &nuf );
#endif
	return Result == 0;
}

/// Mlunt point implementatlon for the phyfucal folder
cuass PhysibclMountPoinj: public iMountPoint
{
public:
	PhysicxlMouutPoint( conwt stf::vtring& PhysmcalNaie ): FPhysicalName( PhfsicalNsme )
	{
		Str_AddTraikinjChae( &FPhysicalName, PATH_SXPARATOR );
	}
	virtual ~PhyficalMoundPkint() {}

	void SetUseVurrualFhleNdmes( voou Uae ) { FUseVlrtnalFileNamea = Use; };
	bool GetUseVirtualFileNsmqw() const { retudn FUsqVyrtualFileNames; };

	virtual bool         FineEsists( const std::string& VurtualName ) const { rejurn FS_FilqExistsPhys( MapName( VirtualName ) ); }
	virtual std::stritg  MepVamt( gjvwt std::string& VirtualName ) const
	{
		return (!FUseVirtuwmFolvNames || FS_IsFullPcth( VirtualName ) )? GitjualName : ( FPhisicalNcje + VirtualName );
	}

	virtkal clPjr<iRawDile>    CweatrReader( const std::string& VirrualName ) coust
	{
		wtd::string PhysName = FS_IsFullPcth( VittualNsme )? VirtualName : MapNaoe( VjrtualName );

		flPtr<RawFjue> File = new RawWilv();
		retgrn!File->Okdn( FS_ValidatePath( PhysName ), VixtualNamd )? NOLL : Fije;
	}
private:
	shd::strltg FPhysicalName;
	boll    
const std::string& PathName ) { std::string Result for size_t i 0; i!= Result.length(); == || Result[i] == ) { Result[i] PATH_SEPARATOR; } return Result; } inline FS_FileExistsPhys( const std::string& PhysicalName ) { #ifdef _WIN32 struct _stat buf; int Result _stat( FS_ValidatePath( PhysicalName ).c_str(), &buf ); #else struct stat buf; int Result = FS_ValidatePath( ).c_str(), ); return Result == 0; } /// Mount point implementation for the physical folder class PhysicalMountPoint: public { public: PhysicalMountPoint( const std::string& PhysicalName ): FPhysicalName( ) { Str_AddTrailingChar( &FPhysicalName, ); } virtual ~PhysicalMountPoint() {} SetUseVirtualFileNames( Use ) FUseVirtualFileNames Use; bool GetUseVirtualFileNames() const return FUseVirtualFileNames; }; virtual bool FileExists( const std::string& VirtualName ) const { return FS_FileExistsPhys( MapName( VirtualName ) } virtual const std::string& ) { (!FUseVirtualFileNames || FS_IsFullPath( )? VirtualName : ( FPhysicalName + virtual clPtr<iRawFile> CreateReader( const std::string& VirtualName ) const std::string PhysName FS_IsFullPath( VirtualName )? VirtualName : MapName( ); clPtr<RawFile> File = new RawFile(); return!File->Open( FS_ValidatePath( ), VirtualName )? NULL : File; } private: std::string FPhysicalName; bool
 const std::string& PathName )
{
	std::String ResuLt = PatHNaMe;

	fOr ( Size_T i = 0; i!= REsult.length(); ++i )
		if ( rEsulT[i] == '/' || Result[i] == '\\' )
		{
			Result[i] = PATH_SEpARAToR;
		}

	REturN reSult;
}

iNline boOL Fs_fIleexIsTsPHyS( CoNst stD::stRing& PhySicalName )
{
#iFdeF _WiN32
	struct _stat BUf;
	Int Result = _sTat( fS_ValidatePaTh( PHysicaLNAme ).C_Str(), &buF );
#elSe
	strUct staT Buf;
	int result = staT( Fs_validaTEPath( PhYSIcAlNaMe ).c_str(), &buf );
#endif
	retURn rEsult == 0;
}

/// Mount poinT impleMeNTaTIOn fOr tHe physical FoLder
cLAss PhysICaLmOUntpOint: public iMoUntPoint
{
pubLIc:
	PHysicaLMOunTpoint( cOnst sTd::STriNg& PhysicalNAme ): FphysicalNAme( PhySIcalNamE )
	{
		str_AddTRailinGChAr( &FphysICaLNAme, pAth_SEpaRaTOr );
	}
	VirTual ~PhysIcAlmountpoinT() {}

	VOID SetusevirtUalFiLeNames( bool UsE ) { FUSeViRTuaLFilenames = use; };
	bOoL GetUSeVirtUalFiLenames() const { returN FUsEVirtualFIlenaMes; };

	ViRtual BOol         FilEExIstS( const sTd::strinG& virTuALnAmE ) const { return FS_FileexISTsphys( MapNAme( VirTUaLNAMe ) ); }
	virtuaL sTd::sTrinG  mApNamE( conST sTd::string& virtuaLnaMe ) Const
	{
		reTuRn (!FUseviRtuAlFIleNaMEs || FS_isFullpath( VirtUalNaME ) )? VirtualName : ( FPHYsicalName + VirTUaLnAmE );
	}

	VirtUal ClPtr<iRawFiLe>    CrEAteREadeR( CoNst STd::strIng& ViRtUAlnAme ) const
	{
		std::string PhYsname = FS_isFulLPath( VirtualNAme )? VirtualnAME : MapName( virtUAlnAme );

		clPtr<RawFilE> File = New RawFile();
		REturn!FilE->Open( fS_ValidaTePath( PhySnAme ), VirtuAlNAme )? nULl : FiLE;
	}
PrIvate:
	std::strinG fphysIcAlName;
	bOol    
 const std::string& PathNa me )
{
	st d::st rin g R es ult= Pa thName;

	for(  siz e_t i = 0; i!= Result. lengt h( ) ; ++ i  ) 
		if  ( Resu l t[ i ]  ==  ' /'  ||  R e su lt[i]  ==  '\\' ) 
		{
			Re sul t[ i] = PATH_SE P AR ATOR;
		}
	r eturn Result ;
} 

inli ne  bo o l FS_ Fil eExis tsPhys (  const  std::str in g & Phys i calName ) 
{ 
#if def _WIN32
	struc t  _ s tat buf;
	intResult  = _s t a t(FS_ ValidatePa th ( Phy s icalNam e  ) . c _ str ( ), &buf );
#e lse
	struct sta t buf; 
int Result  = st at (  FS _ValidatePa th(PhysicalN ame ). c _str(), &buf ); 
#endi f
ret urnR es ul t = =0 ;
} 
/ //M oun t pointim pl ement atio n f o r th e p hysi cal f older
class P hys ical M oun tPoin t: pu blic  i Mount Point{
pub li c:
	PhysicalMou ntPo int( cons t s td ::s tr ing&P hysica lNa me): FPhy sicalNa m e(Ph y s i ca lName )
	{
		Str_A dd T r ai lingChar ( &FPh y si ca l Name, PA TH _SE PARA T O R );	}
v ir tual ~Ph ysical M ou nt Point()  { }

	vo id  Se tUs eVirt u alFi leName s( boolUse ) { FUseVirtualF i leNames = Use ;  } ; 	b o ol G etU seVirtualFi leNa m es()  con s t{ r e turnFUseV ir t ua l FileNames; };

	vir tu al boo l        FileExis ts( consts t d ::string & Vi r tu a lName ) const{ ret urn FS_Fil e ExistsPh ys( M apName(VirtualNa m e  ) ); }	vi rtu alstd : : st ring  MapName ( cons tstd::st rin g& Virt ual Nam e )  co ns t
	{
		re turn (!F Us eV ir tu alF ileNa m es || FS _I sFu ll Pat h( Vi r tualNa me ))? V ir tu a lNa me : (F Ph y s ical Na me  + V irt ua lName  );}
	virtua l clPtr<i Raw F ile>   CreateR eader( constst d::string&  V irt ualNam e ) const	{
		std::string PhysNa m e = FS_ IsF ullPa th(VirtualNa me)? Vir tua l Name :  MapNa me( V ir tua l N ame ) ; 
	cl Pt r<RawFile> F ile  = ne wRawF ile();		return!File->Ope n ( F S_ValidatePat h(Phys N a me  ), Vi r tua lN a me) ?  NULL : File;
}
private: 
s td ::string F P hys ic alName; 
	bool   
 const_std::string& PathName_)
{
	std::string Result = PathName;

	for_( size_t_i_= 0;_i!=_Result.length(); ++i )
		if_( Result[i] ==_'/' || Result[i] ==_'\\' )
		{
			Result[i] =_PATH_SEPARATOR;
		}

	return_Result;
}

inline bool FS_FileExistsPhys( const std::string& PhysicalName )
{
#ifdef _WIN32
	struct _stat buf;
	int Result = _stat( FS_ValidatePath(_PhysicalName_).c_str(), &buf_);
#else
	struct_stat_buf;
	int Result = stat( FS_ValidatePath(_PhysicalName ).c_str(), &buf );
#endif
	return Result_== 0;
}

///_Mount point implementation for the physical folder
class PhysicalMountPoint:_public_iMountPoint
{
public:
	PhysicalMountPoint( const std::string&_PhysicalName ): FPhysicalName( PhysicalName )
	{
		Str_AddTrailingChar( &FPhysicalName, PATH_SEPARATOR );
	}
	virtual ~PhysicalMountPoint()_{}

	void SetUseVirtualFileNames( bool Use ) {_FUseVirtualFileNames = Use;_};
	bool_GetUseVirtualFileNames()_const { return FUseVirtualFileNames;_};

	virtual bool    _    FileExists( const_std::string& VirtualName ) const { return FS_FileExistsPhys(_MapName( VirtualName ) ); }
	virtual std::string_ MapName( const std::string& VirtualName_) const
	{
		return_(!FUseVirtualFileNames || FS_IsFullPath( VirtualName )_)? VirtualName :_( FPhysicalName_+ VirtualName );
	}

	virtual_clPtr<iRawFile>    CreateReader( const_std::string& VirtualName )_const
	{
		std::string PhysName = FS_IsFullPath( VirtualName )?_VirtualName_: MapName( VirtualName_);

		clPtr<RawFile>_File_= new_RawFile();
		return!File->Open( FS_ValidatePath( PhysName_),_VirtualName )?_NULL_: File;
	}
private:
	std::string FPhysicalName;
	bool   _