72 lines
2.0 KiB
C++
72 lines
2.0 KiB
C++
// FilePath.h: interface for the CFilePath class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#if !defined(AFX_FILEPATH_H__A46C856A_61D3_4A43_A232_12CBDE99D7BE__INCLUDED_)
|
|
#define AFX_FILEPATH_H__A46C856A_61D3_4A43_A232_12CBDE99D7BE__INCLUDED_
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif // _MSC_VER > 1000
|
|
|
|
|
|
#define PATHLENMAX 300 // Longest path length allowed
|
|
|
|
enum FileSpecOK
|
|
{
|
|
// FileExtOK,
|
|
// FileNameOK,
|
|
// FilePathOK,
|
|
// FileRootOK,
|
|
// RootDriveSpecified,
|
|
// RootPathSpecified,
|
|
// RelativePathSpecified,
|
|
|
|
FSPEC_EXTOK = 0x1, // File Extension OK
|
|
FSPEC_NAMEOK = 0x2, // File Name OK
|
|
FSPEC_PATHOK = 0x4, // File Path OK
|
|
FSPEC_ROOTOK = 0x8, // File Drive or computer OK
|
|
FSPEC_RELATIVEPATH = 0x10 // Path is relative
|
|
};
|
|
|
|
class CFilePath
|
|
{
|
|
public:
|
|
bool IsFileValid(const char* szFileSpec, const char *szFileTypeExt, CString* pcsError);
|
|
BOOL FileExists();
|
|
const CString GetFileNameExt();
|
|
int ParseFilePathAndName(char *szPathAndName);
|
|
void Clear();
|
|
const char* GetFileExtension();
|
|
const char* GetFileName();
|
|
const char* GetFullFilePathAndName();
|
|
bool IsFileType(char *szFileTypeExt);
|
|
bool IsPathComplete(int *pFlgValid);
|
|
int SetFile(char *szNewFile, int *nNext);
|
|
bool IsAllValidChars(char* szInString, int* pnPosBad);
|
|
int SetDir(char *szNewDir, int* nNext);
|
|
int SetDrive(int nDriveAis1);
|
|
int SetDriveOrResource(char *szNewDrive, int* nNext);
|
|
int SetExtension(char *szNewExt);
|
|
int SetFullFilePathAndName(char* szPathAndName);
|
|
// int SetFullFilePathAndName(const char* szPathAndName);
|
|
void operator =(const CFilePath &src);
|
|
CFilePath();
|
|
virtual ~CFilePath();
|
|
|
|
protected:
|
|
char* FindLastDir(char *pStrDir);
|
|
char* FindNextDir(char* pStrDir);
|
|
int BuildFullPath();
|
|
int Status;
|
|
bool AllocString(char **pChar, long nSize);
|
|
int FreeMem(void** pMem);
|
|
char* szFullPathNameExt;
|
|
char* szRootDrvOrComp;
|
|
char* szDir;
|
|
char* szName;
|
|
char* szExt;
|
|
};
|
|
|
|
#endif // !defined(AFX_FILEPATH_H__A46C856A_61D3_4A43_A232_12CBDE99D7BE__INCLUDED_)
|