source: dev/trunk/ab5.0/jenga/include/common/Path.h@ 477

Last change on this file since 477 was 467, checked in by dai_9181, 17 years ago

いくつかのグローバル変数をProgram/Debuggerクラスにまとめた。

File size: 1.1 KB
Line 
1#pragma once
2#pragma warning(disable : 4996)
3
4#include <vector>
5#include <string>
6
7#include <stdlib.h>
8
9
10namespace Jenga{
11namespace Common{
12
13
14class 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
32public:
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 static std::string MakeFullPath( const std::string &relativePath, const std::string &baseDirPath );
66};
67
68
69}}
Note: See TracBrowser for help on using the repository browser.