diff --git a/ZCppMain/ZMainHead.H b/ZCppMain/ZMainHead.H index d496a65..68143c1 100644 --- a/ZCppMain/ZMainHead.H +++ b/ZCppMain/ZMainHead.H @@ -3871,8 +3871,20 @@ namespace ZNsMain #include long long int wcstoll(const wchar_t *nptr, wchar_t **endptr, int base); + ******************************************************************************* + # https://learn.microsoft.com/ko-kr/cpp/c-runtime-library/reference/strtoll-strtoll-l-wcstoll-wcstoll-l?view=msvc-170 + base가 0 인 경우에는 strSource 에서 가리키는 문자열의 초기 문자를 사용하 여 + 밑을 결정합니다. 첫 번째 문자가 '0' 이고 두 번째 문자가 'x' 또는 'X' 가 아닌 + 경우 문자열은 8진수 정수로 해석됩니다. 첫 번째 문자가 '0' 이고 두 번째 문자 + 가 'x' 또는 'X'이면 문자열은 16진수 정수로 해석됩니다. + 첫 번째 문자가 '1'~'9' 이면 문자열은 10진수 정수로 해석됩니다. + 문자 'a'~'z' 또는 'A'~'Z'에는 값 10~35가 할당됩니다. 할당된 값이 base 보다 + 작은 문자만 사용할 수 있습니다. 밑의 범위를 벗어난 첫 번째 문자가 발견되면 + 검색이 중지됩니다. 예를 들어 base 가 0 인데 처음 검색된 문자가 '0' 이면 문 + 자열은 8진수 정수로 간주되며 '8' 또는 '9' 문자가 발견되면 검색은 중지됩니다. + ******************************************************************************* float wcstof ( const wchar_t* str, wchar_t** str_end ); (since C++11) double wcstod ( const wchar_t* str, wchar_t** str_end ); long double wcstold( const wchar_t* str, wchar_t** str_end ); (since C++11) diff --git a/ZCppMain/ZMainHeadEx.H b/ZCppMain/ZMainHeadEx.H index 3833bd0..4e38f49 100644 --- a/ZCppMain/ZMainHeadEx.H +++ b/ZCppMain/ZMainHeadEx.H @@ -3987,8 +3987,8 @@ namespace ZNsMain if(VI_Index<0) return ARR_CStringExt; - return ARR_CStringExt( - APC_FileName+VI_Index+1, AI_Length-(VI_Index+1)); + return ARR_CStringExt + ( APC_FileName+VI_Index+1, AI_Length-(VI_Index+1) ); }/* template /////////////// static TString& GetExtName @@ -4000,19 +4000,23 @@ namespace ZNsMain ///////////////////////////////////////////////////////////*/ - template static bool SetExtName( - const TTypChar* APC_FileName, ZTypLength AI_FileLen , - const TTypChar* APC_FileExt , ZTypLength AI_ExtLength, - TString& ARR_CStringFileNew - /*#########*/ ) /*#################################################*/ + template static bool SetExtName + ( + const TTypChar* APC_FileName, ZTypLength AI_FileLen , + const TTypChar* APC_FileExt , ZTypLength AI_ExtLength, + TString& ARR_CStringFileNew + ) + /*################################################################*/ { // APC_FileName 의 확장자를 APC_FileExt 으로 바꾼 // 새로운 파일명을 ARR_CStringFileNew 에 전달한다. - ZTypLength VL_ExtPos=ZCMainChars::FindPosFromEnd( - APC_FileName, ".", - AI_FileLen ,(ZTypLength)1 - /*/////////*/ ); //////////////////////////////// + ZTypLength VL_ExtPos=ZCMainChars::FindPosFromEnd + ( + APC_FileName, TTypChar(".") , + AI_FileLen , (ZTypLength)1 + ); + /**********************************************/ if(VL_ExtPos<0 || VL_ExtPos==AI_FileLen-1) { @@ -4027,34 +4031,54 @@ namespace ZNsMain }/* else if(VL_ExtPos==0)*/ - ARR_CStringFileNew.append(APC_FileName, VL_ExtPos ); - ARR_CStringFileNew+="."; - ARR_CStringFileNew.append(APC_FileExt , AI_ExtLength); + ARR_CStringFileNew.append(APC_FileName , VL_ExtPos ); + ARR_CStringFileNew.append(TTypChar('.') ); + ARR_CStringFileNew.append(APC_FileExt , AI_ExtLength ); return true; }/* - template static bool SetExtName( - const TTypChar* APC_FileName, ZTypLength AI_FileLen , - const TTypChar* APC_FileExt , ZTypLength AI_ExtLength, - TString& ARR_CStringFileNew - ############# ) ###################################################*/ + template static bool SetExtName + ( + const TTypChar* APC_FileName, ZTypLength AI_FileLen , + const TTypChar* APC_FileExt , ZTypLength AI_ExtLength, + TString& ARR_CStringFileNew + ) + ##################################################################*/ template static bool SetExtName( const TString& AR_CStringFileNow, const TString& AR_CStringNewExt, TString& ARR_CStringFileNew) { - return SetExtName( ///////////////////////////// - AR_CStringFileNow.c_str(), - AR_CStringFileNow.size() , - AR_CStringNewExt.c_str() , - AR_CStringNewExt.size() , - RR(ARR_CStringFileNew) - /*//////////*/ ); ////////////////////////////// + return SetExtName /**************/ + ( + AR_CStringFileNow.data() , + AR_CStringFileNow.size() , + AR_CStringNewExt .data() , + AR_CStringNewExt .size() , + RR(ARR_CStringFileNew) + ); + /********************************/ }/* template static bool SetExtName( const TString& AR_CStringFileNow, const TString& AR_CStringNewExt, TString& ARR_CStringFileNew) */ + template static bool SetExtName + ( + const TCharView& AR_FileName, const TCharView& AR_FileExt, TString& ARR_CStringFileNew + ) + /*#################################################################*/ + { + return SetExtName /***************************/ + ( + AR_FileName.data(), AR_FileName.size(), + AR_FileExt .data(), AR_FileExt .size() + ); + /*********************************************/ + } + /*#################################################################*/ + + template static bool SetFileName ( const TTypChar* APC_FileNow, ZTypLength AI_FileNowLen, @@ -4066,10 +4090,11 @@ namespace ZNsMain /* 파일 APC_FileNow 의 확장자를 뺀 부분을 APC_FileNew 으로 바꾼, 새로운 파일명을 ARR_CStringFileNew 에 전달한다. */ - ZTypLength VL_ExtPos=ZCMainChars::FindPos( ///////// - APC_FileNow , ".", - AI_FileNowLen, 1 - /*/////////*/ ); ////////////////////////////////// + ZTypLength VL_ExtPos=ZCMainChars::FindPos + ( + APC_FileNow , ".", AI_FileNowLen, 1 + ); + /***************************************/ if(VL_ExtPos<0) { ARR_CStringFileNew.append(APC_FileNew, AI_FileNewLen); return false; } @@ -4078,7 +4103,7 @@ namespace ZNsMain /*else if(VL_ExtPos==0)*/ ARR_CStringFileNew.append(APC_FileNew, AI_FileNewLen); - ARR_CStringFileNew+="."; + ARR_CStringFileNew.append('.'); if(VL_ExtPos static bool SetFileName ( @@ -4103,13 +4126,13 @@ namespace ZNsMain template static bool SetFileName( const TString& AR_CStringFileNow, const TString& AR_CStringNewExt, TString& ARR_CStringFileNew) { - return SetFileName( /////////////////////////// - AR_CStringFileNow.data(), - AR_CStringFileNow.size(), - AR_CStringNewExt .data(), - AR_CStringNewExt .size(), - RR(ARR_CStringFileNew) - /*//////////*/ ); ///////////////////////////// + return SetFileName /**************************************/ + ( + AR_CStringFileNow.data(), AR_CStringFileNow.size(), + AR_CStringNewExt .data(), AR_CStringNewExt .size(), + RR(ARR_CStringFileNew) + ); + /*********************************************************/ }/* template static bool SetFileName( const TString& AR_CStringFileNow, const TString& AR_CStringNewExt, TString& ARR_CStringFileNew) */ @@ -4144,13 +4167,12 @@ namespace ZNsMain return APC_PathName+VL_FindPos+1; }/* - template - static const TTypChar* GetFileNameInPath /////////////////////// - ( - const TTypChar* APC_PathName, - ZTypLength AI_Length , - ZTypLength& ARRI_FileName - ) + template static const TTypChar* GetFileNameInPath + ( + const TTypChar* APC_PathName, + ZTypLength AI_Length , + ZTypLength& ARRI_FileName + ) //////////////////////////////////////////////////////////////////*/ template @@ -4179,7 +4201,7 @@ namespace ZNsMain static TString& GetFileNameInPath(const TChars& AR_PathName, TString& ARR_FileNameCStr) */ - static bool RmAnyDir /*###############################################################*/ + static bool RmAnyDir /////////////////////////////////////////////////////////////////// ( ZTypCPCh AP_DirName, void (*APF_ExceptHandle) ( ZTypCPCh AP_FileName, ZCFileData& AR_CFileData, ZTypCPCCh AP_Message @@ -4466,7 +4488,7 @@ namespace ZNsMain #endif //!defined(_WIN) && !defined(_REENTRANT) }/* - static bool RmAnyDir ################################################################@# + static bool RmAnyDir ////////////////////////////////////////////////////////////////// ( ZTypCPCh AP_DirName , void (*APF_ExceptHandle) @@ -5027,7 +5049,7 @@ namespace ZNsMain ZCFileData VO_CFileData; #if defined(_REENTRANT) && !defined(_NO_USE_REEDDIR_R_) - dirent VO_DirEnt; + dirent VO_DirEnt ; #endif dirent* VP_DirEnt; TypeDirID VH_File= ::opendir(APC_DirPath); @@ -7360,6 +7382,9 @@ namespace ZNsMain if(AL_Offset<0) AL_Offset=0; + typedef ZtCCharType ZCCharType; + typedef typename ZCCharType::TypeChar Typechar ; + #ifndef _WIN int AH_FileDesc = ::open @@ -7401,13 +7426,15 @@ namespace ZNsMain if((VL_ReadSize = ::read(AH_FileDesc, VP_CopyStart, VL_LastPos))<0) { - ARR_SaveCStr.resize(VL_PrevSize, ' '); ::close(AH_FileDesc); return true; + ARR_SaveCStr.resize(VL_PrevSize, Typechar(0)); + + ::close(AH_FileDesc); return true; /*********/ } /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ - ARR_SaveCStr.resize(VL_PrevSize+VL_ReadSize, ' '); + ARR_SaveCStr.resize(VL_PrevSize+VL_ReadSize, Typechar(0)); - ::close(AH_FileDesc); return true; /*:::::::::::*/ + ::close(AH_FileDesc); return true; /*********************/ #else //defined(_WIN) @@ -7448,17 +7475,17 @@ namespace ZNsMain if(::ReadFile(VH_File, (LPVOID)VP_CopyStart, dwRead, &dwRead2, NULL)==FALSE) { - ARR_SaveCStr.resize(VL_PrevSize+dwRead2, ' '); + ARR_SaveCStr.resize(VL_PrevSize+dwRead2, Typechar(0)); - ::CloseHandle(VH_File); return false; + ::CloseHandle(VH_File); return false; /**************/ } /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ ::CloseHandle(VH_File); if(dwRead2>0) - ARR_SaveCStr.resize(VL_PrevSize+dwRead2, ' '); - else ARR_SaveCStr.resize(VL_PrevSize , ' '); + ARR_SaveCStr.resize(VL_PrevSize+dwRead2, Typechar(0)); + else ARR_SaveCStr.resize(VL_PrevSize , Typechar(0)); return true; diff --git a/ZCppMain/ZtCStringEx.H b/ZCppMain/ZtCStringEx.H index 3838b65..897ce46 100644 --- a/ZCppMain/ZtCStringEx.H +++ b/ZCppMain/ZtCStringEx.H @@ -5652,10 +5652,8 @@ namespace ZNsMain if(AB_DoAppend==true) - ::SetFilePointer(VH_File, 0, NULL, FILE_END); // 덧붙이는 경우라면 파일포인터를 맨 끝으로 옮긴다. - else - ::SetEndOfFile(VH_File) ; // 덧붙이는 경우가 아니면, 기존 내용을 지운다. - //else + ::SetFilePointer(VH_File, 0, NULL, FILE_END); // 덧붙이는 경우라면 파일포인터를 맨 끝으로 옮긴다. + else ::SetEndOfFile (VH_File) ; // 덧붙이는 경우가 아니면, 기존 내용을 지운다. TypeLength VL_AllSize = ml_UseLen*sizeof(TypeChar); @@ -5728,69 +5726,62 @@ namespace ZNsMain bool WriteFile(const ZCStringBase& AR_FileName, EWriteFile AE_EWriteFile, int AI_RightMode=-1) const*/ - static TypeLength FindPos( /////////////////////////////////////// - TypeCharC* APC_Origin , - TypeCharC* APC_Search , - TypeLength AL_OriginLen , - TypeLength AL_SearchLen , - TypeLength AL_StartPos=0 - /*/////////*/ ) ////////////////////////////////////////////////// + static TypeLength FindPos //////////////////////////////////////// + ( + TypeCharC* APC_Origin , TypeCharC* APC_Search , + TypeLength AL_OriginLen , TypeLength AL_SearchLen , + TypeLength AL_StartPos=0 + ) + /*##############################################################*/ { - return ZCMainChars::FindPos( //////// - APC_Origin , - APC_Search , - AL_OriginLen, - AL_SearchLen, - AL_StartPos - /*/////////*/ ); //////////////////// - }/* - static TypeLength FindPos( /////////////////////////////////////// - TypeCharC* APC_Origin , - TypeCharC* APC_Search , - TypeLength AL_OriginLen , - TypeLength AL_SearchLen , - TypeLength AL_StartPos=0 - ///////////// ) ///////////////////////////////////////////////*/ + return ZCMainChars::FindPos /*************/ + ( + APC_Origin , APC_Search , + AL_OriginLen, AL_SearchLen, + AL_StartPos + ); + /*****************************************/ + } + /*##############################################################*/ - static TypeLength FindPos( /////////////////////////////////////// - TypeCharC* APC_Origin , - TypeCharC* APC_Search , - TypeLength AL_StartPos=0 - /*//////////*/ ) ///////////////////////////////////////////////// + static TypeLength FindPos //////////////////////////////////////// + ( + TypeCharC* APC_Origin , + TypeCharC* APC_Search , + TypeLength AL_StartPos=0 + ) + /*##############################################################*/ { return FindPos /////////////////////////////////////////////// ( - APC_Origin , - APC_Search , - GetLength(APC_Origin) , - GetLength(APC_Search) , + APC_Origin , APC_Search , + GetLength(APC_Origin) , GetLength(APC_Search) , AL_StartPos ); ////////////////////////////////////////////////////////////// - }/* - static TypeLength FindPos( /////////////////////////////////////// - TypeCharC* APC_Origin , - TypeCharC* APC_Search , - TypeLength AL_StartPos=0 - ///////////// ) ////////////////////////////////////////////////*/ + } + /*##############################################################*/ - - TypeLength FindPos( - TypeCharC* APC_Search, TypeLength AL_SearchLen, TypeLength AL_StartPos=0) const + TypeLength FindPos /////////////////////////////////////////////// + ( + TypeCharC* APC_Search , + TypeLength AL_SearchLen , + TypeLength AL_StartPos=0 + ) const + /*##############################################################*/ { - return FindPos(mpc_Data, APC_Search, ml_UseLen, AL_SearchLen, AL_StartPos) ; - }/* - TypeLength FindPos( - TypeCharC* APC_Search, TypeLength AL_SearchLen, TypeLength AL_StartPos=0) const*/ + return FindPos + (mpc_Data, APC_Search, ml_UseLen, AL_SearchLen, AL_StartPos) ; + } + /*##############################################################*/ TypeLength FindPos(TypeCharC* APC_Search) const { - return FindPos ////////////// + return FindPos /*********************************************/ ( - mpc_Data , APC_Search, - ml_UseLen, GetLength(APC_Search) + mpc_Data , APC_Search, ml_UseLen, GetLength(APC_Search) ); - ///////////////////////////// + /************************************************************/ }/* TypeLength FindPos(TypeCharC* APC_Search) const*/ @@ -5839,8 +5830,11 @@ namespace ZNsMain } /*############################################################################*/ - TypeLength FindPosEsc( - TypeCharC* APC_Search, TypeCharC* APC_Escape, TypeLength AL_StartPos=0) const + TypeLength FindPosEsc ////////////////////////////////////////////////////////// + ( + TypeCharC* APC_Search, TypeCharC* APC_Escape, TypeLength AL_StartPos=0 + ) const + /*############################################################################*/ { return ZCMainChars::FindPosEsc ( @@ -5850,17 +5844,16 @@ namespace ZNsMain GetLength(APC_Escape) , AL_StartPos ); ////////////////////////////// - }/* - TypeLength FindPosEsc( - TypeCharC* APC_Search, TypeCharC* APC_Escape, TypeLength AL_StartPos=0) const*/ + } + /*############################################################################*/ - static TypeLength FindPosFromEnd( //////////////////////////////// - TypeCharC* APC_Origin , - TypeCharC* APC_Search , - TypeLength AL_OriginLen, - TypeLength AL_SearchLen - /*/////////*/ ) ////////////////////////////////////////////////// + static TypeLength FindPosFromEnd /////////////////////////////////////////////// + ( + TypeCharC* APC_Origin , TypeCharC* APC_Search , + TypeLength AL_OriginLen, TypeLength AL_SearchLen + ) + /*############################################################################*/ { // APC_Origin 문자열에서 APC_Search 을 AL_StartPos 번째 부터 역방향으로 접근해서 찾는다. @@ -5881,13 +5874,8 @@ namespace ZNsMain while(i>=0)*/ return -1; - }/* - static TypeLength FindPosFromEnd( //////////////////////////////// - TypeCharC* APC_Origin , - TypeCharC* APC_Search , - TypeLength AL_OriginLen, - TypeLength AL_SearchLen - //////////// ) ////////////////////////////////////////////////*/ + } + /*############################################################################*/ TypeLength FindPosFromEnd(TypeCharC* APC_Search, TypeLength AL_SearchLen, TypeLength AL_StartPos) const @@ -5979,32 +5967,32 @@ namespace ZNsMain return -1; }/* - template static TypeLength FindPosByList( ######## - TypeCharC* APC_Origin , - TList& AR_SearchList, - TypeLength AL_OriginLen , - TypeLength& ARRL_MatchLen, - TypeLength AL_StartPos=0 - ########### ) ################################################*/ + template static TypeLength FindPosByList + ( + TypeCharC* APC_Origin , + TList& AR_SearchList , + TypeLength AL_OriginLen , + TypeLength& ARRL_MatchLen , + TypeLength AL_StartPos=0 + ) + ######################################################*/ - template static TypeLength FindPosByList( /*####*/ - TypeCharC* APC_Origin , - TList& AR_SearchList, - TypeLength& ARRL_MatchLen - /*#########*/ ) /*##############################################*/ + template static TypeLength FindPosByList /////////////////////// + ( + TypeCharC* APC_Origin , + TList& AR_SearchList, + TypeLength& ARRL_MatchLen + ) + /*############################################################################*/ { return FindPosByList ( APC_Origin, AR_SearchList, GetLength(APC_Origin), ARRL_MatchLen ); ////////////////// - }/* - template static TypeLength FindPosByList( ######## - TypeCharC* APC_Origin , - TList& AR_SearchList, - TypeLength& ARRL_MatchLen - ############ ) ################################################*/ + } + /*############################################################################*/ template static TypeLength @@ -6037,7 +6025,7 @@ namespace ZNsMain TypeLength GetMatchLenFromEnd(TypeCharC* APC_Search, TypeLength AL_SearchLen)*/ - static TypeLength GetFindCnt /*#######################*/ + static TypeLength GetFindCnt /////////////////////////// ( TypeCharC* APC_Origin , TypeCharC* APC_Search, TypeLength AL_OriginLen, TypeLength AL_SearchLen @@ -6064,7 +6052,7 @@ namespace ZNsMain return VL_SearchCount; }/* - static TypeLength GetFindCnt ########################### + static TypeLength GetFindCnt /////////////////////////// ( TypeCharC* APC_Origin , TypeCharC* APC_Search, TypeLength AL_OriginLen, TypeLength AL_SearchLen @@ -6098,13 +6086,8 @@ namespace ZNsMain /////////////////////////////////////////////////////////////////////////////////// { return FindPos(APC_Origin, APC_FindChars, AL_OriginLen, AL_FindLen, AL_StartPos)>=0; - }/* - static bool DoHave //////////////////////////////////////////////////////////////// - ( - TypeCharC* APC_Origin , TypeCharC* APC_FindChars, - TypeLength AL_OriginLen, TypeLength AL_FindLen , TypeLength AL_StartPos=0 - ) - /////////////////////////////////////////////////////////////////////////////////*/ + } + /*###############################################################################*/ static bool DoHave(TypeCharC* APC_Origin, TypeCharC* APC_FindChars, TypeLength AL_StartPos=0) { @@ -6154,7 +6137,7 @@ namespace ZNsMain if(i==AL_CheckLen-1) return false; if(VB_DoHavePeriod ) return false; - VB_DoHavePeriod=true; /*########*/ + VB_DoHavePeriod=true; /*::::::::*/ } else if(VC_CharTemp<'0' || VC_CharTemp>'9') { @@ -6185,12 +6168,12 @@ namespace ZNsMain bool IsDigit() const*/ - static bool DoStart + static bool DoStart //////////////////////////////////////////////// ( TypeCharC* APC_Origin , TypeCharC* APC_FindChars, TypeLength AL_OriginLen, TypeLength AL_FindLen ) - /*###############*/ + /*################################################################*/ { // APC_Origin 문자열이 APC_FindChars 로 시작하면 true; @@ -6199,24 +6182,17 @@ namespace ZNsMain return ZCMainChars::Minus( APC_Origin, APC_FindChars, AL_FindLen, AL_FindLen)==0 ; - }/* - static bool DoStart - ( - TypeCharC* APC_Origin , TypeCharC* APC_FindChars, - TypeLength AL_OriginLen, TypeLength AL_FindLen - ) - /////////////////*/ + } + /*################################################################*/ static bool DoStart(TypeCharC* APC_Origin, TypeCharC* APC_FindChars) { - return DoStart //////////////////////////////// + return DoStart /*****************************************/ ( - APC_Origin - , APC_FindChars - , GetLength(APC_Origin ) - , GetLength(APC_FindChars) + APC_Origin , APC_FindChars + , GetLength(APC_Origin ), GetLength(APC_FindChars) ); - /////////////////////////////////////////////// + /********************************************************/ }/* static bool DoStart(TypeCharC* APC_Origin, TypeCharC* APC_FindChars)*/ @@ -6230,11 +6206,7 @@ namespace ZNsMain bool DoStart(TypeCharC* APC_FindChars) const { - return DoStart - ( - APC_FindChars, GetLength(APC_FindChars) - ); - ////////////// + return DoStart( APC_FindChars, GetLength(APC_FindChars) ); }/* bool DoStart(TypeCharC* APC_FindChars) const*/ @@ -6263,7 +6235,7 @@ namespace ZNsMain ( mpc_Data, APC_FindChars, ml_UseLen, GetLength(APC_FindChars) ); - /////////////////////////// + /*************************/ }/* bool DoClose(TypeCharC* APC_FindChars) const*/ @@ -6293,7 +6265,7 @@ namespace ZNsMain ( mpc_Data, APC_FindChars, ml_UseLen, GetLength(APC_FindChars) ); - ////////////////////////// + /************************/ }/* bool DoWrap(TypeCharC* APC_FindChars) const*/