From 16dcc5199a73426be6a2a2a2c8bb05b00cac1f72 Mon Sep 17 00:00:00 2001 From: sauron Date: Thu, 21 Aug 2025 00:59:39 +0900 Subject: [PATCH] commit 2025-08-21 00:59 edit a bit ZtCStringBase --- ZCppMain/ZtCStringEx.H | 198 +++++++++++++++++++++++++++++++------------------ 1 file changed, 126 insertions(+), 72 deletions(-) diff --git a/ZCppMain/ZtCStringEx.H b/ZCppMain/ZtCStringEx.H index e8caa05..3be9781 100644 --- a/ZCppMain/ZtCStringEx.H +++ b/ZCppMain/ZtCStringEx.H @@ -755,8 +755,8 @@ namespace ZNsMain // 아래 몇 멤버는 STL 의 string 멤버 함수와 이름을 맞추기 위한 것. - TypeChar* data (){return mpc_Data;} - TypeChar* c_str(){return mpc_Data;} + TypeChar* data () {return mpc_Data;} + TypeChar* c_str() {return mpc_Data;} TypeCharC* data () const{return mpc_Data;} TypeCharC* c_str() const{return mpc_Data;} @@ -779,7 +779,7 @@ namespace ZNsMain for(TypeLength i=VL_PrevSize; i>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ mpc_Data[ml_UseLen = AL_NewSize]=0; return *this; }/* @@ -855,11 +855,11 @@ namespace ZNsMain if(ml_UseLen<1 || AL_BuffSize<1) return 0; - TypeLength VL_LoopCnt = /////////// + TypeLength VL_LoopCnt = /*>>>>>>>>>>>>>>*/ ( ml_UseLenAL_Index2 || AL_Index2>=ml_UseLen) { - return *this; /*########################################*/ + return *this; /*@@@@@@@@@*/ }/* - if(AL_Index1<0 || AL_Index1>AL_Index2 || AL_Index2>=ml_UseLen)*/ + >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ if(AL_Index2-1==ml_UseLen) return Invalid(AL_Index1); @@ -915,10 +915,18 @@ namespace ZNsMain { // Invalidate() 와의 차이에 주의 - const bool CB_IsOK = - (AL_Index>=0 && AL_Index<=ml_AllLen && ml_AllLen>0); + const bool CB_IsOK = /*<<<<<<<<<<<<<<<<<*/ + ( + AL_Index >=0 && + AL_Index <= ml_AllLen && + ml_AllLen> 0 + ); + /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ - if(CB_IsOK) mpc_Data[ml_UseLen=AL_Index]=0; return *this; + if(CB_IsOK) + mpc_Data[ml_UseLen=AL_Index]=0; + + return *this; }/* ZCStringBase& InvalidByForce(TypeLength AL_Index=0)*/ @@ -927,10 +935,13 @@ namespace ZNsMain { // APC_Search 를 찾아서 그 부분을 무효화시킨다. - TypeLength VL_Pos = - FindPos(APC_Search, AL_SearchLen ,AL_Index); + TypeLength VL_Pos = FindPos + (APC_Search, AL_SearchLen ,AL_Index); - if(VL_Pos>=0) mpc_Data[ml_UseLen=VL_Pos]=0; return *this; + if(VL_Pos>=0) + mpc_Data[ml_UseLen=VL_Pos]=0; + + return *this; }/* ZCStringBase& InvalidateSearch( TypeCharC* APC_Search, TypeLength AL_SearchLen, TypeLength AL_Index=0)*/ @@ -940,30 +951,47 @@ namespace ZNsMain { // APC_Search 를 뒤로부터 찾아서 그 부분을 무효화시킨다. - TypeLength VL_Pos = - FindPosFromEnd(APC_Search, AL_SearchLen, AL_StartPos); + TypeLength VL_Pos = FindPosFromEnd + ( + APC_Search, AL_SearchLen, AL_StartPos + ); + /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ - if(VL_Pos>=0) mpc_Data[ml_UseLen=VL_Pos]=0; return *this; + if(VL_Pos>=0) + mpc_Data[ml_UseLen=VL_Pos]=0; + + return *this; }/* ZCStringBase& InvalidateSearchFromEnd( TypeCharC* APC_Search, TypeLength AL_SearchLen, TypeLength AL_StartPos)*/ - ZCStringBase& InvalidateSearchFromEnd(TypeCharC* APC_Search, TypeLength AL_SearchLen) + ZCStringBase& InvalidateSearchFromEnd + ( + TypeCharC* APC_Search, TypeLength AL_SearchLen + ) + /*#################################*/ { // APC_Search 를 뒤로부터 찾아서 그 부분을 무효화시킨다. if(ml_UseLen<1) return *this; - - return InvalidateSearchFromEnd( - APC_Search, AL_SearchLen, ml_UseLen-1); + + return InvalidateSearchFromEnd + ( + APC_Search, AL_SearchLen, ml_UseLen-1 + ); + /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ }/* - ZCStringBase& InvalidateSearchFromEnd(TypeCharC* APC_Search, TypeLength AL_SearchLen)*/ + ZCStringBase& InvalidateSearchFromEnd + ( + TypeCharC* APC_Search, TypeLength AL_SearchLen + ) + /*#################################*/ ZCStringBase& InvalidHead(TypeCharC* APC_Search, TypeLength AL_SearchLen) { // APC_Search 를 앞에서 찾아서 있다면 그 부분을 무효화시킨다. - if(ml_UseLen<1 || AL_SearchLen<1) return *this; + if(ml_UseLen<1 || AL_SearchLen<1 ) return *this; const bool CB_IsOK = this->DoStart(APC_Search, AL_SearchLen); @@ -1010,13 +1038,13 @@ namespace ZNsMain { Invalidate(); return *this; }/* - if(rhs.ml_UseLen<1)*/ + /////////////////*/ ReAlloc(rhs.ml_UseLen); ::memcpy ( mpc_Data, rhs.mpc_Data, rhs.ml_UseLen*sizeof(TypeChar) ); - ///////////////////////////////// + /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ mpc_Data[ml_UseLen=rhs.ml_UseLen]=0; return *this; }/* @@ -1194,8 +1222,8 @@ namespace ZNsMain if(AL_Length<1) { Invalidate(); return *this; - }/* - if(AL_Length<1)*/ + } + /*<<<<<<<<<<<*/ ReAlloc(AL_Length); ::memcpy ( @@ -1401,7 +1429,7 @@ namespace ZNsMain const bool CB_DoKeepString= true; ReAllocAdd ( CI_AddSize, CB_DoKeepString ); - //////////////////////////////////////////// + /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ TypeChar* VPC_Start=mpc_Data+ml_UseLen; @@ -1547,7 +1575,7 @@ namespace ZNsMain { return 0; // Add Codes For Memory Over }/* - if(VP_Char==0)*/ + ////////////*/ int i; @@ -1587,8 +1615,13 @@ namespace ZNsMain }/* TypeLength ReadLong(TypeLength AL_Index)*/ - TypeLength ReadLong( - TypeLength AL_Index, TypeCharC* APC_Search, TypeLength AL_SearchLen) + TypeLength ReadLong /*#########################################################*/ + ( + TypeLength AL_Index , + TypeCharC* APC_Search , + TypeLength AL_SearchLen + ) + /*#############################################################################*/ { // VL_Index 부터 APC_Search 을 찾아서 그 앞에까지만 정수로 읽는다. @@ -1605,8 +1638,13 @@ namespace ZNsMain return ReadLongFromIndex(AL_Index, VL_Pos-1); }/* - TypeLength ReadLong( - TypeLength AL_Index, TypeCharC* APC_Search, TypeLength AL_SearchLen)*/ + TypeLength ReadLong /*########################################################### + ( + TypeLength AL_Index , + TypeCharC* APC_Search , + TypeLength AL_SearchLen + ) + /*#############################################################################*/ ZCStringBase& ReadString( @@ -1620,8 +1658,13 @@ namespace ZNsMain ZCStringBase& ARR_CString, TypeLength AL_Index1, TypeLength AL_Index2)*/ - ZCStringBase& ReadString_E( - ZCStringBase& ARR_CString, TypeLength AL_Index1, TypeLength AL_Index2) + ZCStringBase& ReadString_E /*##################################################*/ + ( + ZCStringBase& ARR_CString , + TypeLength AL_Index1 , + TypeLength AL_Index2 + ) + /*#############################################################################*/ { // Index1 번째 문자부터 VL_Index2 문자까지를 ARR_CString 에 전달한다. // ReadString 과는 달리 에러검사를 한다. @@ -1638,8 +1681,13 @@ namespace ZNsMain ARR_CString( mpc_Data+AL_Index1, AL_Index2-AL_Index1+1 ); }/* - ZCStringBase& ReadString_E( - ZCStringBase& ARR_CString, TypeLength AL_Index1, TypeLength AL_Index2)*/ + ZCStringBase& ReadString_E ###################################################### + ( + ZCStringBase& ARR_CString , + TypeLength AL_Index1 , + TypeLength AL_Index2 + ) + /*#############################################################################*/ ZCStringBase& ReadString //////////////////////// @@ -1742,11 +1790,11 @@ namespace ZNsMain ZCStringBase& FormatAdd(TypeLength AL_FormatSize, TypeCharC* APC_Format, ...)*/ - ZCStringBase& ReplaceChar + ZCStringBase& ReplaceChar /*###################################################*/ ( TypeChar AC_SearchChar, TypeChar AC_ReplaceChar, TypeLength AI_StartPos=0 ) - ///////////////////////// + /*#############################################################################*/ { for(TypeLength i=AI_StartPos; i ZCStringBase& ReplaceType @@ -2160,13 +2208,13 @@ namespace ZNsMain ) //////////////////////////////////////////////////////////*/ - ZCStringBase& Replace + ZCStringBase& Replace /*#######################################################*/ ( const ZCStringBase& AR_CStrSearch , const ZCStringBase& AR_CStrReplace, TypeLength AL_StartPos=0 ) - /*#################*/ + /*#############################################################################*/ { return Replace( AR_CStrSearch. data(), ////// AR_CStrReplace.data(), @@ -2175,18 +2223,22 @@ namespace ZNsMain AL_StartPos /*/////////*/ ); //////////////////////////// }/* - ZCStringBase& Replace + ZCStringBase& Replace ########################################################### ( - const ZCStringBase& AR_CStrSearch, const ZCStringBase& AR_CStrReplace, TypeLength AL_StartPos=0 + const ZCStringBase& AR_CStrSearch , + const ZCStringBase& AR_CStrReplace, + TypeLength AL_StartPos=0 ) - ###################*/ + /*#############################################################################*/ - template ZCStringBase& ReplaceType( - const ZCStringBase& AR_CStrSearch , - const ZCStringBase& AR_CStrReplace, - TypeLength AL_StartPos=0 - /*/////////*/ ) //////////////////////////////////////////// + template ZCStringBase& ReplaceType /*################*/ + ( + const ZCStringBase& AR_CStrSearch , + const ZCStringBase& AR_CStrReplace, + TypeLength AL_StartPos=0 + ) + /*#############################################################################*/ { return ReplaceType( /////// AR_CStrSearch. data(), @@ -2196,11 +2248,13 @@ namespace ZNsMain AL_StartPos /*/////////*/ ); /////////////////////////// }/* - template ZCStringBase& ReplaceType( - const ZCStringBase& AR_CStrSearch , - const ZCStringBase& AR_CStrReplace, - TypeLength AL_StartPos=0 - ///////////// ) //////////////////////////////////////////*/ + template ZCStringBase& ReplaceType #################### + ( + const ZCStringBase& AR_CStrSearch , + const ZCStringBase& AR_CStrReplace, + TypeLength AL_StartPos=0 + ) + /*#############################################################################*/ static ZCStringBase& ReplaceSection /*#########################################*/ @@ -2263,8 +2317,8 @@ namespace ZNsMain while(VL_NowIndex>=AL_SectPos+AL_SectLen) { *VPC_Dest-- = VPC_Origin2[VL_NowIndex--] ; - }/* - ///////////////////////////////////////*/ + } + /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ for(int i=AL_ReplaceLen-1; i>=0; --i) { @@ -2295,20 +2349,20 @@ namespace ZNsMain while(VL_NowIndex>=AL_SectPos+AL_SectLen) { *VPC_Dest-- = APC_Origin[VL_NowIndex--] ; - }/* - >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ + } + /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ for(int i=AL_ReplaceLen-1; i>=0; --i) { *VPC_Dest-- = APC_Replace[i] ; - }/* - ///////////////////////////////////*/ + } + /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ for(int j=AL_SectPos-1; j>=0; --j) { *VPC_Dest-- = APC_Origin[j] ; }/* - ////////////////////////////////*/ + /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ ARR_Saver.data()[VL_AllMemSize]=0; ARR_Saver.CorrectLength(VL_AllMemSize-1); @@ -2429,8 +2483,8 @@ namespace ZNsMain while(VL_NowIndex>=0) { *VPC_CharDest-- = APC_Origin[VL_NowIndex--]; - }/* - while(VL_NowIndex>=0)*/ + } + /*>>>>>>>>>>>>>>>>>*/ }/* if(VL_NowIndex>=0)*/