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 IsExist() const
|
---|
43 | {
|
---|
44 | }
|
---|
45 |
|
---|
46 | const std::string &GetDriveName() const
|
---|
47 | {
|
---|
48 | return driveName;
|
---|
49 | }
|
---|
50 | const std::string &GetDirName() const
|
---|
51 | {
|
---|
52 | return dirName;
|
---|
53 | }
|
---|
54 | const std::string &GetFileName() const
|
---|
55 | {
|
---|
56 | return fileName;
|
---|
57 | }
|
---|
58 | const std::string &GetExt() const
|
---|
59 | {
|
---|
60 | return ext;
|
---|
61 | }
|
---|
62 | const std::string &GetFullPath() const
|
---|
63 | {
|
---|
64 | return fullPath;
|
---|
65 | }
|
---|
66 | };
|
---|
67 |
|
---|
68 |
|
---|
69 | }}
|
---|
Note:
See
TracBrowser
for help on using the repository browser.