Skip to content

Commit e30a830

Browse files
committed
Remove "using std::wstring"
1 parent 897b26b commit e30a830

6 files changed

Lines changed: 111 additions & 124 deletions

File tree

sakura_core/prop/CPropComMainMenu.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#include "config/app_constants.h"
2424
#include "String_define.h"
2525

26-
using std::wstring;
27-
2826
// TreeView 表示固定初期値
2927

3028
static const DWORD p_helpids[] = {
@@ -53,7 +51,7 @@ static const DWORD p_helpids[] = {
5351
// 内部使用変数
5452
// 機能格納(Work)
5553
struct SMainMenuWork {
56-
wstring m_sName; // 名前
54+
std::wstring m_sName; // 名前
5755
EFunctionCode m_nFunc; // Function
5856
WCHAR m_sKey[2]; // アクセスキー
5957
bool m_bDupErr; // アクセスキー重複エラー
@@ -754,7 +752,7 @@ INT_PTR CPropMainMenu::DispatchEvent(
754752

755753
case IDC_BUTTON_CHECK: // メニューの検査
756754
{
757-
wstring sErrMsg;
755+
std::wstring sErrMsg;
758756
if (Check_MainMenu( hwndTreeRes, sErrMsg )) {
759757
InfoMessage( hwndDlg, LS(STR_PROPCOMMAINMENU_OK));
760758
}
@@ -810,10 +808,10 @@ INT_PTR CPropMainMenu::DispatchEvent(
810808
}
811809

812810
// & の補完
813-
static wstring SupplementAmpersand( wstring sLavel)
811+
static std::wstring SupplementAmpersand( std::wstring sLavel)
814812
{
815813
size_t nPos =0;
816-
while ((nPos = sLavel.find( L'&', nPos)) != wstring::npos) {
814+
while ((nPos = sLavel.find( L'&', nPos)) != std::wstring::npos) {
817815
if (sLavel[nPos+1] != L'&') {
818816
// &&でない
819817
sLavel.replace( nPos, 1, L"&&");
@@ -824,10 +822,10 @@ static wstring SupplementAmpersand( wstring sLavel)
824822
}
825823

826824
// & の削除
827-
static wstring RemoveAmpersand( wstring sLavel)
825+
static std::wstring RemoveAmpersand( std::wstring sLavel)
828826
{
829827
size_t nPos =0;
830-
while ((nPos = sLavel.find( L'&', nPos)) != wstring::npos) {
828+
while ((nPos = sLavel.find( L'&', nPos)) != std::wstring::npos) {
831829
if (sLavel[nPos+1] == L'&') {
832830
// &&
833831
sLavel.replace( nPos, 1, L"");
@@ -1181,7 +1179,7 @@ static const WCHAR* MakeDispLabel( SMainMenuWork* pFunc )
11811179
// メニューの検査
11821180
bool CPropMainMenu::Check_MainMenu(
11831181
HWND hwndTree, // handle to TreeView
1184-
wstring& sErrMsg // エラーメッセージ
1182+
std::wstring& sErrMsg // エラーメッセージ
11851183
)
11861184
{
11871185
HTREEITEM htiItem;
@@ -1199,7 +1197,7 @@ bool CPropMainMenu::Check_MainMenu_Sub(
11991197
HWND hwndTree, // handle to dialog box
12001198
HTREEITEM htiTrg, // ターゲット
12011199
int nLevel,
1202-
wstring& sErrMsg )
1200+
std::wstring& sErrMsg )
12031201
{
12041202
// 検査用
12051203
static bool bOptionOk; // 「共通設定」

sakura_core/typeprop/CDlgTypeAscertain.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
#define SAKURA_CDLGTYPEASCERTAIN_7000A035_D26C_4FB2_AE75_6A63F3F806B9_H_
1616
#pragma once
1717

18-
class CDlgTypeAscertain;
19-
20-
using std::wstring;
21-
2218
#include "dlg/CDialog.h"
2319
/*-----------------------------------------------------------------------
2420
クラスの宣言
@@ -31,12 +27,12 @@ class CDlgTypeAscertain final : public CDialog
3127
public:
3228
//
3329
struct SAscertainInfo {
34-
wstring sImportFile; //!< in インポートファイル名
35-
wstring sTypeNameTo; //!< in タイプ名(インポート先)
36-
wstring sTypeNameFile; //!< in タイプ名(ファイルから)
37-
int nColorType; //!< out 文書種類(カラーコピー用)
38-
wstring sColorFile; //!< out 色設定ファイル名
39-
bool bAddType; //!< out タイプを追加する
30+
std::wstring sImportFile; //!< in インポートファイル名
31+
std::wstring sTypeNameTo; //!< in タイプ名(インポート先)
32+
std::wstring sTypeNameFile; //!< in タイプ名(ファイルから)
33+
int nColorType; //!< out 文書種類(カラーコピー用)
34+
std::wstring sColorFile; //!< out 色設定ファイル名
35+
bool bAddType; //!< out タイプを追加する
4036
};
4137

4238
public:

sakura_core/typeprop/CDlgTypeList.cpp

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,14 @@
3535
#include "config/app_constants.h"
3636
#include "String_define.h"
3737

38-
using std::wstring;
39-
4038
#define BUFFER_SIZE 1024
4139
#define ACTION_NAME (L"SakuraEditor")
4240
#define PROGID_BACKUP_NAME (L"SakuraEditorBackup")
4341
#define ACTION_BACKUP_PATH (L"\\ShellBackup")
4442

4543
//関数プロトタイプ
46-
int CopyRegistry(HKEY srcRoot, const wstring& srcPath, HKEY destRoot, const wstring& destPath);
47-
int DeleteRegistry(HKEY root, const wstring& path);
44+
int CopyRegistry(HKEY srcRoot, const std::wstring& srcPath, HKEY destRoot, const std::wstring& destPath);
45+
int DeleteRegistry(HKEY root, const std::wstring& path);
4846
int RegistExt(LPCWSTR sExt, bool bDefProg);
4947
int UnregistExt(LPCWSTR sExt);
5048
int CheckExt(LPCWSTR sExt, bool *pbRMenu, bool *pbDblClick);
@@ -252,15 +250,15 @@ INT_PTR CDlgTypeList::DispatchEvent( HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM
252250
{
253251
WCHAR buf[BUFFER_SIZE] = {0};
254252
::FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, NULL, nRet, 0, buf, _countof(buf), NULL );
255-
::MessageBox( GetHwnd(), (wstring(LS(STR_DLGTYPELIST_ERR1)) + buf).c_str(), GSTR_APPNAME, MB_OK );
253+
::MessageBox( GetHwnd(), (std::wstring(LS(STR_DLGTYPELIST_ERR1)) + buf).c_str(), GSTR_APPNAME, MB_OK );
256254
break;
257255
}
258256
}else{ //「右クリック」チェックOFF
259257
if( (nRet = UnregistExt( ext )) != 0 )
260258
{
261259
WCHAR buf[BUFFER_SIZE] = {0};
262260
::FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, NULL, nRet, 0, buf, _countof(buf), NULL );
263-
::MessageBox( GetHwnd(), (wstring(LS(STR_DLGTYPELIST_ERR2)) + buf).c_str(), GSTR_APPNAME, MB_OK );
261+
::MessageBox( GetHwnd(), (std::wstring(LS(STR_DLGTYPELIST_ERR2)) + buf).c_str(), GSTR_APPNAME, MB_OK );
264262
break;
265263
}
266264
}
@@ -290,7 +288,7 @@ INT_PTR CDlgTypeList::DispatchEvent( HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM
290288
{
291289
WCHAR buf[BUFFER_SIZE] = {0};
292290
::FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, NULL, nRet, 0, buf, _countof(buf), NULL );
293-
::MessageBox( GetHwnd(), (wstring(LS(STR_DLGTYPELIST_ERR1)) + buf).c_str(), GSTR_APPNAME, MB_OK );
291+
::MessageBox( GetHwnd(), (std::wstring(LS(STR_DLGTYPELIST_ERR1)) + buf).c_str(), GSTR_APPNAME, MB_OK );
294292
break;
295293
}
296294
}
@@ -714,7 +712,7 @@ bool CDlgTypeList::DelType()
714712
}
715713

716714
/*! 再帰的レジストリコピー */
717-
int CopyRegistry(HKEY srcRoot, const wstring& srcPath, HKEY destRoot, const wstring& destPath)
715+
int CopyRegistry(HKEY srcRoot, const std::wstring& srcPath, HKEY destRoot, const std::wstring& destPath)
718716
{
719717
int errorCode;
720718
CRegKey keySrc;
@@ -767,7 +765,7 @@ int CopyRegistry(HKEY srcRoot, const wstring& srcPath, HKEY destRoot, const wstr
767765
}
768766

769767
/*! 再帰的レジストリ削除 */
770-
int DeleteRegistry(HKEY root, const wstring& path)
768+
int DeleteRegistry(HKEY root, const std::wstring& path)
771769
{
772770
int errorCode;
773771
CRegKey keySrc;
@@ -827,15 +825,15 @@ int DeleteRegistry(HKEY root, const wstring& path)
827825
int RegistExt(LPCWSTR sExt, bool bDefProg)
828826
{
829827
int errorCode = ERROR_SUCCESS;
830-
wstring sBasePath = wstring( L"Software\\Classes\\" );
828+
std::wstring sBasePath = std::wstring( L"Software\\Classes\\" );
831829

832830
//小文字化
833831
WCHAR szLowerExt[MAX_PATH] = {0};
834832
wcsncpy_s(szLowerExt, sExt, _TRUNCATE);
835833
CharLower(szLowerExt);
836834

837-
wstring sDotExt = sBasePath + L"." + szLowerExt;
838-
wstring sGenProgID = wstring() + L"SakuraEditor_" + szLowerExt;
835+
std::wstring sDotExt = sBasePath + L"." + szLowerExt;
836+
std::wstring sGenProgID = std::wstring() + L"SakuraEditor_" + szLowerExt;
839837

840838
CRegKey keyExt_HKLM;
841839
WCHAR szProgID_HKLM[ BUFFER_SIZE ] = {0};
@@ -861,7 +859,7 @@ int RegistExt(LPCWSTR sExt, bool bDefProg)
861859
if( (errorCode = keyExt.SetValue(NULL, sGenProgID.c_str())) != 0 ){ return errorCode; }
862860
}
863861

864-
wstring sProgIDPath = sBasePath + sGenProgID;
862+
std::wstring sProgIDPath = sBasePath + sGenProgID;
865863
if( ! CRegKey::ExistsKey(HKEY_CURRENT_USER, sProgIDPath.c_str()) )
866864
{
867865
if( szProgID_HKLM[0] != L'\0' )
@@ -870,10 +868,10 @@ int RegistExt(LPCWSTR sExt, bool bDefProg)
870868
}
871869
}
872870

873-
wstring sShellPath = sProgIDPath + L"\\shell";
874-
wstring sShellActionPath = sShellPath + L"\\" + ACTION_NAME;
875-
wstring sShellActionCommandPath = sShellActionPath + L"\\command";
876-
wstring sBackupPath = sShellActionPath + ACTION_BACKUP_PATH;
871+
std::wstring sShellPath = sProgIDPath + L"\\shell";
872+
std::wstring sShellActionPath = sShellPath + L"\\" + ACTION_NAME;
873+
std::wstring sShellActionCommandPath = sShellActionPath + L"\\command";
874+
std::wstring sBackupPath = sShellActionPath + ACTION_BACKUP_PATH;
877875

878876
CRegKey keyShellActionCommand;
879877
if( (errorCode = keyShellActionCommand.Open(HKEY_CURRENT_USER, sShellActionCommandPath.c_str(), KEY_READ | KEY_WRITE)) != 0 )
@@ -883,7 +881,7 @@ int RegistExt(LPCWSTR sExt, bool bDefProg)
883881

884882
WCHAR sExePath[_MAX_PATH] = {0};
885883
::GetModuleFileName( NULL, sExePath, _countof(sExePath) );
886-
wstring sCommandPathArg = wstring() + L"\"" + sExePath + L"\" \"%1\"";
884+
std::wstring sCommandPathArg = std::wstring() + L"\"" + sExePath + L"\" \"%1\"";
887885
if( (errorCode = keyShellActionCommand.SetValue(NULL, sCommandPathArg.c_str())) != 0 ){ return errorCode; }
888886

889887
CRegKey keyShellAction;
@@ -947,14 +945,14 @@ int RegistExt(LPCWSTR sExt, bool bDefProg)
947945
int UnregistExt(LPCWSTR sExt)
948946
{
949947
int errorCode = ERROR_SUCCESS;
950-
wstring sBasePath = wstring( L"Software\\Classes\\" );
948+
std::wstring sBasePath = std::wstring( L"Software\\Classes\\" );
951949

952950
//小文字化
953951
WCHAR szLowerExt[MAX_PATH] = {0};
954952
wcsncpy_s(szLowerExt, sExt, _TRUNCATE);
955953
CharLower(szLowerExt);
956954

957-
wstring sDotExt = sBasePath + L"." + szLowerExt;
955+
std::wstring sDotExt = sBasePath + L"." + szLowerExt;
958956

959957
CRegKey keyExt;
960958
if((errorCode = keyExt.Open(HKEY_CURRENT_USER, sDotExt.c_str(), KEY_READ | KEY_WRITE)) != 0)
@@ -970,10 +968,10 @@ int UnregistExt(LPCWSTR sExt)
970968
return ERROR_SUCCESS;
971969
}
972970

973-
wstring sProgIDPath = sBasePath + szProgID;
974-
wstring sShellPath = sProgIDPath + L"\\shell";
975-
wstring sShellActionPath = sShellPath + L"\\" + ACTION_NAME;
976-
wstring sBackupPath = sShellActionPath + ACTION_BACKUP_PATH;
971+
std::wstring sProgIDPath = sBasePath + szProgID;
972+
std::wstring sShellPath = sProgIDPath + L"\\shell";
973+
std::wstring sShellActionPath = sShellPath + L"\\" + ACTION_NAME;
974+
std::wstring sBackupPath = sShellActionPath + ACTION_BACKUP_PATH;
977975

978976
CRegKey keyShellAction;
979977
if( (errorCode = keyShellAction.Open(HKEY_CURRENT_USER, sShellActionPath.c_str(), KEY_READ | KEY_WRITE)) != 0 )
@@ -1034,7 +1032,7 @@ int UnregistExt(LPCWSTR sExt)
10341032
int CheckExt(LPCWSTR sExt, bool *pbRMenu, bool *pbDblClick)
10351033
{
10361034
int errorCode = ERROR_SUCCESS;
1037-
wstring sBasePath = wstring( L"Software\\Classes\\" );
1035+
std::wstring sBasePath = std::wstring( L"Software\\Classes\\" );
10381036

10391037
*pbRMenu = false;
10401038
*pbDblClick = false;
@@ -1044,7 +1042,7 @@ int CheckExt(LPCWSTR sExt, bool *pbRMenu, bool *pbDblClick)
10441042
wcsncpy_s(szLowerExt, sExt, _TRUNCATE);
10451043
CharLower(szLowerExt);
10461044

1047-
wstring sDotExt = sBasePath + L"." + szLowerExt;
1045+
std::wstring sDotExt = sBasePath + L"." + szLowerExt;
10481046

10491047
CRegKey keyExt;
10501048
if((errorCode = keyExt.Open(HKEY_CURRENT_USER, sDotExt.c_str(), KEY_READ)) != 0)
@@ -1060,8 +1058,8 @@ int CheckExt(LPCWSTR sExt, bool *pbRMenu, bool *pbDblClick)
10601058
return ERROR_SUCCESS;
10611059
}
10621060

1063-
wstring sShellPath = wstring() + L"Software\\Classes\\" + szProgID + L"\\shell";
1064-
wstring sShellActionPath = sShellPath + L"\\" + ACTION_NAME;
1061+
std::wstring sShellPath = std::wstring() + L"Software\\Classes\\" + szProgID + L"\\shell";
1062+
std::wstring sShellActionPath = sShellPath + L"\\" + ACTION_NAME;
10651063
if( ! CRegKey::ExistsKey(HKEY_CURRENT_USER, sShellActionPath.c_str()) )
10661064
{
10671065
return ERROR_SUCCESS;

sakura_core/typeprop/CDlgTypeList.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717
#define SAKURA_CDLGTYPELIST_BF7E3CFF_28C8_4424_ACC3_068C04462C86_H_
1818
#pragma once
1919

20-
class CDlgTypeList;
21-
2220
#include "dlg/CDialog.h"
23-
using std::wstring;
2421

2522
/*-----------------------------------------------------------------------
2623
クラスの宣言

0 commit comments

Comments
 (0)