commit 2025-10-08 23:48 ZCppMain/ZCStringStd.H -> ZCppMain/ZtCStringStd.H
This commit is contained in:
@ -321,7 +321,7 @@ namespace ZNsMain
|
||||
typedef typename ZCTypeString::TypeLong TypeLength ;
|
||||
public:
|
||||
typedef typename ZCTypeChars ::ZCChars ZCChars ;
|
||||
typedef typename ZCTypeChars ::ZCChars ZCCharView ; // // for string_view in C++17
|
||||
typedef typename ZCTypeChars ::ZCChars ZCCharView ; // for string_view in C++17
|
||||
public:
|
||||
typedef const ZCChars ZCCharsC ;
|
||||
typedef const ZCChars ZCCharViewC;
|
||||
@ -332,7 +332,7 @@ namespace ZNsMain
|
||||
typedef ZCStringList TypeList ;
|
||||
public:
|
||||
typedef ZNsMain::ZtCCharType<ZtCStringBase> ZCCharType ;
|
||||
typedef ZNsMain::ZtCCharType<ZtCStringBase> traits_type;
|
||||
typedef ZNsMain::ZtCCharType<ZtCStringBase> traits_type; // for strl string
|
||||
typedef typename ZCCharType::TypeInt TypeCharInt;
|
||||
public:
|
||||
|
||||
@ -765,7 +765,7 @@ namespace ZNsMain
|
||||
}/*
|
||||
ZtCStringBase()*/
|
||||
|
||||
ZtCStringBase(TypeCharC* APC_Data)
|
||||
explicit ZtCStringBase(TypeCharC* APC_Data)
|
||||
{
|
||||
ml_AllLen=0;
|
||||
ml_UseLen=0;
|
||||
@ -779,7 +779,7 @@ namespace ZNsMain
|
||||
);
|
||||
/////////////////////////////////////////
|
||||
}/*
|
||||
ZtCStringBase(TypeCharC* APC_Data)*/
|
||||
explicit ZtCStringBase(TypeCharC* APC_Data)*/
|
||||
|
||||
ZtCStringBase(TypeCharC* APC_Data, TypeLength AL_Length)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
|
||||
#ifndef __ZCPPMAIIN_ZCSTRINGSTD_H__
|
||||
#define __ZCPPMAIIN_ZCSTRINGSTD_H__
|
||||
#ifndef __ZCPPMAIIN_ZTCSTRINGSTD_H__
|
||||
#define __ZCPPMAIIN_ZTCSTRINGSTD_H__
|
||||
|
||||
|
||||
#include<string>
|
||||
@ -11,41 +11,56 @@
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
class ZCStringStd : public std::string
|
||||
template
|
||||
< typename TTypString = std::string >
|
||||
class ZtCStringStd : public TTypString
|
||||
{
|
||||
public:
|
||||
typedef ZNsChars::ZNsType::ZtCTypeChars<char> ZCTypeChars;
|
||||
typedef ZNsChars::ZtCMainChars<ZCTypeChars> ZCMainChars;
|
||||
typedef typename TTypString::traits_type::char_type TypeChar ;
|
||||
typedef typename TTypString::traits_type::int_type TypeCharInt ;
|
||||
public:
|
||||
typedef char TypeChar ;
|
||||
typedef char* TypePChar ;
|
||||
typedef const char* TypeCPChar;
|
||||
typedef std::string TypeBase ;
|
||||
typedef std::string TypeStrStd;
|
||||
typedef ZTypLength TypeLength;
|
||||
typedef ZTypLength TypeSize ;
|
||||
typedef ZNsChars::ZNsType::
|
||||
ZtCTypeChars <TypeChar > ZCTypeChars ;
|
||||
typedef ZNsChars::
|
||||
ZtCMainChars<ZCTypeChars> ZCMainChars ;
|
||||
public:
|
||||
typedef TypeChar* TypePChar ;
|
||||
typedef const TypeChar* TypeCPChar ;
|
||||
typedef TTypString TypeBase ;
|
||||
typedef TTypString TypeStrStd ;
|
||||
typedef ZTypLength TypeLength ;
|
||||
typedef ZTypLength TypeSize ;
|
||||
public:
|
||||
typedef ZtCChars<TypePChar> ZCChars ;
|
||||
typedef ZtCChars<TypePChar> ZCCharView ;
|
||||
public:
|
||||
|
||||
ZCStringStd(): TypeStrStd(){}
|
||||
ZCStringStd(const ZCStringStd& rhs): TypeStrStd(rhs){}
|
||||
ZCStringStd(const char* APC_Origin, TypeLength AL_Length): TypeStrStd(APC_Origin, AL_Length){}
|
||||
ZCStringStd(const char* APC_Origin): TypeStrStd(APC_Origin){}
|
||||
ZtCStringStd(): TypeStrStd(){}
|
||||
ZtCStringStd(const ZtCStringStd& rhs): TypeStrStd(rhs){}
|
||||
ZtCStringStd(TypeCPChar APC_Origin, TypeLength AL_Length):
|
||||
TypeStrStd(APC_Origin, AL_Length){}
|
||||
|
||||
ZCStringStd& operator=(const ZCStringStd& rhs)
|
||||
ZtCStringStd(const ZCCharView& AR_View):
|
||||
TypeStrStd(AR_View.data(), AR_View.size()){}
|
||||
|
||||
explicit ZtCStringStd(TypeCPChar APC_Origin):
|
||||
TypeStrStd(APC_Origin){}
|
||||
|
||||
ZtCStringStd& operator=(const ZtCStringStd& rhs)
|
||||
{
|
||||
if(this==&rhs){ return *this; }
|
||||
|
||||
this->TypeStrStd::operator=(rhs); return *this;
|
||||
}/*
|
||||
ZCStringStd& operator=(const ZCStringStd& rhs)*/
|
||||
ZtCStringStd& operator=(const ZtCStringStd& rhs)*/
|
||||
|
||||
ZCStringStd& operator=(const TypeBase& rhs)
|
||||
ZtCStringStd& operator=(const TypeBase& rhs)
|
||||
{
|
||||
if(this->data()==rhs.data()){ return *this; }
|
||||
|
||||
this->TypeStrStd::operator=(rhs); return *this;
|
||||
}/*
|
||||
ZCStringStd& operator=(const TypeBase& rhs)*/
|
||||
ZtCStringStd& operator=(const TypeBase& rhs)*/
|
||||
|
||||
|
||||
template<typename TPosList> void FindPosToList /////////////
|
||||
@ -61,7 +76,7 @@ namespace ZNsMain
|
||||
if(this->size() <= AL_Offset) return ;
|
||||
if(this->size() < 1 ) return ;
|
||||
|
||||
const char* VPC_OriginStart = this->data();
|
||||
const TypeChar* VPC_OriginStart = this->data();
|
||||
TypeLength VL_OriginLen = this->size();
|
||||
TypeLength VL_FindPos = -1 ;
|
||||
TypeLength VL_OffsetNow = AL_Offset ;
|
||||
@ -91,10 +106,10 @@ namespace ZNsMain
|
||||
|
||||
|
||||
public :
|
||||
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
private:
|
||||
|
||||
template<typename TPosList> ZCStringStd& ReplaceByPosList ///////////////////
|
||||
template<typename TPosList> ZtCStringStd& ReplaceByPosList ///////////////////
|
||||
(
|
||||
TPosList& AR_CPosList ,
|
||||
TypeCPChar APC_Replace ,
|
||||
@ -120,7 +135,7 @@ namespace ZNsMain
|
||||
TypeLength VL_NeedSize = VL_ThisSize +
|
||||
(AL_Replace-AL_Searched) * VL_PosListSize ;
|
||||
|
||||
TypePChar VPC_ThisStart = const_cast<char*>(this->data()) ;
|
||||
TypePChar VPC_ThisStart = const_cast<TypeChar*>(this->data()) ;
|
||||
IterEasyID VH_IterEasyID = AR_CPosList.ItHID();
|
||||
TypeLength VL_SearchedPos= 0 ;
|
||||
TypeLength VL_SearchedPre= 0 ; // VL_SearchedPos 의 이전 값
|
||||
@ -156,7 +171,7 @@ namespace ZNsMain
|
||||
|
||||
::memmove /*::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
VPC_DestStart, VPC_MoveStart, VL_MemMoveSize
|
||||
VPC_DestStart, VPC_MoveStart, VL_MemMoveSize*sizeof(TypeChar)
|
||||
);
|
||||
/*::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
}/*
|
||||
@ -179,7 +194,7 @@ namespace ZNsMain
|
||||
(
|
||||
VPC_ThisStart + VL_DestStart,
|
||||
VPC_ThisStart + VL_MoveStart,
|
||||
VL_ThisSize - VL_MoveStart
|
||||
(VL_ThisSize - VL_MoveStart)*sizeof(TypeChar)
|
||||
);
|
||||
/*::::::::::::::::::::::::::::::::::::::::*/
|
||||
}/*
|
||||
@ -209,7 +224,7 @@ namespace ZNsMain
|
||||
|
||||
::memmove /*::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
VPC_DestStart, VPC_MoveStart, VL_MemMoveSize
|
||||
VPC_DestStart, VPC_MoveStart, VL_MemMoveSize*sizeof(TypeChar)
|
||||
);
|
||||
/*::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
}/*
|
||||
@ -219,7 +234,7 @@ namespace ZNsMain
|
||||
|
||||
::memcpy /*::::::::::::::::::::::::::::::::::::::::*/
|
||||
(
|
||||
VPC_DestStart, APC_Replace, AL_Replace
|
||||
VPC_DestStart, APC_Replace, AL_Replace*sizeof(TypeChar)
|
||||
);
|
||||
/*::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
|
||||
@ -232,7 +247,7 @@ namespace ZNsMain
|
||||
|
||||
return *this;
|
||||
}/*
|
||||
template<typename TPosList> ZCStringStd& ReplaceByPosList ///////////////////
|
||||
template<typename TPosList> ZtCStringStd& ReplaceByPosList ///////////////////
|
||||
(
|
||||
TPosList& AR_CPosList ,
|
||||
TypeCPChar APC_Replace ,
|
||||
@ -247,7 +262,7 @@ namespace ZNsMain
|
||||
public :
|
||||
|
||||
|
||||
ZCStringStd& Replace /*////////////////////////////////////////////////////*/
|
||||
ZtCStringStd& Replace /*////////////////////////////////////////////////////*/
|
||||
(
|
||||
TypeCPChar APC_Search, TypeCPChar APC_Replace,
|
||||
TypeLength AL_Search , TypeLength AL_Replace , TypeLength AL_Offset=0
|
||||
@ -270,7 +285,7 @@ namespace ZNsMain
|
||||
);
|
||||
/*::::::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
}/*
|
||||
ZCStringStd& Replace ////////////////////////////////////////////////////////
|
||||
ZtCStringStd& Replace ////////////////////////////////////////////////////////
|
||||
(
|
||||
TypeCPChar APC_Search, TypeCPChar APC_Replace,
|
||||
TypeLength AL_Search , TypeLength AL_Replace , TypeLength AL_Offset=0
|
||||
@ -278,7 +293,7 @@ namespace ZNsMain
|
||||
###########################################################################*/
|
||||
|
||||
|
||||
ZCStringStd& Replace /*////////////////////////////////////////////////////*/
|
||||
ZtCStringStd& Replace /*////////////////////////////////////////////////////*/
|
||||
(
|
||||
TypeCPChar APC_Search, TypeCPChar APC_Replace, TypeLength AL_Offset=0
|
||||
)
|
||||
@ -286,49 +301,49 @@ namespace ZNsMain
|
||||
{
|
||||
return Replace(APC_Search, APC_Replace, ZftLength(APC_Search), ZftLength(APC_Replace), AL_Offset);
|
||||
}/*
|
||||
ZCStringStd& Replace ////////////////////////////////////////////////////////
|
||||
ZtCStringStd& Replace ////////////////////////////////////////////////////////
|
||||
(
|
||||
TypeCPChar APC_Search, TypeCPChar APC_Replace, TypeLength AL_Offset=0
|
||||
)
|
||||
###########################################################################*/
|
||||
|
||||
|
||||
ZCStringStd& operator()(ZCStringStd& rhs)
|
||||
ZtCStringStd& operator()(ZtCStringStd& rhs)
|
||||
{
|
||||
if(this==&rhs) return *this; this->append(rhs); return *this;
|
||||
}/*
|
||||
ZCStringStd& operator()(ZCStringStd& rhs)*/
|
||||
ZtCStringStd& operator()(ZtCStringStd& rhs)*/
|
||||
|
||||
ZCStringStd& operator()(TypeCPChar APC_Data, TypeLength AI_Length)
|
||||
ZtCStringStd& 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)*/
|
||||
ZtCStringStd& operator()(TypeCPChar APC_Data, TypeLength AI_Length)*/
|
||||
|
||||
ZCStringStd& operator()(TypeCPChar APC_Data)
|
||||
ZtCStringStd& operator()(TypeCPChar APC_Data)
|
||||
{
|
||||
if(this->data()==APC_Data) return *this;
|
||||
|
||||
this->append(APC_Data); return *this;
|
||||
}/*
|
||||
ZCStringStd& operator()(TypeCPChar APC_Data)*/
|
||||
ZtCStringStd& operator()(TypeCPChar APC_Data)*/
|
||||
|
||||
ZCStringStd& operator()(TypeLength AI_Repeat, char AC_Data)
|
||||
ZtCStringStd& operator()(TypeLength AI_Repeat, TypeChar AC_Data)
|
||||
{
|
||||
this->append(AI_Repeat, AC_Data); return *this;
|
||||
}/*
|
||||
ZCStringStd& operator()(char AC_Data, TypeLength AI_Repeat)*/
|
||||
ZtCStringStd& operator()(TypeChar AC_Data, TypeLength AI_Repeat)*/
|
||||
|
||||
ZCStringStd& operator()(char AC_Data, TypeLength AI_Repeat=1)
|
||||
ZtCStringStd& operator()(TypeChar AC_Data, TypeLength AI_Repeat=1)
|
||||
{
|
||||
this->append(AI_Repeat, AC_Data); return *this;
|
||||
}/*
|
||||
ZCStringStd& operator()(char AC_Data, TypeLength AI_Repeat=1)*/
|
||||
ZtCStringStd& operator()(TypeChar AC_Data, TypeLength AI_Repeat=1)*/
|
||||
|
||||
|
||||
ZCStringStd& operator()(int AI_IntParam)
|
||||
ZtCStringStd& operator()(int AI_IntParam)
|
||||
{
|
||||
const int CI_BuffSize=21; char VCA_BuffParam[CI_BuffSize];
|
||||
|
||||
@ -336,9 +351,9 @@ namespace ZNsMain
|
||||
|
||||
return (*this)(VCA_BuffParam, VI_ResultSize);
|
||||
}/*
|
||||
ZCStringStd& operator()(int AI_IntParam)*/
|
||||
ZtCStringStd& operator()(int AI_IntParam)*/
|
||||
|
||||
ZCStringStd& operator()(ZTypUInt AUI_UIntParam)
|
||||
ZtCStringStd& operator()(ZTypUInt AUI_UIntParam)
|
||||
{
|
||||
const int CI_BuffSize=21; char VCA_BuffParam[CI_BuffSize];
|
||||
|
||||
@ -346,9 +361,9 @@ namespace ZNsMain
|
||||
|
||||
return (*this)(VCA_BuffParam, VI_ResultSize);
|
||||
}/*
|
||||
ZCStringStd& operator()(ZTypUInt AUI_UIntParam)*/
|
||||
ZtCStringStd& operator()(ZTypUInt AUI_UIntParam)*/
|
||||
|
||||
ZCStringStd& operator()(long AL_LongParam)
|
||||
ZtCStringStd& operator()(long AL_LongParam)
|
||||
{
|
||||
const int CI_BuffSize=31; char VCA_BuffParam[CI_BuffSize];
|
||||
|
||||
@ -356,9 +371,9 @@ namespace ZNsMain
|
||||
|
||||
return (*this)(VCA_BuffParam, VI_ResultSize);
|
||||
}/*
|
||||
ZCStringStd& operator()(long AL_LongParam)*/
|
||||
ZtCStringStd& operator()(long AL_LongParam)*/
|
||||
|
||||
ZCStringStd& operator()(ZTypULong AUL_ULongParam)
|
||||
ZtCStringStd& operator()(ZTypULong AUL_ULongParam)
|
||||
{
|
||||
const int CI_BuffSize=31; char VCA_BuffParam[CI_BuffSize];
|
||||
|
||||
@ -366,9 +381,9 @@ namespace ZNsMain
|
||||
|
||||
return (*this)(VCA_BuffParam, VI_ResultSize);
|
||||
}/*
|
||||
ZCStringStd& operator()(ZTypULong AUL_ULongParam)*/
|
||||
ZtCStringStd& operator()(ZTypULong AUL_ULongParam)*/
|
||||
|
||||
ZCStringStd& operator()(ZTypLLong ALL_LLongParam)
|
||||
ZtCStringStd& operator()(ZTypLLong ALL_LLongParam)
|
||||
{
|
||||
const int CI_BuffSize=41; char VCA_BuffParam[CI_BuffSize];
|
||||
|
||||
@ -380,9 +395,9 @@ namespace ZNsMain
|
||||
|
||||
return (*this)(VCA_BuffParam, VI_ResultSize);
|
||||
}/*
|
||||
ZCStringStd& operator()(ZTypLLong ALL_LLongParam)*/
|
||||
ZtCStringStd& operator()(ZTypLLong ALL_LLongParam)*/
|
||||
|
||||
ZCStringStd& operator()(ZTypULLong AULL_LLongParam)
|
||||
ZtCStringStd& operator()(ZTypULLong AULL_LLongParam)
|
||||
{
|
||||
const int CI_BuffSize=41; char VCA_BuffParam[CI_BuffSize];
|
||||
|
||||
@ -394,9 +409,9 @@ namespace ZNsMain
|
||||
|
||||
return (*this)(VCA_BuffParam, VI_ResultSize);
|
||||
}/*
|
||||
ZCStringStd& operator()(ZTypULLong AULL_LLongParam)*/
|
||||
ZtCStringStd& operator()(ZTypULLong AULL_LLongParam)*/
|
||||
|
||||
ZCStringStd& operator()(double AD_DoubleParam)
|
||||
ZtCStringStd& operator()(double AD_DoubleParam)
|
||||
{
|
||||
const int CI_BuffSize=51 ;
|
||||
char VCA_BuffParam[CI_BuffSize];
|
||||
@ -409,21 +424,28 @@ namespace ZNsMain
|
||||
|
||||
return (*this)(VCA_BuffParam);
|
||||
}/*
|
||||
ZCStringStd& operator()(double AD_DoubleParam)*/
|
||||
ZtCStringStd& operator()(double AD_DoubleParam)*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
class ZCStringStd : public std::string*/
|
||||
template
|
||||
< typename TTypString = std::string >
|
||||
class ZtCStringStd : public TTypString */
|
||||
|
||||
|
||||
|
||||
std::ostream& operator <<
|
||||
(std::ostream& AR_COStream, const ZCStringStd& AR_CStringBase)
|
||||
template<typename TTypString> std::ostream& operator<<
|
||||
(std::ostream& AR_COStream, const ZtCStringStd<TTypString>& AR_DataCStr)
|
||||
{
|
||||
AR_COStream<<static_cast<const std::string&>(AR_CStringBase); return AR_COStream;
|
||||
typedef typename ZtCStringStd
|
||||
<TTypString>::TypeBase TypeBaseCStr ;
|
||||
|
||||
AR_COStream<< static_cast
|
||||
<const TypeBaseCStr&>(AR_DataCStr);
|
||||
|
||||
return AR_COStream; ///////////////////////////
|
||||
}/*
|
||||
std::ostream& operator <<
|
||||
(std::ostream& AR_COStream, const ZCStringStd& AR_CStringBase)*/
|
||||
template<typename TTypString> std::ostream& operator<<
|
||||
(std::ostream& AR_COStream, const ZtCStringStd& AR_DataCStr)*/
|
||||
|
||||
|
||||
}/*
|
||||
@ -431,4 +453,4 @@ namespace ZNsMain*/
|
||||
|
||||
|
||||
|
||||
#endif //__ZCPPMAIIN_ZCSTRINGSTD_H__
|
||||
#endif //__ZCPPMAIIN_ZTCSTRINGSTD_H__
|
Reference in New Issue
Block a user