Removed unused code, added some translations (#114)

* Removed unused code, added some translations

* Fixed typo

* Added translation
This commit is contained in:
uweseimet
2021-06-23 19:26:12 +02:00
committed by GitHub
parent 86aeeb0a31
commit b7011efd95
3 changed files with 16 additions and 101 deletions

View File

@@ -15,24 +15,24 @@
//=========================================================================== //===========================================================================
// //
// ファイルパス // File path
// //
//=========================================================================== //===========================================================================
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// コンストラクタ // Constructor
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
Filepath::Filepath() Filepath::Filepath()
{ {
// クリア // Clear
Clear(); Clear();
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// デストラクタ // Destructor
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
Filepath::~Filepath() Filepath::~Filepath()
@@ -41,12 +41,12 @@ Filepath::~Filepath()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// 代入演算子 // Assignment operator
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
Filepath& Filepath::operator=(const Filepath& path) Filepath& Filepath::operator=(const Filepath& path)
{ {
// パス設定(内部でSplitされる) // Set path (split internally)
SetPath(path.GetPath()); SetPath(path.GetPath());
return *this; return *this;
@@ -54,14 +54,14 @@ Filepath& Filepath::operator=(const Filepath& path)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// クリア // Clear
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void FASTCALL Filepath::Clear() void FASTCALL Filepath::Clear()
{ {
ASSERT(this); ASSERT(this);
// パスおよび各部分をクリア // Clear the path and each part
m_szPath[0] = _T('\0'); m_szPath[0] = _T('\0');
m_szDir[0] = _T('\0'); m_szDir[0] = _T('\0');
m_szFile[0] = _T('\0'); m_szFile[0] = _T('\0');
@@ -79,10 +79,10 @@ void FASTCALL Filepath::SetPath(LPCSTR path)
ASSERT(path); ASSERT(path);
ASSERT(strlen(path) < _MAX_PATH); ASSERT(strlen(path) < _MAX_PATH);
// パス名コピー // Copy pathname
strcpy(m_szPath, (LPTSTR)path); strcpy(m_szPath, (LPTSTR)path);
// 分離 // Split
Split(); Split();
} }
@@ -208,57 +208,8 @@ void FASTCALL Filepath::Split()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// クリアされているか // File name + extension acquisition
// // The returned pointer is temporary. Copy immediately.
//---------------------------------------------------------------------------
BOOL FASTCALL Filepath::IsClear() const
{
// Clear()の逆
if ((m_szPath[0] == _T('\0')) &&
(m_szDir[0] == _T('\0')) &&
(m_szFile[0] == _T('\0')) &&
(m_szExt[0] == _T('\0'))) {
// 確かに、クリアされている
return TRUE;
}
// クリアされていない
return FALSE;
}
//---------------------------------------------------------------------------
//
// ショート名取得
// ※返されるポインタは一時的なもの。すぐコピーすること
// ※FDIDiskのdisk.nameとの関係で、文字列は最大59文字+終端とすること
//
//---------------------------------------------------------------------------
const char* FASTCALL Filepath::GetShort() const
{
char szFile[_MAX_FNAME];
char szExt[_MAX_EXT];
ASSERT(this);
// TCHAR文字列からchar文字列へ変換
strcpy(szFile, m_szFile);
strcpy(szExt, m_szExt);
// 固定バッファへ合成
strcpy(ShortName, szFile);
strcat(ShortName, szExt);
// strlenで調べたとき、最大59になるように細工
ShortName[59] = '\0';
// const charとして返す
return (const char*)ShortName;
}
//---------------------------------------------------------------------------
//
// ファイル名+拡張子取得
// ※返されるポインタは一時的なもの。すぐコピーすること
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
LPCTSTR FASTCALL Filepath::GetFileExt() const LPCTSTR FASTCALL Filepath::GetFileExt() const
@@ -274,22 +225,7 @@ LPCTSTR FASTCALL Filepath::GetFileExt() const
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// パス比較 // Save
//
//---------------------------------------------------------------------------
BOOL FASTCALL Filepath::CmpPath(const Filepath& path) const
{
// パスが完全一致していればTRUE
if (strcmp(path.GetPath(), GetPath()) == 0) {
return TRUE;
}
return FALSE;
}
//---------------------------------------------------------------------------
//
// セーブ
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
BOOL FASTCALL Filepath::Save(Fileio *fio, int /*ver*/) BOOL FASTCALL Filepath::Save(Fileio *fio, int /*ver*/)
@@ -302,7 +238,7 @@ BOOL FASTCALL Filepath::Save(Fileio *fio, int /*ver*/)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// ロード // Load
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
BOOL FASTCALL Filepath::Load(Fileio *fio, int /*ver*/) BOOL FASTCALL Filepath::Load(Fileio *fio, int /*ver*/)
@@ -315,14 +251,7 @@ BOOL FASTCALL Filepath::Load(Fileio *fio, int /*ver*/)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// ショート名 // Filename and extension
//
//---------------------------------------------------------------------------
char Filepath::ShortName[_MAX_FNAME + _MAX_DIR];
//---------------------------------------------------------------------------
//
// ファイル名+拡張子
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
TCHAR Filepath::FileExt[_MAX_FNAME + _MAX_DIR]; TCHAR Filepath::FileExt[_MAX_FNAME + _MAX_DIR];

View File

@@ -15,7 +15,7 @@ class Fileio;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// 定数定義 // Constant definition
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#define FILEPATH_MAX _MAX_PATH #define FILEPATH_MAX _MAX_PATH
@@ -40,17 +40,10 @@ public:
// クリア // クリア
void FASTCALL SetPath(LPCSTR path); void FASTCALL SetPath(LPCSTR path);
// ファイル設定(ユーザ) MBCS用 // ファイル設定(ユーザ) MBCS用
BOOL FASTCALL IsClear() const;
// クリアされているか
LPCTSTR FASTCALL GetPath() const { return m_szPath; } LPCTSTR FASTCALL GetPath() const { return m_szPath; }
// パス名取得 // パス名取得
const char* FASTCALL GetShort() const;
// ショート名取得(const char*)
LPCTSTR FASTCALL GetFileExt() const; LPCTSTR FASTCALL GetFileExt() const;
// ショート名取得(LPCTSTR) // ショート名取得(LPCTSTR)
BOOL FASTCALL CmpPath(const Filepath& path) const;
// パス比較
BOOL FASTCALL Save(Fileio *fio, int ver); BOOL FASTCALL Save(Fileio *fio, int ver);
// セーブ // セーブ
BOOL FASTCALL Load(Fileio *fio, int ver); BOOL FASTCALL Load(Fileio *fio, int ver);
@@ -59,12 +52,8 @@ public:
private: private:
void FASTCALL Split(); void FASTCALL Split();
// パス分割 // パス分割
void FASTCALL SetCurDir();
// カレントディレクトリ設定
TCHAR m_szPath[_MAX_PATH]; TCHAR m_szPath[_MAX_PATH];
// ファイルパス // ファイルパス
TCHAR m_szDrive[_MAX_DRIVE];
// ドライブ
TCHAR m_szDir[_MAX_DIR]; TCHAR m_szDir[_MAX_DIR];
// ディレクトリ // ディレクトリ
TCHAR m_szFile[_MAX_FNAME]; TCHAR m_szFile[_MAX_FNAME];
@@ -72,8 +61,6 @@ private:
TCHAR m_szExt[_MAX_EXT]; TCHAR m_szExt[_MAX_EXT];
// 拡張子 // 拡張子
static char ShortName[_MAX_FNAME + _MAX_DIR];
// ショート名(char)
static TCHAR FileExt[_MAX_FNAME + _MAX_DIR]; static TCHAR FileExt[_MAX_FNAME + _MAX_DIR];
// ショート名(TCHAR) // ショート名(TCHAR)
}; };

View File

@@ -145,7 +145,6 @@ typedef const char *LPCSTR;
#endif #endif
#define _MAX_PATH 260 #define _MAX_PATH 260
#define _MAX_DRIVE 3
#define _MAX_DIR 256 #define _MAX_DIR 256
#define _MAX_FNAME 256 #define _MAX_FNAME 256
#define _MAX_EXT 256 #define _MAX_EXT 256