commit 2025-10-09 21:53 add ZtCBoolStr : ZCppMain/ZMainHead.H
This commit is contained in:
@ -5408,13 +5408,41 @@ namespace ZNsMain
|
||||
////////////////////////////////////////////
|
||||
|
||||
|
||||
template<> string& ZftMakeStr(string& ARR_SaveCStr, const string& 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, const string& AR_DataCStr)
|
||||
{ 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, 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 ;
|
||||
ZTypChar VCA_BuffParam[CI_BuffSize] ;
|
||||
@ -5422,48 +5450,99 @@ namespace ZNsMain
|
||||
ZTypInt VI_ResultSize =
|
||||
::sprintf(VCA_BuffParam, "%ld", AL_Long);
|
||||
|
||||
ARR_SaveCStr.append
|
||||
return ARR_SaveCStr.append
|
||||
(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;
|
||||
}/*
|
||||
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 ;
|
||||
ZTypChar VCA_BuffParam[CI_BuffSize];
|
||||
|
||||
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);
|
||||
|
||||
return ARR_SaveCStr;
|
||||
}/*
|
||||
template<> string& ZftMakeStr(string& ARR_SaveCStr, double AD_Double)*/
|
||||
|
||||
template<> string& ZftMakeStr(string& ARR_SaveCStr, bool AB_Bool)
|
||||
template<> string& ZftMakeStr(string& ARR_SaveCStr, double AD_Double)*/
|
||||
template<> wstring& ZftMakeStr(wstring& ARR_SaveCStr, double AD_Double)
|
||||
{
|
||||
if (AB_Bool)
|
||||
ARR_SaveCStr.append("true" );
|
||||
else ARR_SaveCStr.append("false");
|
||||
ZTycInt CI_BuffSize=51 ;
|
||||
ZTypCharW VCA_BuffParam[CI_BuffSize];
|
||||
|
||||
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>
|
||||
class ZtCChars ;
|
||||
/*++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
|
||||
template<> string& ZftMakeStr
|
||||
(string& ARR_SaveCStr, const ZtCChars<char, ZTypLength>& AR_View);
|
||||
template<> string & ZftMakeStr
|
||||
(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)
|
||||
{
|
||||
mp_TypeChar =
|
||||
const_cast<TypeChar*>(APC_TypeChar);
|
||||
ml_TypeSize = ZftGetLength(mp_TypeChar);
|
||||
const_cast<TypeChar*> (APC_TypeChar);
|
||||
ml_TypeSize = ZftLengthType
|
||||
<TypeSize, TypeChar > (mp_TypeChar );
|
||||
}/*
|
||||
explicit ZtCChars(TypeCharC* APC_TypeChar)*/
|
||||
|
||||
@ -7195,14 +7275,15 @@ namespace ZNsMain
|
||||
{
|
||||
mp_TypeChar = const_cast
|
||||
<TypeChar*>(APC_TypeChar);
|
||||
ml_TypeSize = AL_Length ;
|
||||
ml_TypeSize = AL_Length ;
|
||||
}/*
|
||||
ZtCChars(TypeCharC* APC_TypeChar, TypeSize AL_Length)*/
|
||||
|
||||
ZtCChars(const ZtCChars& rhs)
|
||||
{
|
||||
mp_TypeChar = const_cast<ZtCChars&>(rhs).mp_TypeChar ;
|
||||
ml_TypeSize = const_cast<ZtCChars&>(rhs).ml_TypeSize ;
|
||||
mp_TypeChar = const_cast
|
||||
<TypeChar*>( rhs.mp_TypeChar ) ;
|
||||
ml_TypeSize = rhs.ml_TypeSize ;
|
||||
}/*
|
||||
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;
|
||||
}/*
|
||||
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<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
|
||||
{
|
||||
|
||||
|
Reference in New Issue
Block a user