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