| Line |   | 
|---|
| 1 | #pragma once
 | 
|---|
| 2 | 
 | 
|---|
| 3 | namespace Jenga{
 | 
|---|
| 4 | namespace Common{
 | 
|---|
| 5 | 
 | 
|---|
| 6 | 
 | 
|---|
| 7 | class Path
 | 
|---|
| 8 | {
 | 
|---|
| 9 |     std::string fullPath;
 | 
|---|
| 10 |     std::string driveName;
 | 
|---|
| 11 |     std::string dirName;
 | 
|---|
| 12 |     std::string fileName;
 | 
|---|
| 13 |     std::string ext;
 | 
|---|
| 14 | 
 | 
|---|
| 15 |     void Expand()
 | 
|---|
| 16 |     {
 | 
|---|
| 17 |         char szDrive[32], szDir[1024], szFile[1024], szExt[255];
 | 
|---|
| 18 |         _splitpath_s( fullPath.c_str(), szDrive, 32, szDir, 1024, szFile, 1024, szExt, 255 );
 | 
|---|
| 19 |         driveName = szDrive;
 | 
|---|
| 20 |         dirName = szDir;
 | 
|---|
| 21 |         fileName = szFile;
 | 
|---|
| 22 |         ext = szExt;
 | 
|---|
| 23 |     }
 | 
|---|
| 24 | 
 | 
|---|
| 25 | public:
 | 
|---|
| 26 |     Path( const std::string &fullPath )
 | 
|---|
| 27 |         : fullPath( fullPath )
 | 
|---|
| 28 |     {
 | 
|---|
| 29 |         Expand();
 | 
|---|
| 30 |     }
 | 
|---|
| 31 |     ~Path()
 | 
|---|
| 32 |     {
 | 
|---|
| 33 |     }
 | 
|---|
| 34 | 
 | 
|---|
| 35 |     bool IsExistFile() const;
 | 
|---|
| 36 | 
 | 
|---|
| 37 |     const std::string &GetDriveName() const
 | 
|---|
| 38 |     {
 | 
|---|
| 39 |         return driveName;
 | 
|---|
| 40 |     }
 | 
|---|
| 41 |     const std::string &GetDirName() const
 | 
|---|
| 42 |     {
 | 
|---|
| 43 |         return dirName;
 | 
|---|
| 44 |     }
 | 
|---|
| 45 |     const std::string &GetFileName() const
 | 
|---|
| 46 |     {
 | 
|---|
| 47 |         return fileName;
 | 
|---|
| 48 |     }
 | 
|---|
| 49 |     const std::string &GetExt() const
 | 
|---|
| 50 |     {
 | 
|---|
| 51 |         return ext;
 | 
|---|
| 52 |     }
 | 
|---|
| 53 |     const std::string &GetFullPath() const
 | 
|---|
| 54 |     {
 | 
|---|
| 55 |         return fullPath;
 | 
|---|
| 56 |     }
 | 
|---|
| 57 |     bool IsNetworkPath() const
 | 
|---|
| 58 |     {
 | 
|---|
| 59 |         if( fullPath.size() < 2 )
 | 
|---|
| 60 |         {
 | 
|---|
| 61 |             return false;
 | 
|---|
| 62 |         }
 | 
|---|
| 63 |         return ( ( fullPath[0] == '\\' ) && ( fullPath[1] == '\\' ) );
 | 
|---|
| 64 |     }
 | 
|---|
| 65 | 
 | 
|---|
| 66 |     static std::string MakeFullPath( const std::string &relativePath, const std::string &baseDirPath );
 | 
|---|
| 67 |     static std::string MakeFullPathByCurrentDirectory( const std::string &relativePath );
 | 
|---|
| 68 |     static std::string ExtractDirPath( const std::string &path );
 | 
|---|
| 69 | };
 | 
|---|
| 70 | 
 | 
|---|
| 71 | 
 | 
|---|
| 72 | }}
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.