Files
RepoMain/ZCppMainTest/ZtCLoadXml_000.cpp

271 lines
12 KiB
C++

#include "ZCppMain/ZtCLoadXml.H"
namespace ZNsMain
{
namespace ZNsExam
{
template<typename TDymmy=void*> class ZtExamLoadXml
{
public:
/* 아래 Main() 함수 선언을 아래로 하면
static int Main(int AI_ArgCnt=0, const char* APP_ArgVal[]=0)
mingw g++ 에서 희한하게 에러다.
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
# g++.exe -o ZtCLoadXml_000_mw.exe ZtCLoadXml_000.cpp -I../ -lWs2_32
ZtCLoadXml_000.cpp: In function 'int main(int, char**)':
ZtCLoadXml_000.cpp:171:42: error: invalid conversion from 'char**' to 'const char**' [-fpermissive]
171 | ZtExamLoadXml<>::Main(AI_ArgCnt, APP_ArgVal);
| ^~~~~~~~~~
| |
| char**
ZtCLoadXml_000.cpp:16:58: note: initializing argument 2 of 'static int ZNsMain::ZNsExam::ZtExamLoadXml<TDymmy>::Main(int, const char**) [with TDymmy = void*]'
16 | static int Main(int AI_ArgCnt=0, const char* APP_ArgVal[]=0)
| ~~~~~~~~~~~~^~~~~~~~~~~~~~
*/
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
{
typedef ZNsMain::ZtCStringBase<char> ZCStringData ;
typedef ZNsMain::ZNsViewIFace::ZNsExam::ZtCViewLoadXml<
ZCStringData
/*/////////*/ > ZCViewLoadXml; ////////////////////////
typedef ZNsMain::ZNsType::ZtCTypeXmlInfo<
ZCStringData
/*/////////*/ > ZCTypeXmlInfo; ////////////////////////
typedef ZNsMain::ZtCXmlInfo<ZCTypeXmlInfo> ZCXmlInfo;
typedef ZNsMain::ZNsView::ZtCViewLoadXmlOfXmlInfo<
ZCXmlInfo
/*/////////*/ > ZCViewLoadXmlOfXmlInfo; ///////////////
typedef ZNsMain::ZtCLoadXml<ZCStringData> ZCLoadXml;
const char* CPC_XmlData1=
"<!-- My Comment0 --><? Header ?>\n"
"<!DOCTYPE ele0[ \n"
"<!ELEMENT ele1>\n"
"<!ATTLIST prop>\n"
"]>\n"
"<ele0 prop0 = \"prop00\" /><!-- My Comment1 -->\n"
"<ele1>ele1 data</ele1> <!-- My Comment2 -> ---- --->\n"
"<ele2 >ele2 data</ele2>\n"
"<요소3 prop1= \"prop1 value\" prop2 = \"prop2 value\" >"
" <ele3_1 prop3=\"prop3 value\" prop33=\"prop33 value\" > MyData"
" </ele3_1>\n"
" <ele3_2 prop4=\"prop4 value\" prop44=\"prop44 value\" > <![CDATA[ myCDATA ]]>\n"
" </ele3_2> \n"
"</요소3"
;
const char* CPC_XmlData2=
">\n<ele4 >ele4 data\n"
"</ele4>\n"
;;;;;;;;;;;;;;;;;;;;;;;;
const char* CPC_XmlDataOfID=
"<?xml version=\"1.0\" encoding=\"euc-kr\" ?>\n"
"<!DOCTYPE data[\n"
"<!ELEMENT data ANY>\n"
"<!ENTITY nbsp " " >\n"
"<!ATTLIST data id ID #REQUIRED>\n"
"]>\n"
"<data id = \"id-set\" desc=\"Xml 로 출력되는 홈페이지의 내용 예시\">\n"
"\n"
" <data id=\"id-info-login\" login_enum=\"1\" login_msg=\"Login Already\" login_rightnum=\"515\"\n"
" login_isadmin=\"0\" login_sessno=\"\" login_memno=\"1\" login_id=\"test\" login_name=\"\"\n"
" login_icon=\"/testfile\" login_iconhtml=\"\" login_point=\"0\" login_mail=\"\" login_level=\"0\"\n"
" login_no_fc=\"0\" login_no_fbinf=\"7\" login_notecnt=\"0\" login_type=\"0\" login_lastip=\"\"\n"
" login_lastlogin=\"2008-09-28 08:29:51.904506\" login_filecnt=\"0\" login_filesum=\"0\"\n"
" login_filemax=\"0\" />\n"
"\n"
" <data id=\"id-binfo-main\" binf_cntitem=\"12\" binf_cntpage=\"10\" binf_count=\"1001\" binf_maxnum=\"501\"\n"
" binf_config=\"360943\" binf_bbit_fbinf=\"0\" binf_rn_fbinf=\"0\" binf_no_fc=\"0\" />\n"
"\n"
" <data id = \"id-binfo-var\" attcnt = \"0\" />\n"
"\n"
" <data id=\"id-binfo-top-set\" recordcnt=\"3\" fieldcnt=\"16\">\n"
" <data id=\"id-binfo-top1\" no=\"1\" b_itemnum=\"1\" b_title=\"자유게시판입니다.\" b_tstyle=\"\"\n"
" b_wdate=\"2008-09-28\" b_no=\"1\" b_depth=\"0\" b_hit=\"0\" b_commcnt=\"0\" b_filecnt=\"0\"\n"
" b_userip=\"\" m_no=\"0\" m_point=\"0\" m_nick=\"\" m_userid=\"\" m_mail=\"\"\n"
" f_icon=\"&lt;img src=&quot;/testfile&quot; class=&quot;member_img_icon&quot; /&gt;\"\n"
" />\n"
" <data id=\"id-binfo-top2\" no=\"2\" b_itemnum=\"2\" b_title=\"술탄 메메트 2세 Title=2\" b_tstyle=\"\"\n"
" b_wdate=\"2008-09-28\" b_no=\"2\" b_depth=\"0\" b_hit=\"0\" b_commcnt=\"0\" b_filecnt=\"0\" b_userip=\"\" m_no=\"0\" m_point=\"0\" m_nick=\"\" m_userid=\"\" m_mail=\"\"\n"
" f_icon=\"&lt;img src=&quot;/testfile&quot; class=&quot;member_img_icon&quot; /&gt;\"\n"
" />\n"
" <data id=\"id-binfo-top3\" no=\"3\" b_itemnum=\"1-1\" b_title=\"술탄 메메트 2세 Title=1-1\"\n"
" b_tstyle=\"\" b_wdate=\"2008-09-28\" b_no=\"3\" b_depth=\"1\" b_hit=\"0\" b_commcnt=\"0\"\n"
" b_filecnt=\"0\" b_userip=\"\" m_no=\"0\" m_point=\"0\" m_nick=\"\" m_userid=\"\" m_mail=\"\"\n"
" f_icon=\"&lt;img src=&quot;/testfile&quot; class=&quot;member_img_icon&quot; /&gt;\"\n"
" />\n"
" </data><!-- id=\"binfo-top-set\" -->\n"
" <data id=\"id-binfo-modevar\" attcnt=\"5\" b_listbackcolor1=\"#ffeeff\" b_listbackcolor2=\"#cceedd\"\n"
" b_listbackcolorcnt=\"2\" b_listlinecolor=\"black\" b_listmouseovercolor=\"#ffc0cb\" />\n"
"\n"
"</data><!-- id=\"id-set\" -->\n";
/*const char* CPC_XmlDataOfID=*/
ZCViewLoadXml VO_CViewLoadXml;
ZCLoadXml VO_CLoadXml ;
if(AI_ArgCnt<2)
{
VO_CLoadXml.Exec(VO_CViewLoadXml, CPC_XmlData1, ZNsMain::ZftLength(CPC_XmlData1));
VO_CLoadXml.Exec(VO_CViewLoadXml, CPC_XmlData2, ZNsMain::ZftLength(CPC_XmlData2));
}
else
{
for(int i=1; i<AI_ArgCnt; ++i) VO_CLoadXml.Exec
(
VO_CViewLoadXml, APP_ArgVal[i], ZNsMain::ZftLength(APP_ArgVal[i])
);
/*:::::::::::::::::::::::::::::::::::::::::::*/
return 0;
}/*
else*/
cout<<endl;
cout<<"## Show Xml Info With 'ID' Attribute. Press Enter. ##"; cin.get();
VO_CLoadXml.clear(); ZCViewLoadXmlOfXmlInfo VO_CViewLoadXmlOfXmlInfo;
ZNsMain::ZNsEnum::ZERunEx VE_ERunEx=VO_CLoadXml.ExecAll( ////////////
VO_CViewLoadXmlOfXmlInfo,
CPC_XmlDataOfID ,
ZNsMain::ZftLength(CPC_XmlDataOfID)
/*/////////*/ ); /*////////////////////////////////////////////////*/
if(VE_ERunEx!=ZNsMain::ZNsEnum::ZERunEx_OK)
{
cout<<endl<<endl<<
"■ Error !! : Line="<<VO_CLoadXml.GetLineNo()<<", "<<
"CharNo=" <<VO_CLoadXml.GetCharNo() <<", "<<
"EWaitByte="<<VO_CLoadXml.GetMSG_EWaitByte() <<", "
"Error MSG="<<VO_CViewLoadXmlOfXmlInfo.GetErrorMSG()<<endl;
return 0;
}/*
if(VE_ERunEx!=ZNsMain::ZNsEnum::ZERunEx_OK)*/
VO_CViewLoadXmlOfXmlInfo.GetCXmlInfo().IterPreOrderElementTreeStd();
cout<<endl;
cout<<"## Show Xml ID ##"<<endl;
cout<<endl;
VO_CViewLoadXmlOfXmlInfo.GetCXmlInfo().IterElementIDSetStd();
return 0;
}/*
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
public:
};/*
template<typename TDymmy=void*> class ZtExamLoadXml*/
}/*
namespace ZNsExam*/
}/*
namespace ZNsMain*/
int main(int AI_ArgCnt, char* APP_ArgVal[])
{
return ZNsMain::ZNsExam::
ZtExamLoadXml<>::Main(AI_ArgCnt, APP_ArgVal);
}/*
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
/*////////////////////////////////////////////////////////////////////////////////////////
■ cygwin 컴파일
// g++ -mno-cygwin -o ZtCLoadXml_000.exe ZtCLoadXml_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
// g++ -mno-cygwin -o ZtCLoadXml_000_D.exe ZtCLoadXml_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
■ mingw 컴파일
g++.exe -o ZtCLoadXml_000_mw.exe ZtCLoadXml_000.cpp -I../ -lWs2_32
g++.exe -o ZtCLoadXml_000_mw_D.exe ZtCLoadXml_000.cpp -I../ -lWs2_32 -D_DEBUG
./ZtCLoadXml_000_mw.exe
./ZtCLoadXml_000_mw_D.exe
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
# date
Sun Aug 24 10:47:09 KST 2025
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
# g++ --version
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
■ Linux 컴파일
g++ -std=c++98 -o ZtCLoadXml_000.exe ZtCLoadXml_000.cpp -I../
g++ -std=c++98 -o ZtCLoadXml_000_D.exe ZtCLoadXml_000.cpp -I../ -D_DEBUG
g++ -std=c++98 -o ZtCLoadXml_000_r.exe ZtCLoadXml_000.cpp -I../ -D_REENTRANT
g++ -std=c++98 -o ZtCLoadXml_000_r_D.exe ZtCLoadXml_000.cpp -I../ -D_REENTRANT -D_DEBUG
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
Sun Aug 24 00:05:51 DST 2025
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)
[sauron@q381-2657 ZCppMainTest]$ g++ --version
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
■ 실행
./ZtCLoadXml_000.exe
./ZtCLoadXml_000_D.exe
////////////////////////////////////////////////////////////////////////////////////////*/