/*************************************************************************** * Copyright (C) 2009 by root * * root@localhost.localdomain * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <iostream> #include <cstdlib> #include "MsgTreeBuilder.h" using namespace std; void build(); int main(int argc, char *argv[]) { build(); return EXIT_SUCCESS; } void build() { CMsgTreeBuilder tree; CMsgNodeBase*pRoot=tree.BuildTree();//* CMsgNodeBase*pRule=pRoot->CreateChild("Rule1"); CMsgNodeBase*pType=pRule->CreateChild("Type1"); CMsgNodeBase*pItem=pType->CreateChild("Item1"); CMsgNodeBase*pArr1=pItem->ToMsgItemNode()->CreateElementArrayChild("Array1"); pArr1->ToMsgElementArrayNode()->SetDataID(33619968); CMsgNodeBase*psEle1=pArr1->ToMsgElementArrayNode()->CreateElementDataChild("Ele1"); psEle1->ToMsgElementDataNode()->SetDataID(50397444); CMsgNodeBase*pEle1=pItem->ToMsgItemNode()->CreateElementDataChild("Ele2"); pEle1->ToMsgElementDataNode()->SetDataID(50397442); CMsgNodeBase*pErr; bool isMark; pItem->ToMsgItemNode()->CheckFormat(isMark,pErr); cout<<"isMark:"<<(isMark? "yes" : "no" ); if(pErr) cout<<"Error Node:"<<pErr->GetName()<<endl; tree.SaveFile(); tree.WriteTestData(); }