Compare commits

...

2 Commits

Author SHA1 Message Date
/* User with id == 0 is a fake user from git author */ sauron
f2a67017c8 commit 2025-10-09 02:24 Invalidate() => Invalid() : ZCppMain/ZtCStringEx.H 2025-10-09 02:24:13 +09:00
/* User with id == 0 is a fake user from git author */ sauron
5a1dba2a38 commit 2025-10-09 01:41 bug fix of operator()(long), (long long) etc : ZCppMain/ZtCStringStd.H 2025-10-09 01:41:26 +09:00
3 changed files with 207 additions and 114 deletions

View File

@ -960,7 +960,7 @@ namespace ZNsMain
{ {
// AL_NewSize>ml_UseLen 이면 추가되는 부분은 AC_FillChar 로 채운다. // AL_NewSize>ml_UseLen 이면 추가되는 부분은 AC_FillChar 로 채운다.
if(AL_NewSize<=ml_UseLen) return Invalidate(AL_NewSize); if(AL_NewSize<=ml_UseLen) return Invalid(AL_NewSize);
TypeLength VL_PrevSize=ml_UseLen; ReAllocKeep(AL_NewSize); TypeLength VL_PrevSize=ml_UseLen; ReAllocKeep(AL_NewSize);
@ -1071,15 +1071,12 @@ namespace ZNsMain
/*#############################################################################*/ /*#############################################################################*/
ZCStringBase& Invalidate(TypeLength AL_Index=0)
{
if(AL_Index>=0 && AL_Index<ml_UseLen) mpc_Data[ml_UseLen=AL_Index]=0; return *this;
}/*
ZCStringBase& Invalidate(TypeLength AL_Index=0)*/
ZCStringBase& Invalid(TypeLength AL_Index=0) ZCStringBase& Invalid(TypeLength AL_Index=0)
{ {
if(AL_Index>=0 && AL_Index<ml_UseLen) mpc_Data[ml_UseLen=AL_Index]=0; return *this; if(AL_Index>=0 && AL_Index<ml_UseLen)
mpc_Data[ml_UseLen=AL_Index]=0;
return *this; /*+++++++++++++++++++*/
}/* }/*
ZCStringBase& Invalid(TypeLength AL_Index=0)*/ ZCStringBase& Invalid(TypeLength AL_Index=0)*/
@ -1107,7 +1104,7 @@ namespace ZNsMain
ZCStringBase& InvalidByForce(TypeLength AL_Index=0) ZCStringBase& InvalidByForce(TypeLength AL_Index=0)
{ {
// Invalidate() 와의 차이에 주의 // Invalid() 와의 차이에 주의
const bool CB_IsOK = /*<<<<<<<<<<<<<<<<<*/ const bool CB_IsOK = /*<<<<<<<<<<<<<<<<<*/
( (
@ -1259,7 +1256,7 @@ namespace ZNsMain
if(rhs.ml_UseLen<1) if(rhs.ml_UseLen<1)
{ {
Invalidate(); return *this; Invalid(); return *this;
}/* }/*
/////////////////*/ /////////////////*/
@ -1287,13 +1284,13 @@ namespace ZNsMain
ZCStringBase& operator=(const ZCCharView& AR_View) ZCStringBase& operator=(const ZCCharView& AR_View)
{ {
Invalidate(); return (*this)(AR_View.data(), AR_View.size()); Invalid(); return (*this)(AR_View.data(), AR_View.size());
}/* }/*
ZCStringBase& operator=(const ZCCharView& AR_View)*/ ZCStringBase& operator=(const ZCCharView& AR_View)*/
ZCStringBase& operator=(int AI_Int ){Invalidate(); return (*this)(AI_Int );} ZCStringBase& operator=(int AI_Int ){Invalid(); return (*this)(AI_Int );}
ZCStringBase& operator=(long AL_Long ){Invalidate(); return (*this)(AL_Long );} ZCStringBase& operator=(long AL_Long ){Invalid(); return (*this)(AL_Long );}
ZCStringBase& operator=(double AD_Double){Invalidate(); return (*this)(AD_Double);} ZCStringBase& operator=(double AD_Double){Invalid(); return (*this)(AD_Double);}
bool operator==(TypeCharC* APC_Data) const{return Minus(APC_Data)==0 ;} bool operator==(TypeCharC* APC_Data) const{return Minus(APC_Data)==0 ;}
@ -1489,7 +1486,7 @@ namespace ZNsMain
{ {
if(AL_Length<1) if(AL_Length<1)
{ {
Invalidate(); return *this; Invalid(); return *this;
} }
/*<<<<<<<<<<<*/ /*<<<<<<<<<<<*/
@ -1575,88 +1572,118 @@ namespace ZNsMain
}/* }/*
ZCStringBase& operator()(const ZCChars& AR_CChars)*/ ZCStringBase& operator()(const ZCChars& AR_CChars)*/
ZCStringBase& operator()(int AI_IntParam) ZCStringBase& operator()(int AI_IntParam)
{ {
const int CI_BuffSize=21; char VCA_BuffParam[CI_BuffSize]; const int CI_BuffSize= 21; TypeChar VCA_BuffParam[CI_BuffSize] ;
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%d", AI_IntParam); int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
(
return (*this)(VCA_BuffParam, VI_ResultSize); sizeof(TypeChar)<=1
? ::sprintf ((char* )VCA_BuffParam, /*+++++++*/ "%d", AI_IntParam)
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%d", AI_IntParam)
);
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
}/* }/*
ZCStringBase& operator()(int AI_IntParam)*/ ZCStringBase& operator()(int AI_IntParam)*/
ZCStringBase& operator()(ZTypUInt AUI_UIntParam) ZCStringBase& operator()(ZTypUInt AUI_UIntParam)
{ {
const int CI_BuffSize=21; char VCA_BuffParam[CI_BuffSize]; const int CI_BuffSize= 21; TypeChar VCA_BuffParam[CI_BuffSize] ;
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%u", AUI_UIntParam); int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
(
return (*this)(VCA_BuffParam, VI_ResultSize); sizeof(TypeChar)<=1
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%u", AUI_UIntParam)
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%u", AUI_UIntParam)
);
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
}/* }/*
ZCStringBase& operator()(ZTypUInt AUI_UIntParam)*/ ZCStringBase& operator()(ZTypUInt AUI_UIntParam)*/
ZCStringBase& operator()(ZTypLong AL_LongParam) ZCStringBase& operator()(ZTypLong AL_LongParam)
{ {
const int CI_BuffSize=31; char VCA_BuffParam[CI_BuffSize]; const int CI_BuffSize= 31; TypeChar VCA_BuffParam[CI_BuffSize] ;
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%ld", AL_LongParam); int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
(
return (*this)(VCA_BuffParam, VI_ResultSize); sizeof(TypeChar)<=1
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%ld", AL_LongParam)
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%ld", AL_LongParam)
);
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
}/* }/*
ZCStringBase& operator()(ZTypLong AL_LongParam)*/ ZCStringBase& operator()(ZTypLong AL_LongParam)*/
ZCStringBase& operator()(ZTypULong AUL_ULongParam) ZCStringBase& operator()(ZTypULong AUL_ULongParam)
{ {
const int CI_BuffSize=31; char VCA_BuffParam[CI_BuffSize]; const int CI_BuffSize= 31; TypeChar VCA_BuffParam[CI_BuffSize] ;
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%lu", AUL_ULongParam); int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
(
return (*this)(VCA_BuffParam, VI_ResultSize); sizeof(TypeChar)<=1
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%lu", AUL_ULongParam)
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%lu", AUL_ULongParam)
);
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
}/* }/*
ZCStringBase& operator()(ZTypULong AUL_ULongParam)*/ ZCStringBase& operator()(ZTypULong AUL_ULongParam)*/
ZCStringBase& operator()(ZTypLLong ALL_LLongParam) ZCStringBase& operator()(ZTypLLong ALL_LLongParam)
{ {
const int CI_BuffSize=41; char VCA_BuffParam[CI_BuffSize]; const int CI_BuffSize= 41; TypeChar VCA_BuffParam[CI_BuffSize] ;
#ifdef _WIN #ifdef _WIN
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%I64d", ALL_LLongParam); int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
(
sizeof(TypeChar)<=1
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%I64d", ALL_LLongParam)
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%I64d", ALL_LLongParam)
);
#else #else
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%lld" , ALL_LLongParam); int VI_ResultSize =
(
sizeof(TypeChar)<=1
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%lld" , ALL_LLongParam)
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%lld" , ALL_LLongParam)
);
#endif #endif
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
return (*this)(VCA_BuffParam, VI_ResultSize);
}/* }/*
ZCStringBase& operator()(ZTypLLong ALL_LLongParam)*/ ZCStringBase& operator()(ZTypLLong ALL_LLongParam)*/
ZCStringBase& operator()(ZTypULLong AULL_LLongParam) ZCStringBase& operator()(ZTypULLong AULL_LLongParam)
{ {
const int CI_BuffSize=41; char VCA_BuffParam[CI_BuffSize]; const int CI_BuffSize= 41; TypeChar VCA_BuffParam[CI_BuffSize] ;
#ifdef _WIN #ifdef _WIN
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%I64u", AULL_LLongParam); int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
(
sizeof(TypeChar)<=1
? ::sprintf ((char* )VCA_BuffParam, /*+++++++*/ "%I64u", AULL_LLongParam)
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%I64u", AULL_LLongParam)
);
#else #else
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%llu" , AULL_LLongParam); int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
(
sizeof(TypeChar)<=1
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%llu" , AULL_LLongParam)
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%llu" , AULL_LLongParam)
);
#endif #endif
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
return (*this)(VCA_BuffParam, VI_ResultSize);
}/* }/*
ZCStringBase& operator()(ZTypULLong AULL_LLongParam)*/ ZCStringBase& operator()(ZTypULLong AULL_LLongParam)*/
ZCStringBase& operator()(double AD_DoubleParam) ZCStringBase& operator()(double AD_DoubleParam)
{ {
const int CI_BuffSize=51 ; const int CI_BuffSize= 51; TypeChar VCA_BuffParam[CI_BuffSize] ;
char VCA_BuffParam[CI_BuffSize];
int VI_ResultSize = ::sprintf int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
( (
VCA_BuffParam, "%f", AD_DoubleParam sizeof(TypeChar)<=1
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%f", AD_DoubleParam)
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%f", AD_DoubleParam)
); );
///////////////////////////// return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
TrimDecimalZero(VCA_BuffParam, VI_ResultSize);
return (*this)(VCA_BuffParam);
}/* }/*
ZCStringBase& operator()(double AD_DoubleParam)*/ ZCStringBase& operator()(double AD_DoubleParam)*/
@ -1909,17 +1936,17 @@ namespace ZNsMain
ZCStringBase& ConvertLLong() ZCStringBase& ConvertLLong()
{ {
ZNsMain::ZTypLLong LLongValue=ZNsMain::ZfAtoLL(mpc_Data); ZNsMain::ZTypLLong LLongValue = ZNsMain::ZfAtoLL(mpc_Data);
this->Invalidate(); return (*this)(LLongValue); this->Invalid(); return (*this)(LLongValue);
}/* }/*
ZCStringBase& ConvertLLong()*/ ZCStringBase& ConvertLLong()*/
ZCStringBase& ConvertLong() ZCStringBase& ConvertLong()
{ {
ZNsMain::ZTypLLong LongValue=ZNsMain::ZfAtoL(mpc_Data); ZNsMain::ZTypLLong LongValue = ZNsMain::ZfAtoL(mpc_Data);
this->Invalidate(); return (*this)(LongValue); this->Invalid(); return (*this)(LongValue);
}/* }/*
ZCStringBase& ConvertLong()*/ ZCStringBase& ConvertLong()*/
@ -2482,8 +2509,8 @@ namespace ZNsMain
if(VL_SearchPos2-VL_SearchPos1-AL_SearchLen1<1) if(VL_SearchPos2-VL_SearchPos1-AL_SearchLen1<1)
{ {
return *this; // 찾은 두 문자열 사이에 문자가 없을 때 return *this; // 찾은 두 문자열 사이에 문자가 없을 때
}/* }
/////////////////////////////////////////////*/ /*:::::::::::::::::::::::::::::::::::::::::::*/
return ReplaceSection return ReplaceSection
( (
@ -2507,8 +2534,8 @@ namespace ZNsMain
} }
else if(AB_IsExactTwo==false && VL_SearchPos1>=0 && VL_SearchPos2<0) else if(AB_IsExactTwo==false && VL_SearchPos1>=0 && VL_SearchPos2<0)
{ {
if(AB_DoKeepSearch==true) Invalidate(VL_SearchPos1+AL_SearchLen1); if(AB_DoKeepSearch) Invalid(VL_SearchPos1+AL_SearchLen1 );
else Invalidate(VL_SearchPos1); else Invalid(VL_SearchPos1 );
}/* }/*
else if(AB_IsExactTwo==false && VL_SearchPos1>=0 && VL_SearchPos2<0)*/ else if(AB_IsExactTwo==false && VL_SearchPos1>=0 && VL_SearchPos2<0)*/
@ -3994,11 +4021,11 @@ namespace ZNsMain
} }
else else
{ {
((ZCString&)ARR_SaveList).Invalidate().append ((ZCString&)ARR_SaveList).Invalid().append
( (
APC_OriginChar+VL_CopyStartPos, VL_Index-VL_CopyStartPos APC_OriginChar+VL_CopyStartPos, VL_Index-VL_CopyStartPos
) ; ) ;
///////////////////////////////////////////// //////////////////////////////////////////
}/* }/*
else*/ else*/
} }
@ -4023,7 +4050,7 @@ namespace ZNsMain
{ ((ZCStringBase&)ARR_SaveList). { ((ZCStringBase&)ARR_SaveList).
append( APC_OriginChar+VL_CopyStartPos, AL_OriginLen-VL_CopyStartPos ) ; append( APC_OriginChar+VL_CopyStartPos, AL_OriginLen-VL_CopyStartPos ) ;
}else }else
{ ((ZCStringBase&)ARR_SaveList).Invalidate(). { ((ZCStringBase&)ARR_SaveList).Invalid().
append( APC_OriginChar+VL_CopyStartPos, AL_OriginLen-VL_CopyStartPos ) ; append( APC_OriginChar+VL_CopyStartPos, AL_OriginLen-VL_CopyStartPos ) ;
} }
}/* }/*
@ -4256,7 +4283,7 @@ namespace ZNsMain
if(VL_Index>VL_CopyStartPos) if(VL_Index>VL_CopyStartPos)
{ {
VO_CStringTemp.Invalidate(); VO_CStringTemp.Invalid();
ARR_SaveList.push_back //////////////////// ARR_SaveList.push_back ////////////////////
( (
@ -4289,7 +4316,7 @@ namespace ZNsMain
/* VL_PrevListSize==ARR_SaveList.size() 인 경우는, 분리 /* VL_PrevListSize==ARR_SaveList.size() 인 경우는, 분리
문자열을 찾을 수 없는 경우다. 이때는 아무짓도 하지 말자. 문자열을 찾을 수 없는 경우다. 이때는 아무짓도 하지 말자.
*/ */
VO_CStringTemp.Invalidate(); VO_CStringTemp.Invalid();
ARR_SaveList.push_back //////// ARR_SaveList.push_back ////////
( (
@ -4765,7 +4792,7 @@ namespace ZNsMain
if(VL_CopyPos<VL_StartPos) if(VL_CopyPos<VL_StartPos)
{ {
VO_CStringTemp.Invalidate(); VO_CStringTemp.Invalid();
ARR_SaveList.push_back ARR_SaveList.push_back
( (
@ -4791,7 +4818,7 @@ namespace ZNsMain
if(VL_CopyPos<AL_OriginLen) if(VL_CopyPos<AL_OriginLen)
{ {
VO_CStringTemp.Invalidate(); VO_CStringTemp.Invalid();
ARR_SaveList.push_back ARR_SaveList.push_back
( (
@ -4880,19 +4907,26 @@ namespace ZNsMain
if(AB_DoIncludeSearch==true) if(AB_DoIncludeSearch==true)
{ {
((ZCStringBase&)ARR_SaveList).Invalidate().append( ((ZCStringBase&)ARR_SaveList).Invalid().append
APC_OriginChar+VL_Pos1 , VL_Pos2-VL_Pos1+AL_Search2Len) ; (
APC_OriginChar+VL_Pos1, VL_Pos2-VL_Pos1+AL_Search2Len
) ;
/*::::::::::::::::::::::::::::::::::::::::::*/
} }
else if(VL_Pos2>VL_Pos1+AL_Search1Len) // AB_DoIncludeSearch==false else if(VL_Pos2>VL_Pos1+AL_Search1Len) // AB_DoIncludeSearch==false
{ {
((ZCStringBase&)ARR_SaveList).Invalidate().append( ((ZCStringBase&)ARR_SaveList).Invalid().append
APC_OriginChar+VL_Pos1+AL_Search1Len, VL_Pos2-VL_Pos1-AL_Search1Len) ; (
APC_OriginChar + VL_Pos1+AL_Search1Len,
VL_Pos2-VL_Pos1- AL_Search1Len
) ;
/*::::::::::::::::::::::::::::::::::::::::::*/
// APC_Search1Char 와 APC_Search2Char 사이에 문자열이 하나 이상 있어야 한다. // APC_Search1Char 와 APC_Search2Char 사이에 문자열이 하나 이상 있어야 한다.
}/* }/*
else if(VL_Pos2>VL_Pos1+AL_Search1Len) // AB_DoIncludeSearch==false*/ else if(VL_Pos2>VL_Pos1+AL_Search1Len) // AB_DoIncludeSearch==false*/
VL_Pos1=VL_Pos2+AL_Search2Len; VL_Pos1 = VL_Pos2+AL_Search2Len;
}/* }/*
while ( ////////////////////////////////////////////// while ( //////////////////////////////////////////////
( VL_Pos1 = FindPos ( VL_Pos1 = FindPos
@ -5029,13 +5063,20 @@ namespace ZNsMain
if(AB_DoIncludeSearch==true) if(AB_DoIncludeSearch==true)
{ {
((ZCString&)ARR_SaveList).Invalidate().append( ((ZCString&)ARR_SaveList).Invalid().append
APC_OriginChar+VL_Pos1 , VL_Pos2-VL_Pos1+AL_Search2Len) ; (
APC_OriginChar+VL_Pos1, VL_Pos2-VL_Pos1+AL_Search2Len
) ;
/*::::::::::::::::::::::::::::::::::::::*/
} }
else if(VL_Pos2>VL_Pos1+AL_Search1Len) // AB_DoIncludeSearch==false else if(VL_Pos2>VL_Pos1+AL_Search1Len) // AB_DoIncludeSearch==false
{ {
((ZCString&)ARR_SaveList).Invalidate().append( ((ZCString&)ARR_SaveList).Invalid().append
APC_OriginChar+VL_Pos1+AL_Search1Len, VL_Pos2-VL_Pos1-AL_Search1Len) ; (
APC_OriginChar + VL_Pos1+AL_Search1Len,
VL_Pos2-VL_Pos1- AL_Search1Len
) ;
/*::::::::::::::::::::::::::::::::::::::*/
// APC_Search1Char 와 APC_Search2Char 사이에 문자열이 하나 이상 있어야 한다. // APC_Search1Char 와 APC_Search2Char 사이에 문자열이 하나 이상 있어야 한다.
}/* }/*
@ -6356,7 +6397,7 @@ namespace ZNsMain
ZCStringBase& PadLeft(TypeLength AL_NewSize, TypeChar AC_FillChar=' ') ZCStringBase& PadLeft(TypeLength AL_NewSize, TypeChar AC_FillChar=' ')
{ {
if(AL_NewSize<=ml_UseLen) return Invalidate(AL_NewSize); if(AL_NewSize<=ml_UseLen) return Invalid(AL_NewSize);
return MoveRight(AL_NewSize-ml_UseLen, AC_FillChar); return MoveRight(AL_NewSize-ml_UseLen, AC_FillChar);
}/* }/*
@ -6365,7 +6406,7 @@ namespace ZNsMain
ZCStringBase& PadRight(TypeLength AL_NewSize, TypeChar AC_FillChar=' ') ZCStringBase& PadRight(TypeLength AL_NewSize, TypeChar AC_FillChar=' ')
{ {
if(AL_NewSize<=ml_UseLen) if(AL_NewSize<=ml_UseLen)
{ return Invalidate(AL_NewSize); } { return Invalid(AL_NewSize); }
this->ReAllocKeep(AL_NewSize); this->ReAllocKeep(AL_NewSize);
@ -6805,7 +6846,7 @@ namespace ZNsMain
if(AL_StartPos<0) if(AL_StartPos<0)
return *this; // 확장자 구분표시 '.' 이 없을 경우 return *this; // 확장자 구분표시 '.' 이 없을 경우
else else
return Invalidate(AL_StartPos); return Invalid(AL_StartPos);
//else //else
}/* }/*
ZCStringBase& MinusExt()*/ ZCStringBase& MinusExt()*/

View File

@ -345,84 +345,115 @@ namespace ZNsMain
ZtCStringStd& operator()(int AI_IntParam) ZtCStringStd& operator()(int AI_IntParam)
{ {
const int CI_BuffSize=21; char VCA_BuffParam[CI_BuffSize]; const int CI_BuffSize= 21; TypeChar VCA_BuffParam[CI_BuffSize] ;
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%d", AI_IntParam); int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
(
return (*this)(VCA_BuffParam, VI_ResultSize); sizeof(TypeChar)<=1
? ::sprintf ((char* )VCA_BuffParam, /*+++++++*/ "%d", AI_IntParam)
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%d", AI_IntParam)
);
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
}/* }/*
ZtCStringStd& operator()(int AI_IntParam)*/ ZtCStringStd& operator()(int AI_IntParam)*/
ZtCStringStd& operator()(ZTypUInt AUI_UIntParam) ZtCStringStd& operator()(ZTypUInt AUI_UIntParam)
{ {
const int CI_BuffSize=21; char VCA_BuffParam[CI_BuffSize]; const int CI_BuffSize= 21; TypeChar VCA_BuffParam[CI_BuffSize] ;
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%u", AUI_UIntParam); int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
(
return (*this)(VCA_BuffParam, VI_ResultSize); sizeof(TypeChar)<=1
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%u", AUI_UIntParam)
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%u", AUI_UIntParam)
);
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
}/* }/*
ZtCStringStd& operator()(ZTypUInt AUI_UIntParam)*/ ZtCStringStd& operator()(ZTypUInt AUI_UIntParam)*/
ZtCStringStd& operator()(long AL_LongParam) ZtCStringStd& operator()(long AL_LongParam)
{ {
const int CI_BuffSize=31; char VCA_BuffParam[CI_BuffSize]; const int CI_BuffSize= 31; TypeChar VCA_BuffParam[CI_BuffSize] ;
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%ld", AL_LongParam); int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
(
return (*this)(VCA_BuffParam, VI_ResultSize); sizeof(TypeChar)<=1
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%ld", AL_LongParam)
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%ld", AL_LongParam)
);
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
}/* }/*
ZtCStringStd& operator()(long AL_LongParam)*/ ZtCStringStd& operator()(long AL_LongParam)*/
ZtCStringStd& operator()(ZTypULong AUL_ULongParam) ZtCStringStd& operator()(ZTypULong AUL_ULongParam)
{ {
const int CI_BuffSize=31; char VCA_BuffParam[CI_BuffSize]; const int CI_BuffSize= 31; TypeChar VCA_BuffParam[CI_BuffSize] ;
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%lu", AUL_ULongParam); int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
(
return (*this)(VCA_BuffParam, VI_ResultSize); sizeof(TypeChar)<=1
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%lu", AUL_ULongParam)
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%lu", AUL_ULongParam)
);
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
}/* }/*
ZtCStringStd& operator()(ZTypULong AUL_ULongParam)*/ ZtCStringStd& operator()(ZTypULong AUL_ULongParam)*/
ZtCStringStd& operator()(ZTypLLong ALL_LLongParam) ZtCStringStd& operator()(ZTypLLong ALL_LLongParam)
{ {
const int CI_BuffSize=41; char VCA_BuffParam[CI_BuffSize]; const int CI_BuffSize= 41; TypeChar VCA_BuffParam[CI_BuffSize] ;
#ifdef _WIN #ifdef _WIN
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%I64d", ALL_LLongParam); int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
(
sizeof(TypeChar)<=1
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%I64d", ALL_LLongParam)
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%I64d", ALL_LLongParam)
);
#else #else
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%lld" , ALL_LLongParam); int VI_ResultSize =
(
sizeof(TypeChar)<=1
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%lld" , ALL_LLongParam)
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%lld" , ALL_LLongParam)
);
#endif #endif
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
return (*this)(VCA_BuffParam, VI_ResultSize);
}/* }/*
ZtCStringStd& operator()(ZTypLLong ALL_LLongParam)*/ ZtCStringStd& operator()(ZTypLLong ALL_LLongParam)*/
ZtCStringStd& operator()(ZTypULLong AULL_LLongParam) ZtCStringStd& operator()(ZTypULLong AULL_LLongParam)
{ {
const int CI_BuffSize=41; char VCA_BuffParam[CI_BuffSize]; const int CI_BuffSize= 41; TypeChar VCA_BuffParam[CI_BuffSize] ;
#ifdef _WIN #ifdef _WIN
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%I64u", AULL_LLongParam); int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
(
sizeof(TypeChar)<=1
? ::sprintf ((char* )VCA_BuffParam, /*+++++++*/ "%I64u", AULL_LLongParam)
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%I64u", AULL_LLongParam)
);
#else #else
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%llu" , AULL_LLongParam); int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
(
sizeof(TypeChar)<=1
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%llu" , AULL_LLongParam)
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%llu" , AULL_LLongParam)
);
#endif #endif
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
return (*this)(VCA_BuffParam, VI_ResultSize);
}/* }/*
ZtCStringStd& operator()(ZTypULLong AULL_LLongParam)*/ ZtCStringStd& operator()(ZTypULLong AULL_LLongParam)*/
ZtCStringStd& operator()(double AD_DoubleParam) ZtCStringStd& operator()(double AD_DoubleParam)
{ {
const int CI_BuffSize=51 ; const int CI_BuffSize= 51; TypeChar VCA_BuffParam[CI_BuffSize] ;
char VCA_BuffParam[CI_BuffSize];
int VI_ResultSize = ::sprintf int VI_ResultSize = /*::::::::::::::::::::::::::::::::::::::::*/
( (
VCA_BuffParam, "%f", AD_DoubleParam sizeof(TypeChar)<=1
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%f", AD_DoubleParam)
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%f", AD_DoubleParam)
); );
///////////////////////////// return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
return (*this)(VCA_BuffParam);
}/* }/*
ZtCStringStd& operator()(double AD_DoubleParam)*/ ZtCStringStd& operator()(double AD_DoubleParam)*/

View File

@ -3,6 +3,7 @@
#include <string> #include <string>
#include <iostream> #include <iostream>
#include "ZCppMain/ZtCStringEx.H" #include "ZCppMain/ZtCStringEx.H"
#include "ZCppMain/ZtCStringStd.H"
using namespace std; using namespace std;
@ -13,6 +14,9 @@ namespace ZNsMain
namespace ZNsExam namespace ZNsExam
{ {
typedef ZtCStringStd<string> ZCStringStd ;
typedef ZtCStringStd<wstring> ZCStringStdW ;
typedef ZtCStringBase<char> ZCStringBase ; typedef ZtCStringBase<char> ZCStringBase ;
typedef ZtCStringBase<wchar_t> ZCStringBaseW ; typedef ZtCStringBase<wchar_t> ZCStringBaseW ;
@ -54,6 +58,23 @@ namespace ZNsMain
cout<<"# ZCStringBaseW::traits_type="<<typeid(ZCStringBaseW::traits_type).name()<<endl; cout<<"# ZCStringBaseW::traits_type="<<typeid(ZCStringBaseW::traits_type).name()<<endl;
cout<<"*****************************************************"<<endl; cout<<"*****************************************************"<<endl;
ZCStringBaseW VO_ZCStringBaseW;
ZCStringStdW VO_ZCStringStdW ;
VO_ZCStringBaseW(123);
cout<<"* after VO_ZCStringBaseW(123)"<<endl;
cout<<"# VO_ZCStringBaseW[0]="<<int(VO_ZCStringBaseW[0])<<endl;
cout<<"# VO_ZCStringBaseW[1]="<<int(VO_ZCStringBaseW[1])<<endl;
cout<<"# VO_ZCStringBaseW[2]="<<int(VO_ZCStringBaseW[2])<<endl;
cout<<"*****************************************************"<<endl;
VO_ZCStringStdW(1.2);
cout<<"* after VO_ZCStringStdW(1.2)"<<endl;
cout<<"# VO_ZCStringStdW [0]="<<int(VO_ZCStringStdW[0])<<endl;
cout<<"# VO_ZCStringStdW [1]="<<int(VO_ZCStringStdW[1])<<endl;
cout<<"# VO_ZCStringStdW [2]="<<int(VO_ZCStringStdW[2])<<endl;
cout<<"*****************************************************"<<endl;
const ZCCharView CO_ZCCharView("1234AA5678AA90abcAAss"); const ZCCharView CO_ZCCharView("1234AA5678AA90abcAAss");