commit 2025-10-09 21:53 add ZtCBoolStr : ZCppMain/ZMainHead.H

This commit is contained in:
2025-10-09 21:54:07 +09:00
parent f5957100ea
commit 860d383da6
5 changed files with 359 additions and 61 deletions

View File

@ -45,9 +45,12 @@ namespace ZNsMain
class ZtCStringStd : public TTypString
{
public:
typedef ZtCStringStd TypeThis;
/*+++++++++++++++++++++++++++++++++++++++++++++++++*/
typedef typename TTypString::traits_type::char_type TypeChar ;
typedef typename TTypString::traits_type::int_type TypeCharInt ;
public:
typedef typename TTypString::size_type TypeLength ;
/*+++++++++++++++++++++++++++++++++++++++++++++++++*/
typedef ZNsChars::ZNsType::
ZtCTypeChars <TypeChar > ZCTypeChars ;
typedef ZNsChars::
@ -57,12 +60,13 @@ namespace ZNsMain
typedef const TypeChar* TypeCPChar ;
typedef TTypString TypeBase ;
typedef TTypString TypeStrStd ;
typedef ZTypLength TypeLength ;
typedef ZTypLength TypeSize ;
typedef TypeLength TypeSize ;
/*+++++++++++++++++++++++++++++++++++++++++++++++++*/
typedef ZtCChars
<TypeChar, TypeLength> ZCChars ;
typedef ZtCChars
<TypeChar, TypeLength> ZCCharView ;
/*+++++++++++++++++++++++++++++++++++++++++++++++++*/
typedef ZtCChars<TypePChar> ZCChars ;
typedef ZtCChars<TypePChar> ZCCharView ;
public:
ZtCStringStd(): TypeStrStd(){}
ZtCStringStd(const ZtCStringStd& rhs): TypeStrStd(rhs){}
@ -389,6 +393,24 @@ namespace ZNsMain
}/*
ZtCStringStd& operator()(TypeChar AC_Data, TypeLength AI_Repeat=1)*/
ZtCStringStd& operator()(const ZCCharView& AR_View)
{
this->append(AR_View.data(), AR_View.size()); return *this;
}/*
ZtCStringStd& operator()(const ZCCharView& AR_View)*/
ZtCStringStd& operator()(bool AB_Bool)
{
typedef typename TypeThis::TypeChar TypeChar ;
typedef typename TypeThis::TypeSize TypeSize ;
typedef ZtCBoolStr
<TypeChar, TypeSize> ZCBoolStr;
return (*this)( ZCBoolStr::GetMark(AB_Bool) );
}/*
ZtCStringStd& operator()(bool AB_Bool)*/
ZtCStringStd& operator()(int AI_IntParam)
{
@ -520,6 +542,58 @@ namespace ZNsMain
class ZtCStringStd : public TTypString */
typedef ZtCStringStd<std::string > ZCStringStd ;
typedef ZtCStringStd<std::wstring> ZCStringStdW;
#define _ZCSTRINGSTD_ ZtCStringStd< TTypString >
#define _ZCSTRINGSTD_ARG_ template< typename TTypString >
_ZCSTRINGSTD_ARG_ _ZCSTRINGSTD_& ZftMakeStr
( _ZCSTRINGSTD_& ARR_SaveCStr, const _ZCSTRINGSTD_& AR_DataCStr)
{ return ARR_SaveCStr(AR_DataCStr); }
_ZCSTRINGSTD_ARG_ _ZCSTRINGSTD_& ZftMakeStr
( _ZCSTRINGSTD_& ARR_SaveCStr, const typename
_ZCSTRINGSTD_::ZCChars& AR_DataCStr )
{ return ARR_SaveCStr(AR_DataCStr); }
_ZCSTRINGSTD_ARG_ _ZCSTRINGSTD_& ZftMakeStr
( _ZCSTRINGSTD_& ARR_SaveCStr, typename
_ZCSTRINGSTD_::TypeChar AC_Char )
{ return ARR_SaveCStr(AC_Char ); }
_ZCSTRINGSTD_ARG_ _ZCSTRINGSTD_& ZftMakeStr
( _ZCSTRINGSTD_& ARR_SaveCStr, int AI_IntI )
{ return ARR_SaveCStr(AI_IntI ); }
_ZCSTRINGSTD_ARG_ _ZCSTRINGSTD_& ZftMakeStr
( _ZCSTRINGSTD_& ARR_SaveCStr, long AL_Long )
{ return ARR_SaveCStr(AL_Long ); }
_ZCSTRINGSTD_ARG_ _ZCSTRINGSTD_& ZftMakeStr
( _ZCSTRINGSTD_& ARR_SaveCStr, double AD_Double )
{ return ARR_SaveCStr(AD_Double ); }
_ZCSTRINGSTD_ARG_ _ZCSTRINGSTD_& ZftMakeStr
( _ZCSTRINGSTD_& ARR_SaveCStr, bool AB_Bool )
{
typedef typename _ZCSTRINGSTD_::TypeChar TypeChar;
typedef typename _ZCSTRINGSTD_::TypeSize TypeSize;
typedef ZtCBoolStr<TypeChar, TypeSize> ZCBoolStr;
return ARR_SaveCStr(ZCBoolStr::GetMark(AB_Bool));
}/*
_ZCSTRINGSTD_ARG_ _ZCSTRINGSTD_& ZftMakeStr
( _ZCSTRINGSTD_& ARR_SaveCStr, bool AB_Bool ) */
#undef _ZCSTRINGSTD_
#undef _ZCSTRINGSTD_ARG_
template<typename TTypString> std::ostream& operator<<
(std::ostream& AR_COStream, const ZtCStringStd<TTypString>& AR_DataCStr)
{
@ -535,6 +609,48 @@ namespace ZNsMain
(std::ostream& AR_COStream, const ZtCStringStd& AR_DataCStr)*/
std::ostream& operator<<
(std::ostream& AR_COStream, const ZCStringStd& AR_DataCStr)
{
typedef ZCStringStd::TypeBase TypeBaseCStr;
AR_COStream<< static_cast
<const TypeBaseCStr&>( AR_DataCStr );
return AR_COStream; /*********************/
}/*
template<typename TTypString> std::ostream& operator<<
(std::ostream& AR_COStream, const ZtCStringStd& AR_DataCStr)*/
std::ostream& operator<<
(std::ostream& AR_COStream, const ZCStringStdW& AR_DataCStr)
{
// ascii 코드 범위에서만 출력한다.
typedef ZCStringStdW::TypeSize TypeLength ;
typedef ZCStringStdW::TypeCharInt TypeCharInt;
ZTypCCharW* VP_Data = AR_DataCStr.data();
TypeLength VI_Size = AR_DataCStr.size();
const int CI_AsciiMax = 127 ;
__for0(TypeLength, i, VI_Size)
{
TypeCharInt VI_Code = TypeCharInt(*VP_Data++);
if(VI_Code>0 && VI_Code<=CI_AsciiMax)
{ AR_COStream.put( char(VI_Code) ); }
}/*
__for0(TypeLength, i, VI_Size)*/
return AR_COStream; /*********************/
}/*
template<typename TTypString> std::ostream& operator<<
(std::ostream& AR_COStream, const ZtCStringStd& AR_DataCStr)*/
}/*
namespace ZNsMain*/