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

@ -5408,13 +5408,41 @@ namespace ZNsMain
//////////////////////////////////////////// ////////////////////////////////////////////
template<> string& ZftMakeStr(string& ARR_SaveCStr, const string& AR_DataCStr) template<> string& ZftMakeStr(string& ARR_SaveCStr, const string& AR_DataCStr)
{ { ARR_SaveCStr.append(AR_DataCStr); return ARR_SaveCStr; }
ARR_SaveCStr.append(AR_DataCStr); return ARR_SaveCStr; template<> wstring& ZftMakeStr(wstring& ARR_SaveCStr, const wstring& AR_DataCStr)
}/* { ARR_SaveCStr.append(AR_DataCStr); return ARR_SaveCStr; }
template<> string& ZftMakeStr(string& ARR_SaveCStr, const string& AR_DataCStr)*/ /*#############################################################################*/
template<> string& ZftMakeStr(string& ARR_SaveCStr, long AL_Long)
//::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%d", AI_IntParam)
template<> string& ZftMakeStr(string& ARR_SaveCStr, int AI_Int)
{
ZTycInt CI_BuffSize = 31 ;
ZTypChar VCA_BuffParam[CI_BuffSize] ;
ZTypInt VI_ResultSize =
::sprintf(VCA_BuffParam, "%d", AI_Int);
return ARR_SaveCStr.append
(VCA_BuffParam, VI_ResultSize);
}/*
template<> string& ZftMakeStr(string& ARR_SaveCStr, int AI_Int)*/
template<> wstring& ZftMakeStr(wstring& ARR_SaveCStr, int AI_Int)
{
ZTycInt CI_BuffSize = 31 ;
ZTypCharW VCA_BuffParam[CI_BuffSize] ;
ZTypInt VI_ResultSize = ::swprintf
(VCA_BuffParam, CI_BuffSize, L"%d", AI_Int);
return ARR_SaveCStr.append
(VCA_BuffParam, VI_ResultSize) ;
}/*
template<> string& ZftMakeStr(string& ARR_SaveCStr, int AI_Int)*/
template<> string& ZftMakeStr(string& ARR_SaveCStr, long AL_Long)
{ {
ZTycInt CI_BuffSize = 31 ; ZTycInt CI_BuffSize = 31 ;
ZTypChar VCA_BuffParam[CI_BuffSize] ; ZTypChar VCA_BuffParam[CI_BuffSize] ;
@ -5422,48 +5450,99 @@ namespace ZNsMain
ZTypInt VI_ResultSize = ZTypInt VI_ResultSize =
::sprintf(VCA_BuffParam, "%ld", AL_Long); ::sprintf(VCA_BuffParam, "%ld", AL_Long);
ARR_SaveCStr.append return ARR_SaveCStr.append
(VCA_BuffParam, VI_ResultSize); (VCA_BuffParam, VI_ResultSize);
}/*
template<> string& ZftMakeStr(string& ARR_SaveCStr, long AL_Long)*/
template<> wstring& ZftMakeStr(wstring& ARR_SaveCStr, long AL_Long)
{
ZTycInt CI_BuffSize = 31 ;
ZTypCharW VCA_BuffParam[CI_BuffSize] ;
ZTypInt VI_ResultSize = ::swprintf
(VCA_BuffParam, CI_BuffSize, L"%ld", AL_Long);
ARR_SaveCStr.append
(VCA_BuffParam, VI_ResultSize) ;
return ARR_SaveCStr; return ARR_SaveCStr;
}/* }/*
template<> string& ZftMakeStr(string& ARR_SaveCStr, long AL_Long)*/ template<> wstring& ZftMakeStr(wstring& ARR_SaveCStr, long AL_Long)*/
template<> string& ZftMakeStr(string& ARR_SaveCStr, double AD_Double) template<> string& ZftMakeStr(string& ARR_SaveCStr, ZTypLLong ALL_Long)
{
ZTycInt CI_BuffSize = 41 ;
ZTypChar VCA_BuffParam[CI_BuffSize] ;
#ifdef _WIN
ZTypInt VI_ResultSize =
( ::sprintf(VCA_BuffParam, "%I64u", ALL_Long) );
#else
ZTypInt VI_ResultSize =
( ::sprintf(VCA_BuffParam, "%llu" , ALL_Long) );
#endif
return ARR_SaveCStr.append
(VCA_BuffParam, VI_ResultSize);
}/*
template<> string& ZftMakeStr(string& ARR_SaveCStr, ZTypLLong ALL_Long)*/
template<> wstring& ZftMakeStr(wstring& ARR_SaveCStr, ZTypLLong ALL_Long)
{
ZTycInt CI_BuffSize = 41 ;
ZTypCharW VCA_BuffParam[CI_BuffSize] ;
#ifdef _WIN
ZTypInt VI_ResultSize = ::swprintf
(VCA_BuffParam, CI_BuffSize, L"%I64u", ALL_Long) ;
#else
ZTypInt VI_ResultSize = ::swprintf
(VCA_BuffParam, CI_BuffSize, L"%llu" , ALL_Long) ;
#endif
return ARR_SaveCStr.append
(VCA_BuffParam, VI_ResultSize);
}/*
template<> wstring& ZftMakeStr(wstring& ARR_SaveCStr, ZTypLLong ALL_Long)*/
template<> string& ZftMakeStr(string& ARR_SaveCStr, double AD_Double)
{ {
ZTycInt CI_BuffSize=51 ; ZTycInt CI_BuffSize=51 ;
ZTypChar VCA_BuffParam[CI_BuffSize]; ZTypChar VCA_BuffParam[CI_BuffSize];
ZTypInt VI_ResultSize = ::sprintf ZTypInt VI_ResultSize = ::sprintf
( ( VCA_BuffParam, "%f", AD_Double );
VCA_BuffParam, "%f", AD_Double /********************************/
);
/////////////////////////////
ARR_SaveCStr.append return ARR_SaveCStr.append
(VCA_BuffParam, VI_ResultSize); (VCA_BuffParam, VI_ResultSize);
return ARR_SaveCStr;
}/* }/*
template<> string& ZftMakeStr(string& ARR_SaveCStr, double AD_Double)*/ template<> string& ZftMakeStr(string& ARR_SaveCStr, double AD_Double)*/
template<> wstring& ZftMakeStr(wstring& ARR_SaveCStr, double AD_Double)
template<> string& ZftMakeStr(string& ARR_SaveCStr, bool AB_Bool)
{ {
if (AB_Bool) ZTycInt CI_BuffSize=51 ;
ARR_SaveCStr.append("true" ); ZTypCharW VCA_BuffParam[CI_BuffSize];
else ARR_SaveCStr.append("false");
return ARR_SaveCStr; ZTypInt VI_ResultSize = ::swprintf
(VCA_BuffParam, CI_BuffSize, L"%f", AD_Double);
/*********************************/
return ARR_SaveCStr.append
(VCA_BuffParam, VI_ResultSize);
}/* }/*
template<> string& ZftMakeStr(string& ARR_SaveCStr, bool AB_Bool)*/ template<> wstring& ZftMakeStr(wstring& ARR_SaveCStr, double AD_Double)*/
template<> string& ZftMakeStr(string& ARR_SaveCStr, bool AB_Bool)
{ return ARR_SaveCStr.append( AB_Bool ? "true" : "false" ); }
template<> wstring& ZftMakeStr(wstring& ARR_SaveCStr, bool AB_Bool)
{ return ARR_SaveCStr.append( AB_Bool ? L"true" : L"false" ); }
template<typename TTypeChar, typename TTypeLength> template<typename TTypeChar, typename TTypeLength>
class ZtCChars ; class ZtCChars ;
/*++++++++++++++++++++++++++++++++++++++++++++++*/ /*++++++++++++++++++++++++++++++++++++++++++++++*/
template<> string& ZftMakeStr template<> string & ZftMakeStr
(string& ARR_SaveCStr, const ZtCChars<char, ZTypLength>& AR_View); (string& ARR_SaveCStr, const ZtCChars<char , ZTypLength>& AR_View);
template<> wstring& ZftMakeStr
(wstring& ARR_SaveCStr, const ZtCChars<wchar_t, ZTypLength>& AR_View);
@ -7186,8 +7265,9 @@ namespace ZNsMain
explicit ZtCChars(TypeCharC* APC_TypeChar) explicit ZtCChars(TypeCharC* APC_TypeChar)
{ {
mp_TypeChar = mp_TypeChar =
const_cast<TypeChar*>(APC_TypeChar); const_cast<TypeChar*> (APC_TypeChar);
ml_TypeSize = ZftGetLength(mp_TypeChar); ml_TypeSize = ZftLengthType
<TypeSize, TypeChar > (mp_TypeChar );
}/* }/*
explicit ZtCChars(TypeCharC* APC_TypeChar)*/ explicit ZtCChars(TypeCharC* APC_TypeChar)*/
@ -7195,14 +7275,15 @@ namespace ZNsMain
{ {
mp_TypeChar = const_cast mp_TypeChar = const_cast
<TypeChar*>(APC_TypeChar); <TypeChar*>(APC_TypeChar);
ml_TypeSize = AL_Length ; ml_TypeSize = AL_Length ;
}/* }/*
ZtCChars(TypeCharC* APC_TypeChar, TypeSize AL_Length)*/ ZtCChars(TypeCharC* APC_TypeChar, TypeSize AL_Length)*/
ZtCChars(const ZtCChars& rhs) ZtCChars(const ZtCChars& rhs)
{ {
mp_TypeChar = const_cast<ZtCChars&>(rhs).mp_TypeChar ; mp_TypeChar = const_cast
ml_TypeSize = const_cast<ZtCChars&>(rhs).ml_TypeSize ; <TypeChar*>( rhs.mp_TypeChar ) ;
ml_TypeSize = rhs.ml_TypeSize ;
}/* }/*
ZtCChars(const ZtCChars& rhs)*/ ZtCChars(const ZtCChars& rhs)*/
@ -7462,11 +7543,16 @@ namespace ZNsMain
template<> string& ZftMakeStr(string& ARR_SaveCStr, const ZCCharView& AR_View) template<> string& ZftMakeStr(string& ARR_SaveCStr, const ZCCharView& AR_View)
{ {
ARR_SaveCStr.append(AR_View.data(), AR_View.size()); return ARR_SaveCStr; ARR_SaveCStr.append(AR_View.data(), AR_View.size()); return ARR_SaveCStr;
}/* }/*
template<> string& ZftMakeStr(string& ARR_SaveCStr, const ZCCharView& AR_View)*/ template<> string& ZftMakeStr(string& ARR_SaveCStr, const ZCCharView& AR_View)*/
template<> wstring& ZftMakeStr(wstring& ARR_SaveCStr, const ZCCharViewW& AR_View)
{
ARR_SaveCStr.append(AR_View.data(), AR_View.size()); return ARR_SaveCStr;
}/*
template<> wstring& ZftMakeStr(wstring& ARR_SaveCStr, const ZCCharViewW& AR_View)*/
/*////////////////////////////////////////////////////////////////////////////////////// /*//////////////////////////////////////////////////////////////////////////////////////
@ -7556,6 +7642,69 @@ namespace ZNsMain
template<> class ZtCCharType<std::wstring>*/ template<> class ZtCCharType<std::wstring>*/
template<typename TTypChar, typename TTypLength> class ZtCBoolStr
{
public:
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
typedef ZtCChars<TTypChar, TTypLength> ZCChars;
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
static const ZCChars& GetMarkTrue ()
{ static const ZCChars SO_ZCChars; return SO_ZCChars; }
static const ZCChars& GetMarkFalse()
{ static const ZCChars SO_ZCChars; return SO_ZCChars; }
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
static const ZCChars& GetMark(bool AB_Bool)
{
return AB_Bool ? GetMarkTrue() : GetMarkFalse();
}
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
public:
};
/*##############################################################################*/
template<typename TTypLength>
class ZtCBoolStr<char, TTypLength> /*+++++++++++++++++++++++++++++++*/
{
public:
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
typedef ZtCChars<char, TTypLength> ZCChars;
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
static const ZCChars& GetMarkTrue ()
{ static const ZCChars SO_ZCChars("true" ); return SO_ZCChars; }
static const ZCChars& GetMarkFalse()
{ static const ZCChars SO_ZCChars("false"); return SO_ZCChars; }
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
static const ZCChars& GetMark(bool AB_Bool)
{
return AB_Bool ? GetMarkTrue() : GetMarkFalse();
}
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
public:
};
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
template<typename TTypLength>
class ZtCBoolStr<wchar_t, TTypLength> /*++++++++++++++++++++++++++++*/
{
public:
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
typedef ZtCChars<wchar_t, TTypLength> ZCChars;
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
static const ZCChars& GetMarkTrue ()
{ static const ZCChars SO_ZCChars(L"true" ); return SO_ZCChars; }
static const ZCChars& GetMarkFalse()
{ static const ZCChars SO_ZCChars(L"false"); return SO_ZCChars; }
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
static const ZCChars& GetMark(bool AB_Bool)
{
return AB_Bool ? GetMarkTrue() : GetMarkFalse();
}
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
public:
};
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
namespace ZNsView namespace ZNsView
{ {

View File

@ -194,13 +194,14 @@ namespace ZNsMain
{ {
public: public:
typedef TTypeChar TypeChar ; typedef TTypeChar TypeChar ;
typedef TTypeLength TypeLength; // signed 형이어야 한다. typedef TTypeLength TypeLength;
public: /*++++++++++++++++++++++++++++++++++++++++++++++++++++*/
typedef const TypeChar TypeCharC ; typedef const TypeChar TypeCharC ;
typedef const TypeChar* TypeCharCP; typedef const TypeChar* TypeCharCP;
public: /*++++++++++++++++++++++++++++++++++++++++++++++++++++*/
typedef ZNsMain::ZtCChars<TTypeChar, TTypeLength> ZCChars; typedef ZNsMain::ZtCChars
public: <TTypeChar, TTypeLength> ZCChars;
/*++++++++++++++++++++++++++++++++++++++++++++++++++++*/
static TypeChar GetCharOfAnsi(char AC_AnsiChar) static TypeChar GetCharOfAnsi(char AC_AnsiChar)
{ {

View File

@ -1706,6 +1706,19 @@ namespace ZNsMain
}/* }/*
ZCStringBase& operator()(double AD_DoubleParam)*/ ZCStringBase& operator()(double AD_DoubleParam)*/
ZCStringBase& 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) );
}/*
ZCStringBase& operator()(bool AB_Bool)*/
ZCStringBase& operator()( ZCStringBase& operator()(
TypeLength AL_AddSize, TypeCharC* APC_Format, ...) TypeLength AL_AddSize, TypeCharC* APC_Format, ...)
{ {
@ -7448,7 +7461,8 @@ namespace ZNsMain
void erase(){ clear(); } void erase(){ clear(); }
public:*/ public:
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
public: public:
@ -7551,7 +7565,8 @@ namespace ZNsMain
{ return ARR_SaveCStr(AR_DataCStr); } { return ARR_SaveCStr(AR_DataCStr); }
_ZCSTRINGBASE_ARG_ _ZCSTRINGBASE_& ZftMakeStr _ZCSTRINGBASE_ARG_ _ZCSTRINGBASE_& ZftMakeStr
( _ZCSTRINGBASE_& ARR_SaveCStr, char AC_Char ) ( _ZCSTRINGBASE_& ARR_SaveCStr, typename
_ZCSTRINGBASE_::TypeChar AC_Char )
{ return ARR_SaveCStr(AC_Char ); } { return ARR_SaveCStr(AC_Char ); }
_ZCSTRINGBASE_ARG_ _ZCSTRINGBASE_& ZftMakeStr _ZCSTRINGBASE_ARG_ _ZCSTRINGBASE_& ZftMakeStr
@ -7569,13 +7584,15 @@ namespace ZNsMain
_ZCSTRINGBASE_ARG_ _ZCSTRINGBASE_& ZftMakeStr _ZCSTRINGBASE_ARG_ _ZCSTRINGBASE_& ZftMakeStr
( _ZCSTRINGBASE_& ARR_SaveCStr, bool AB_Bool ) ( _ZCSTRINGBASE_& ARR_SaveCStr, bool AB_Bool )
{ {
if (AB_Bool) typedef typename _ZCSTRINGBASE_::TypeChar TypeChar;
ARR_SaveCStr.append("true" ); typedef typename _ZCSTRINGBASE_::TypeSize TypeSize;
else ARR_SaveCStr.append("false");
return ARR_SaveCStr; typedef ZtCBoolStr<TypeChar, TypeSize> ZCBoolStr;
return ARR_SaveCStr(ZCBoolStr::GetMark(AB_Bool));
}/* }/*
_ZCSTRINGBASE_& ZftMakeStr( _ZCSTRINGBASE_& ARR_SaveCStr, bool AB_Bool)*/ _ZCSTRINGBASE_ARG_ _ZCSTRINGBASE_& ZftMakeStr
( _ZCSTRINGBASE_& ARR_SaveCStr, bool AB_Bool ) */
#undef _ZCSTRINGBASE_ #undef _ZCSTRINGBASE_

View File

@ -45,9 +45,12 @@ namespace ZNsMain
class ZtCStringStd : public TTypString class ZtCStringStd : public TTypString
{ {
public: public:
typedef ZtCStringStd TypeThis;
/*+++++++++++++++++++++++++++++++++++++++++++++++++*/
typedef typename TTypString::traits_type::char_type TypeChar ; typedef typename TTypString::traits_type::char_type TypeChar ;
typedef typename TTypString::traits_type::int_type TypeCharInt ; typedef typename TTypString::traits_type::int_type TypeCharInt ;
public: typedef typename TTypString::size_type TypeLength ;
/*+++++++++++++++++++++++++++++++++++++++++++++++++*/
typedef ZNsChars::ZNsType:: typedef ZNsChars::ZNsType::
ZtCTypeChars <TypeChar > ZCTypeChars ; ZtCTypeChars <TypeChar > ZCTypeChars ;
typedef ZNsChars:: typedef ZNsChars::
@ -57,12 +60,13 @@ namespace ZNsMain
typedef const TypeChar* TypeCPChar ; typedef const TypeChar* TypeCPChar ;
typedef TTypString TypeBase ; typedef TTypString TypeBase ;
typedef TTypString TypeStrStd ; typedef TTypString TypeStrStd ;
typedef ZTypLength TypeLength ; typedef TypeLength TypeSize ;
typedef ZTypLength TypeSize ; /*+++++++++++++++++++++++++++++++++++++++++++++++++*/
typedef ZtCChars
<TypeChar, TypeLength> ZCChars ;
typedef ZtCChars
<TypeChar, TypeLength> ZCCharView ;
/*+++++++++++++++++++++++++++++++++++++++++++++++++*/ /*+++++++++++++++++++++++++++++++++++++++++++++++++*/
typedef ZtCChars<TypePChar> ZCChars ;
typedef ZtCChars<TypePChar> ZCCharView ;
public:
ZtCStringStd(): TypeStrStd(){} ZtCStringStd(): TypeStrStd(){}
ZtCStringStd(const ZtCStringStd& rhs): TypeStrStd(rhs){} ZtCStringStd(const ZtCStringStd& rhs): TypeStrStd(rhs){}
@ -389,6 +393,24 @@ namespace ZNsMain
}/* }/*
ZtCStringStd& operator()(TypeChar AC_Data, TypeLength AI_Repeat=1)*/ 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) ZtCStringStd& operator()(int AI_IntParam)
{ {
@ -520,6 +542,58 @@ namespace ZNsMain
class ZtCStringStd : public TTypString */ 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<< template<typename TTypString> std::ostream& operator<<
(std::ostream& AR_COStream, const ZtCStringStd<TTypString>& AR_DataCStr) (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& 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*/ namespace ZNsMain*/

View File

@ -22,10 +22,12 @@ namespace ZNsMain
typedef ZCStringBase ::ZCCharView ZCCharView ; typedef ZCStringBase ::ZCCharView ZCCharView ;
typedef ZCStringBaseW::ZCCharView ZCCharViewW ; typedef ZCStringBaseW::ZCCharView ZCCharViewW ;
typedef ZCStringStd ::ZCCharView ZCCharViewS ;
typedef ZCStringStdW ::ZCCharView ZCCharViewSW ;
typedef ZtCCharType<ZCStringBase> ZCCharType ; typedef ZtCCharType<ZCStringBase> ZCCharType ;
typedef ZtCCharType<ZCStringBaseW> ZCCharTypeW ; typedef ZtCCharType<ZCStringBaseW> ZCCharTypeW ;
typedef ZtCCharType<ZCStringStd > ZCCharTypeS ; typedef ZtCCharType<ZCStringStd > ZCCharTypeS ;
typedef ZtCCharType<ZCStringStdW > ZCCharTypeSW ; typedef ZtCCharType<ZCStringStdW> ZCCharTypeSW ;
typedef ZCCharType ::TypeChar TypeChar ; typedef ZCCharType ::TypeChar TypeChar ;
typedef ZCCharTypeW ::TypeChar TypeCharW ; typedef ZCCharTypeW ::TypeChar TypeCharW ;
@ -123,7 +125,7 @@ namespace ZNsMain
ZCStringBase VO_ZCStringStd(CO_ZCCharView); ZCStringBase VO_ZCStringStd(CO_ZCCharView);
cout<<"# "<<VO_ZCStringStd<<endl; cout<<"# "<<VO_ZCStringStd<<endl;
cout<<"* after Replace('12', '***')"<<endl; cout<<"* after VO_ZCStringStd.Replace('12', '***')"<<endl;
VO_ZCStringStd.Replace(ZCCharView("12"), ZCCharView("***")); VO_ZCStringStd.Replace(ZCCharView("12"), ZCCharView("***"));
cout<<"# "<<VO_ZCStringStd<<endl; cout<<"# "<<VO_ZCStringStd<<endl;
cout<<"*****************************************************"<<endl; cout<<"*****************************************************"<<endl;
@ -154,19 +156,32 @@ namespace ZNsMain
cout<<"*****************************************************"<<endl; cout<<"*****************************************************"<<endl;
ZftMakeStr(VO_ZCStringStd, 1234); ZftMakeStr(VO_ZCStringStd , 1234);
ZftMakeStr(VO_ZCStringStd, ZCCharView("--")); ZftMakeStr(VO_ZCStringStd , ZCCharView("--"));
ZftMakeStr(VO_ZCStringStd, double(10.01)); ZftMakeStr(VO_ZCStringStd , double(10.01));
ZftMakeStr(VO_ZCStringStd, true); ZftMakeStr(VO_ZCStringStd , true);
ZftMakeStr(VO_ZCStringStd,'Z'); ZftMakeStr(VO_ZCStringStd , 'Z');
ZftMakeStr(VO_ZCStringStd, ZCCharView("_Z_")); ZftMakeStr(VO_ZCStringStd , ZCCharView("_Z_"));
ZftMakeStr(VO_ZCStringStdW, 1234);
ZftMakeStr(VO_ZCStringStdW, ZCCharViewSW(L"--"));
ZftMakeStr(VO_ZCStringStdW, double(10.01));
ZftMakeStr(VO_ZCStringStdW, true);
ZftMakeStr(VO_ZCStringStdW, L'Z');
ZftMakeStr(VO_ZCStringStdW, ZCCharViewSW(L"_Z_"));
VO_ZCStringStdW(false);
cout<<"* after ZftMakeStr(VO_ZCStringStd, ~)"<<endl; cout<<"* after ZftMakeStr(VO_ZCStringStd, ~)"<<endl;
cout<<"# "<<VO_ZCStringStd<<endl; cout<<"# "<<VO_ZCStringStd<<endl;
cout<<"*****************************************************"<<endl; cout<<"*****************************************************"<<endl;
cout<<"* after Replace('T#', '')"<<endl; cout<<"* after ZftMakeStr(VO_ZCStringStdW, ~)"<<endl;
cout<<"# "<<VO_ZCStringStdW<<endl;
cout<<"*****************************************************"<<endl;
cout<<"* after VO_ZCStringStd.Replace('T#', '')"<<endl;
VO_ZCStringStd.Replace(ZCCharView("T#"), ZCCharView("")); VO_ZCStringStd.Replace(ZCCharView("T#"), ZCCharView(""));
cout<<"# "<<VO_ZCStringStd<<endl; cout<<"# "<<VO_ZCStringStd<<endl;
cout<<"*****************************************************"<<endl; cout<<"*****************************************************"<<endl;