Go to the documentation of this file.00001 #ifndef __DIRECTORY_ABSTRACTION_H__
00002 #define __DIRECTORY_ABSTRACTION_H__
00003
00004 #include <string>
00005
00006 #include <utilities/nwindows.h>
00007 #include <utilities/testing_utilities.h>
00008
00009 #if !defined( WIN32_PLATFORM ) && !defined( NIX_PLATFORM ) && !defined( MINGW_PLATFORM ) && !defined( CYGWIN_PLATFORM )
00010 #define WIN32_PLATFORM
00011 #endif
00012
00013 #ifdef WIN32_PLATFORM
00014
00015
00016 #pragma warning( disable : 4251 )
00017 #endif
00018
00019 #ifdef DIRECTORY_ABSTRACTION
00020 #if defined( WIN32_PLATFORM ) || defined( MINGW_PLATFORM ) || defined( CYGWIN_PLATFORM )
00021 #define DIRECTORY_ABSTRACTION_DLL_ENTITY __declspec( dllexport )
00022 #endif
00023
00024 #if defined( NIX_PLATFORM )
00025 #define DIRECTORY_ABSTRACTION_DLL_ENTITY
00026 #endif
00027 #else
00028 #ifdef WIN32_PLATFORM
00029 #define DIRECTORY_ABSTRACTION_DLL_ENTITY __declspec( dllimport )
00030 #pragma comment( lib , "directory_abstraction.lib" )
00031 #endif
00032
00033 #if defined( CYGWIN_PLATFORM ) || defined( MINGW_PLATFORM )
00034 #define DIRECTORY_ABSTRACTION_DLL_ENTITY __declspec( dllimport )
00035 #endif
00036
00037 #if defined( NIX_PLATFORM )
00038 #define DIRECTORY_ABSTRACTION_DLL_ENTITY
00039 #endif
00040 #endif
00041
00042 namespace nitro
00043 {
00056 class DIRECTORY_ABSTRACTION_DLL_ENTITY DirectoryAbstraction{
00057
00058 public:
00059
00070 DirectoryAbstraction( void );
00071
00094 bool FindFirst( const char * DirectoryPath );
00095
00096 ALIAS_FUNCTION_1R( FindFirst , aliasFindFirst , const char * , bool )
00097
00098
00120 bool FindFirst( const std::string & DirectoryPath );
00121
00140 bool FindNext( void );
00141
00160 bool IsDirectory( void );
00161
00184 static bool IsDirectory( const char * DirectoryPath );
00185
00208 static bool IsDirectory( const std::string & DirectoryPath );
00209
00232 static bool IsFile( const char * FilePath );
00233
00256 static bool IsFile( const std::string & FilePath );
00257
00276 bool IsFile( void );
00277
00296 bool IsDots( void );
00297
00316 const char * GetName( void );
00317
00332 void Release( void );
00333
00352 static void CreateDirectory( const char * DirPath );
00353
00372 static void CreateDirectory( const std::string & DirPath );
00373
00384 virtual ~DirectoryAbstraction();
00385
00386 private:
00387
00398 void * FindData;
00399
00410 void * FindHandle;
00411
00422 mutable std::string PathBuffer;
00423
00434 std::string DirectoryPath;
00435
00454 DirectoryAbstraction( const DirectoryAbstraction & DirectoryAbstraction ){}
00455
00478 DirectoryAbstraction operator=( const DirectoryAbstraction & DirectoryAbstraction ){return( *this );}
00479 };
00480
00481 ALIAS_FUNCTION_1( DirectoryAbstraction::CreateDirectory , aliasCreateDirectory , const char * )
00482
00483 }
00484
00485 #endif