commit 2025-09-02 20:49 add operator() in ZCppMain/ZCStringStd.H

This commit is contained in:
2025-09-02 20:49:37 +09:00
parent 6a0fa2fa3b
commit 3392905ff0
2 changed files with 128 additions and 3 deletions

View File

@ -296,6 +296,125 @@ namespace ZNsMain
) )
###########################################################################*/ ###########################################################################*/
ZCStringStd& operator()(ZCStringStd& rhs)
{
if(this==&rhs) return *this; this->append(rhs); return *this;
}/*
ZCStringStd& operator()(ZCStringStd& rhs)*/
ZCStringStd& operator()(TypeCPChar APC_Data, TypeLength AI_Length)
{
if(this->data()==APC_Data) return *this;
this->append(APC_Data, AI_Length); return *this;
}/*
ZCStringStd& operator()(TypeCPChar APC_Data, TypeLength AI_Length)*/
ZCStringStd& operator()(TypeCPChar APC_Data)
{
if(this->data()==APC_Data) return *this;
this->append(APC_Data); return *this;
}/*
ZCStringStd& operator()(TypeCPChar APC_Data)*/
ZCStringStd& operator()(TypeLength AI_Repeat, char AC_Data)
{
this->append(AI_Repeat, AC_Data); return *this;
}/*
ZCStringStd& operator()(char AC_Data, TypeLength AI_Repeat)*/
ZCStringStd& operator()(char AC_Data, TypeLength AI_Repeat=1)
{
this->append(AI_Repeat, AC_Data); return *this;
}/*
ZCStringStd& operator()(char AC_Data, TypeLength AI_Repeat=1)*/
ZCStringStd& operator()(int AI_IntParam)
{
const int CI_BuffSize=21; char VCA_BuffParam[CI_BuffSize];
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%d", AI_IntParam);
return (*this)(VCA_BuffParam, VI_ResultSize);
}/*
ZCStringStd& operator()(int AI_IntParam)*/
ZCStringStd& operator()(ZTypUInt AUI_UIntParam)
{
const int CI_BuffSize=21; char VCA_BuffParam[CI_BuffSize];
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%u", AUI_UIntParam);
return (*this)(VCA_BuffParam, VI_ResultSize);
}/*
ZCStringStd& operator()(ZTypUInt AUI_UIntParam)*/
ZCStringStd& operator()(long AL_LongParam)
{
const int CI_BuffSize=31; char VCA_BuffParam[CI_BuffSize];
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%ld", AL_LongParam);
return (*this)(VCA_BuffParam, VI_ResultSize);
}/*
ZCStringStd& operator()(long AL_LongParam)*/
ZCStringStd& operator()(ZTypULong AUL_ULongParam)
{
const int CI_BuffSize=31; char VCA_BuffParam[CI_BuffSize];
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%lu", AUL_ULongParam);
return (*this)(VCA_BuffParam, VI_ResultSize);
}/*
ZCStringStd& operator()(ZTypULong AUL_ULongParam)*/
ZCStringStd& operator()(ZTypLLong ALL_LLongParam)
{
const int CI_BuffSize=41; char VCA_BuffParam[CI_BuffSize];
#ifdef _WIN
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%I64d", ALL_LLongParam);
#else
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%lld" , ALL_LLongParam);
#endif
return (*this)(VCA_BuffParam, VI_ResultSize);
}/*
ZCStringStd& operator()(ZTypLLong ALL_LLongParam)*/
ZCStringStd& operator()(ZTypULLong AULL_LLongParam)
{
const int CI_BuffSize=41; char VCA_BuffParam[CI_BuffSize];
#ifdef _WIN
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%I64u", AULL_LLongParam);
#else
int VI_ResultSize = ::sprintf(VCA_BuffParam, "%llu" , AULL_LLongParam);
#endif
return (*this)(VCA_BuffParam, VI_ResultSize);
}/*
ZCStringStd& operator()(ZTypULLong AULL_LLongParam)*/
ZCStringStd& operator()(double AD_DoubleParam)
{
const int CI_BuffSize=51 ;
char VCA_BuffParam[CI_BuffSize];
int VI_ResultSize = ::sprintf
(
VCA_BuffParam, "%f", AD_DoubleParam
);
/////////////////////////////
return (*this)(VCA_BuffParam);
}/*
ZCStringStd& operator()(double AD_DoubleParam)*/
public: public:
};/* };/*
class ZCStringStd : public std::string*/ class ZCStringStd : public std::string*/

View File

@ -837,10 +837,16 @@ namespace ZNsMain
{ {
// 문자 CharParam 을 AL_Count 개 붙인다. // 문자 CharParam 을 AL_Count 개 붙인다.
return (*this)(CharParam,AL_Count); return (*this)(CharParam, AL_Count);
}/* }/*
ZCStringBase& append(TypeChar CharParam, TypeLength AL_Count)*/ ZCStringBase& append(TypeChar CharParam, TypeLength AL_Count)*/
ZCStringBase& append(TypeLength AL_Count, TypeChar CharParam) // for string
{
return (*this)(CharParam, AL_Count);
}/*
ZCStringBase& append(TypeLength AL_Count, TypeChar CharParam)*/
ZCStringBase& append(TypeCharC* APC_Data, TypeLength AL_Length) ZCStringBase& append(TypeCharC* APC_Data, TypeLength AL_Length)
{ {
return (*this)(APC_Data, AL_Length); return (*this)(APC_Data, AL_Length);
@ -1346,7 +1352,7 @@ namespace ZNsMain
}/* }/*
ZCStringBase& operator()(ZTypUInt AUI_UIntParam)*/ ZCStringBase& operator()(ZTypUInt AUI_UIntParam)*/
ZCStringBase& operator()(long AL_LongParam) ZCStringBase& operator()(ZTypLong AL_LongParam)
{ {
const int CI_BuffSize=31; char VCA_BuffParam[CI_BuffSize]; const int CI_BuffSize=31; char VCA_BuffParam[CI_BuffSize];
@ -1354,7 +1360,7 @@ namespace ZNsMain
return (*this)(VCA_BuffParam, VI_ResultSize); return (*this)(VCA_BuffParam, VI_ResultSize);
}/* }/*
ZCStringBase& operator()(long AL_LongParam)*/ ZCStringBase& operator()(ZTypLong AL_LongParam)*/
ZCStringBase& operator()(ZTypULong AUL_ULongParam) ZCStringBase& operator()(ZTypULong AUL_ULongParam)
{ {