forked from kuran-kuran/MZDiskExplorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
path.h
67 lines (61 loc) · 2.38 KB
/
path.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//============================================================================
// path.h パス操作
//----------------------------------------------------------------------------
// Programmed by たご
//----------------------------------------------------------------------------
// 2003.05.20 Ver.0.01 作成開始。
// 2003.05.21 Ver.1.00 完成。
//============================================================================
// -------------------- 2 重定義防止
#ifndef PATH_INCLUDE
#define PATH_INCLUDE
// -------------------- ヘッダファイル登録
// -------------------- 定数定義
static const char* const PATH_VERSION = "1.00";
static const char* const PATH_NAME = "cPath";
#if defined _WIN32
static const char PATH_DIVIDE_CHAR = '\\';
#else
static const char PATH_DIVIDE_CHAR = '/';
#endif
static const unsigned int PATH_MODE_DRIVE = 0x00000001;
static const unsigned int PATH_MODE_DIR = 0x00000002;
static const unsigned int PATH_MODE_NAME = 0x00000004;
static const unsigned int PATH_MODE_EXTNAME = 0x00000008;
static const unsigned int PATH_MODE_ALL = 0x0000000F;
// -------------------- 動作指定
#define PATH_STRING_MAX 260 // 0=可変, 0以外=スタティックメモリサイズ (260推奨)
// -------------------- クラス定義
class cPath {
public:
cPath();
~cPath();
void SetDrive( const char *drive );
void SetDir( const char *dir );
void SetName( const char *name );
void SetExtName( const char *extname );
void SetPath( const char *path );
char* GetPath( unsigned int mode = PATH_MODE_ALL );
char* GetDrive( void );
char* GetDir( void );
char* GetName( void );
char* GetExtName( void );
void Release( void );
private:
cPath( cPath& path );
cPath& operator = ( cPath &path );
int DividePath( void );
void MakePath( unsigned int mode = PATH_MODE_ALL );
char* StrCopy( char *dest, size_t dest_size, const char *source );
char* StrCopyPart( char *dest, const char *source, int sourcestart, int sourceend );
char* StrAdd( char *dest, size_t dest_size, const char *source );
char* StrAddPart( char *dest, const char *source, int sourcestart, int sourceend );
char Drive[ PATH_STRING_MAX ];
char Dir[ PATH_STRING_MAX ];
char Name[ PATH_STRING_MAX ];
char ExtName[ PATH_STRING_MAX ];
char Path[ PATH_STRING_MAX ];
char Dummy;
};
// -------------------- 2 重定義防止
#endif