commit 2025-08-29 02:38 add ZCSngtLogData in ZCppMain/ZMainHead.H
This commit is contained in:
@ -3564,10 +3564,229 @@ namespace ZNsMain
|
|||||||
}/*
|
}/*
|
||||||
namespace ZNsConst*/
|
namespace ZNsConst*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<typename TStringData> TStringData& ZftConvertXhtml(TStringData& ARRoCString)
|
||||||
|
{
|
||||||
|
/* 데이타를 그대로 클라이언트에 전송하면, HTML 태그와
|
||||||
|
혼동될 수 있는데, 이를 방지하기 위해 적절히 인코딩한다.
|
||||||
|
*/
|
||||||
|
return ARRoCString.
|
||||||
|
Replace("&" ,"&" ). Replace("<" ,"<" ).
|
||||||
|
Replace(">" ,">" ). Replace(" " ," ").
|
||||||
|
Replace("\n","<br />" );
|
||||||
|
}/*
|
||||||
|
template<typename TStringData> TStringData& ConvertXhtml(TStringData& ARRoCString) */
|
||||||
|
|
||||||
|
|
||||||
|
template<typename TStringData> TStringData& ZftMakeXmlAttEnc(TStringData& ARRoCStringData)
|
||||||
|
{
|
||||||
|
return ARRoCStringData.
|
||||||
|
Replace("&" , "&" ).Replace("\r", "
" ).
|
||||||
|
Replace("\n", "
" ).Replace("\t", "	" ).
|
||||||
|
Replace("\"", """).Replace(">" , ">" ).Replace("<", "<");
|
||||||
|
}/*
|
||||||
|
template<typename TStringData> TStringData& ZftMakeXmlAttEnc(TStringData& ARRoCStringData)*/
|
||||||
|
|
||||||
|
template<typename TStringData> TStringData& ZftMakeXmlAttDec(TStringData& ARRoCStringData)
|
||||||
|
{
|
||||||
|
return ARRoCStringData.
|
||||||
|
Replace("
" ,"\r" ). Replace("
" ,"\n").
|
||||||
|
Replace("	" ,"\t" ). Replace(""","\"").
|
||||||
|
Replace(">" ,">" ). Replace("<" ,"<" ). Replace("&" ,"&" );
|
||||||
|
}/*
|
||||||
|
template<typename TStringData> TStringData& ZftMakeXmlAttDec(TStringData& ARRoCStringData)*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<typename TString, typename TObject>
|
||||||
|
TString& ZftMakeStr(TString& ARR_SaveCStr, TObject AO_Object)
|
||||||
|
{ return ARR_SaveCStr; }
|
||||||
|
////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
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, long AL_Long)
|
||||||
|
{
|
||||||
|
const int CI_BuffSize = 31 ;
|
||||||
|
char VCA_BuffParam[CI_BuffSize] ;
|
||||||
|
|
||||||
|
int VI_ResultSize =
|
||||||
|
::sprintf(VCA_BuffParam, "%ld", AL_Long);
|
||||||
|
|
||||||
|
ARR_SaveCStr.append
|
||||||
|
(VCA_BuffParam, VI_ResultSize);
|
||||||
|
|
||||||
|
return ARR_SaveCStr;
|
||||||
|
}/*
|
||||||
|
template<> string& ZftMakeStr(string& ARR_SaveCStr, long AL_Long)*/
|
||||||
|
|
||||||
|
template<> string& ZftMakeStr(string& ARR_SaveCStr, double AD_Double)
|
||||||
|
{
|
||||||
|
const int CI_BuffSize=51 ;
|
||||||
|
char VCA_BuffParam[CI_BuffSize];
|
||||||
|
|
||||||
|
int VI_ResultSize = ::sprintf
|
||||||
|
(
|
||||||
|
VCA_BuffParam, "%f", AD_Double
|
||||||
|
);
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
if (AB_Bool)
|
||||||
|
ARR_SaveCStr.append("true" );
|
||||||
|
else ARR_SaveCStr.append("false");
|
||||||
|
|
||||||
|
return ARR_SaveCStr;
|
||||||
|
}/*
|
||||||
|
template<> string& ZftMakeStr(string& ARR_SaveCStr, bool AB_Bool)*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace ZNsView
|
||||||
|
{
|
||||||
|
|
||||||
|
class ZCViewLogData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void Log(const char* APC_LogData, ZTypLength AI_Length)
|
||||||
|
{
|
||||||
|
cout<<APC_LogData ;
|
||||||
|
}/*
|
||||||
|
virtual void Log(const char* APC_LogData, ZTypLength AI_Length)*/
|
||||||
|
|
||||||
|
virtual void Log(const char* APC_LogData)
|
||||||
|
{ cout<<APC_LogData; }
|
||||||
|
|
||||||
|
virtual void Log(int AI_LogData){ cout<<AI_LogData; }
|
||||||
|
virtual void Log(long AL_LogData){ cout<<AL_LogData; }
|
||||||
|
virtual void Log(double AD_LogData){ cout<<AD_LogData; }
|
||||||
|
virtual void Log(char AC_LogData){ cout<<AC_LogData; }
|
||||||
|
virtual void Log(bool AB_LogData)
|
||||||
|
{
|
||||||
|
cout<<(AB_LogData ? "true" : "false")<<endl;
|
||||||
|
}/*
|
||||||
|
virtual void Log(bool AB_LogData)*/
|
||||||
|
|
||||||
|
virtual void LogXmlAtt(const char* APC_LogData, ZTypLength AI_Length)
|
||||||
|
{
|
||||||
|
__for0(ZTypLength, i, AI_Length)
|
||||||
|
{
|
||||||
|
if(APC_LogData[i]=='&' ){cout<<"&" ; continue;}
|
||||||
|
if(APC_LogData[i]=='\r'){cout<<"
" ; continue;}
|
||||||
|
if(APC_LogData[i]=='\n'){cout<<"
" ; continue;}
|
||||||
|
if(APC_LogData[i]=='\t'){cout<<"	" ; continue;}
|
||||||
|
if(APC_LogData[i]=='\"'){cout<<"""; continue;}
|
||||||
|
if(APC_LogData[i]=='>' ){cout<<">" ; continue;}
|
||||||
|
if(APC_LogData[i]=='<' ){cout<<"<" ; continue;}
|
||||||
|
|
||||||
|
cout<<APC_LogData[i] ;
|
||||||
|
}/*
|
||||||
|
__for0(ZTypLength, i, AI_Length)*/
|
||||||
|
}/*
|
||||||
|
virtual void LogXmlAtt(const char* APC_LogData, ZTypLength AI_Length)*/
|
||||||
|
|
||||||
|
virtual void LogXmlAtt(const char* APC_LogData)
|
||||||
|
{
|
||||||
|
LogXmlAtt(APC_LogData, ZftLength(APC_LogData));
|
||||||
|
}/*
|
||||||
|
virtual void LogXmlAtt(const char* APC_LogData)*/
|
||||||
|
|
||||||
|
public:
|
||||||
|
};/*
|
||||||
|
class ZCViewLogData*/
|
||||||
|
|
||||||
|
}/*
|
||||||
|
namespace ZNsView*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ZCSngtLogData
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
typedef ZNsView::ZCViewLogData ZCViewLogData;
|
||||||
|
private:
|
||||||
|
ZCViewLogData mo_ZCViewLogData;
|
||||||
|
ZCViewLogData* mp_ZCViewLogData;
|
||||||
|
private:
|
||||||
|
ZCSngtLogData() : mp_ZCViewLogData(&mo_ZCViewLogData){}
|
||||||
|
private:
|
||||||
|
|
||||||
|
static ZCSngtLogData& GetSngtObj()
|
||||||
|
{
|
||||||
|
static ZCSngtLogData SO_ZCSngtLogData; return SO_ZCSngtLogData;
|
||||||
|
}/*
|
||||||
|
static ZCSngtLogData& GetSngtObj()*/
|
||||||
|
|
||||||
|
public :
|
||||||
|
|
||||||
|
static ZCViewLogData& GetSngtView()
|
||||||
|
{
|
||||||
|
return *GetSngtObj().mp_ZCViewLogData;
|
||||||
|
}/*
|
||||||
|
static ZCViewLogData& GetSngtView()*/
|
||||||
|
|
||||||
|
static void SetSngtView(ZCViewLogData& AR_ViewObj)
|
||||||
|
{
|
||||||
|
GetSngtObj().mp_ZCViewLogData = &AR_ViewObj ;
|
||||||
|
}/*
|
||||||
|
static void SetSngtView(ZCViewLogData& AR_ViewObj)*/
|
||||||
|
|
||||||
|
|
||||||
|
static void Log(const char* APC_Log, ZTypLength AI_Length)
|
||||||
|
{
|
||||||
|
GetSngtView().Log(APC_Log, AI_Length);
|
||||||
|
}/*
|
||||||
|
static void Log(const char* APC_Log, ZTypLength AI_Length)*/
|
||||||
|
|
||||||
|
static void Log(const char* APC_LogData)
|
||||||
|
{
|
||||||
|
GetSngtView().Log( APC_LogData );
|
||||||
|
}/*
|
||||||
|
static void Log(const char* APC_LogData)*/
|
||||||
|
|
||||||
|
static void Log(int AI_LogData){ GetSngtView().Log(AI_LogData); }
|
||||||
|
static void Log(long AL_LogData){ GetSngtView().Log(AL_LogData); }
|
||||||
|
static void Log(double AD_LogData){ GetSngtView().Log(AD_LogData); }
|
||||||
|
static void Log(char AC_LogData){ GetSngtView().Log(AC_LogData); }
|
||||||
|
static void Log(bool AB_LogData){ GetSngtView().Log(AB_LogData); }
|
||||||
|
|
||||||
|
static void LogXmlAtt(const char* APC_LogData, ZTypLength AI_Length)
|
||||||
|
{
|
||||||
|
GetSngtView().LogXmlAtt(APC_LogData, AI_Length);
|
||||||
|
}/*
|
||||||
|
static void LogXmlAtt(const char* APC_LogData, ZTypLength AI_Length)*/
|
||||||
|
|
||||||
|
static void LogXmlAtt(const char* APC_LogData)
|
||||||
|
{
|
||||||
|
GetSngtView().LogXmlAtt(APC_LogData);
|
||||||
|
}/*
|
||||||
|
static void LogXmlAtt(const char* APC_LogData)*/
|
||||||
|
|
||||||
|
public :
|
||||||
|
};/*
|
||||||
|
class ZCSngtLogData*/
|
||||||
|
|
||||||
}/*
|
}/*
|
||||||
namespace ZNsMain*/
|
namespace ZNsMain*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace ZNsCPP
|
namespace ZNsCPP
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -3665,101 +3884,6 @@ namespace ZNsCPP */
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace ZNsMain
|
|
||||||
{
|
|
||||||
|
|
||||||
template<typename TString, typename TObject>
|
|
||||||
TString& ZftMakeStr(TString& ARR_SaveCStr, TObject AO_Object)
|
|
||||||
{ return ARR_SaveCStr; }
|
|
||||||
////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
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, long AL_Long)
|
|
||||||
{
|
|
||||||
const int CI_BuffSize = 31 ;
|
|
||||||
char VCA_BuffParam[CI_BuffSize] ;
|
|
||||||
|
|
||||||
int VI_ResultSize =
|
|
||||||
::sprintf(VCA_BuffParam, "%ld", AL_Long);
|
|
||||||
|
|
||||||
ARR_SaveCStr.append
|
|
||||||
(VCA_BuffParam, VI_ResultSize);
|
|
||||||
|
|
||||||
return ARR_SaveCStr;
|
|
||||||
}/*
|
|
||||||
template<> string& ZftMakeStr(string& ARR_SaveCStr, long AL_Long)*/
|
|
||||||
|
|
||||||
template<> string& ZftMakeStr(string& ARR_SaveCStr, double AD_Double)
|
|
||||||
{
|
|
||||||
const int CI_BuffSize=51 ;
|
|
||||||
char VCA_BuffParam[CI_BuffSize];
|
|
||||||
|
|
||||||
int VI_ResultSize = ::sprintf
|
|
||||||
(
|
|
||||||
VCA_BuffParam, "%f", AD_Double
|
|
||||||
);
|
|
||||||
/////////////////////////////
|
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
if (AB_Bool)
|
|
||||||
ARR_SaveCStr.append("true" );
|
|
||||||
else ARR_SaveCStr.append("false");
|
|
||||||
|
|
||||||
return ARR_SaveCStr;
|
|
||||||
}/*
|
|
||||||
template<> string& ZftMakeStr(string& ARR_SaveCStr, bool AB_Bool)*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TStringData> TStringData& ZftConvertXhtml(TStringData& ARRoCString)
|
|
||||||
{
|
|
||||||
/* 데이타를 그대로 클라이언트에 전송하면, HTML 태그와
|
|
||||||
혼동될 수 있는데, 이를 방지하기 위해 적절히 인코딩한다.
|
|
||||||
*/
|
|
||||||
return ARRoCString.
|
|
||||||
Replace("&" ,"&" ). Replace("<" ,"<" ).
|
|
||||||
Replace(">" ,">" ). Replace(" " ," ").
|
|
||||||
Replace("\n","<br />" );
|
|
||||||
}/*
|
|
||||||
template<typename TStringData> TStringData& ConvertXhtml(TStringData& ARRoCString) */
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TStringData> TStringData& ZftMakeXmlAttEnc(TStringData& ARRoCStringData)
|
|
||||||
{
|
|
||||||
return ARRoCStringData.
|
|
||||||
Replace("&" , "&" ).Replace("\r", "
" ).
|
|
||||||
Replace("\n", "
" ).Replace("\t", "	" ).
|
|
||||||
Replace("\"", """).Replace(">" , ">" ).Replace("<", "<");
|
|
||||||
}/*
|
|
||||||
template<typename TStringData> TStringData& ZftMakeXmlAttEnc(TStringData& ARRoCStringData)*/
|
|
||||||
|
|
||||||
template<typename TStringData> TStringData& ZftMakeXmlAttDec(TStringData& ARRoCStringData)
|
|
||||||
{
|
|
||||||
return ARRoCStringData.
|
|
||||||
Replace("
" ,"\r" ). Replace("
" ,"\n").
|
|
||||||
Replace("	" ,"\t" ). Replace(""","\"").
|
|
||||||
Replace(">" ,">" ). Replace("<" ,"<" ). Replace("&" ,"&" );
|
|
||||||
}/*
|
|
||||||
template<typename TStringData> TStringData& ZftMakeXmlAttDec(TStringData& ARRoCStringData)*/
|
|
||||||
|
|
||||||
}/*
|
|
||||||
namespace ZNsMain*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user