Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Tools.h

Go to the documentation of this file.
00001 // Copyright NVIDIA Corporation 2002-2004
00002 // TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
00003 // *AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS
00004 // OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
00005 // AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS
00006 // BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES
00007 // WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
00008 // BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS)
00009 // ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS
00010 // BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES 
00011 
00012 #pragma once
00013 
00015 #include "nvsgcommon.h"
00016 
00017 #include <vector>
00018 // __WIN64__wa__XXX macros to workaround some win64 issues
00019 #include "__WIN64__workarounds.h"
00020 
00021 namespace nvutil
00022 { 
00023 
00025 
00040   extern NVSG_API bool FindFile( const std::string &mask                  
00041                                , const std::vector<std::string> &searchPaths   
00042                                , std::vector<std::string> &results             
00043                                , bool recursive=false                
00044                                );           
00045     
00047 
00049   extern NVSG_API bool FindFileFirst( const std::string &mask                
00050                                     , const std::vector<std::string> &searchPaths 
00051                                     , std::string &nameOut                   
00052                                     , bool recursive=false              
00053                                     );
00054 
00056   extern NVSG_API bool FileExists( const std::string &filepath  //<! Input (path+)filename.
00057                                  );
00058 
00060 
00062   extern NVSG_API void GetFileNameFromPath( const std::string& path 
00063                                           , std::string& fname      
00064                                           ); 
00066 
00068   extern NVSG_API void GetFileExtFromPath( const std::string& path 
00069                                          , std::string& fext       
00070                                          );
00072 
00074   extern NVSG_API void GetDirFromPath( const std::string& path 
00075                                      , std::string& dir        
00076                                      );
00078 
00080   extern NVSG_API void GetDrvFromPath( const std::string& path 
00081                                      , std::string& drv        
00082                                      );
00084 
00086   extern NVSG_API void GetDrvAndDirFromPath(const std::string& path 
00087                                            , std::string& dir             
00088                                            );
00089 #if defined(_WIN32)
00090 
00091 
00093   extern NVSG_API void GetModulePath( const std::string& module 
00094                                     , std::string& path         
00095                                     );
00096 #elif defined(LINUX) 
00097 
00098 
00100   extern NVSG_API void GetModulePath( std::string& path );   
00101 #endif                                    
00102 
00103 #if defined(_WIN32)
00104 
00105 
00107   extern NVSG_API void GetModulePath( const HMODULE hModule 
00108                                     , std::string& path          
00109                                     );
00110 #endif
00111 
00113 
00116   extern NVSG_API bool GetCurrentDir( std::string& path 
00117                                     );
00118 
00119   template<typename T>  T Maximum( T a, T b, T c )
00120   {
00121     return( ( a < b ) ? __WIN64__wa__std_max( b, c ) : __WIN64__wa__std_max( a, c ) );
00122   }
00123 
00124   template<typename T>  T Minimum( T a, T b, T c )
00125   {
00126     return( ( a < b ) ? __WIN64__wa__std_min( a, c ) : __WIN64__wa__std_min( b, c ) );
00127   }
00128 
00130 
00133   extern NVSG_API std::string SetCurrentDir( const std::string& dir 
00134                                       );
00135 
00136 } // namespace nvutil

Generated on Tue Mar 1 13:19:20 2005 for NVSGSDK by NVIDIA