//********************************************************************** //********************************************************************** //********************************************************************** public void writeMessageCreator() { mWCP.WriteBar(0, 3); mWCP.WriteLine(0, "// Create a new message, based on a message type."); mWCP.WriteSkip(); mWCP.WriteLine(0, "Ris::ByteContent* MsgCreator::createMsg (int aMessageType)"); mWCP.WriteLine(0, "{"); mWCP.WriteLine(1, "BaseMsg* tMsg = 0;"); mWCP.WriteSkip(); mWCP.WriteLine(1, "switch (aMessageType)"); mWCP.WriteLine(1, "{"); mInputData.mBlockList.ForEach(delegate(BlockData tBlock) { if (tBlock.mBlockType == Defs.cBlockT_Message) { mWCP.WriteLine(2, "case MsgIdT::c{0} :", tBlock.mName); mWCP.WriteLine(3, "tMsg = new {0}();", tBlock.mName); mWCP.WriteLine(3, "break;"); } }); mWCP.WriteLine(2, "default :"); mWCP.WriteLine(3, "break;"); mWCP.WriteLine(1, "}"); mWCP.WriteLine(1, "return tMsg;"); mWCP.WriteLine(0, "}"); mWCP.WriteSkip(); }
//********************************************************************** //********************************************************************** //********************************************************************** public void writeFileBegin() { mInputData.mFileHeaderData.mUsingList.ForEach(delegate(String name) { mWCS.WriteLine(0, "using {0};", name); }); mWCS.WriteSkip(); mWCS.WriteBar(0, 3); mWCS.WritePreCommentList(0, mInputData.mFileHeaderData.mPreCommentList); mWCS.WriteSkip(); mWCS.WriteLine(0, "namespace {0}", mInputData.mFileHeaderData.mNameSpace); mWCS.WriteLine(0, "{"); mWCS.WriteSkip(); }
//********************************************************************** //********************************************************************** //********************************************************************** public void writeFileBegin() { mWCH.WriteLine(0, "#ifndef {0}", mInputData.mFileHeaderData.mDefineCH); mWCH.WriteLine(0, "#define {0}", mInputData.mFileHeaderData.mDefineCH); mWCH.WriteSkip(); mInputData.mFileHeaderData.mIncludeCHList.ForEach(delegate(String tString) { if (tString.StartsWith("<")) { mWCH.WriteLine(0, "#include {0}", tString); } else { mWCH.WriteLine(0, "#include \"{0}\"", tString); } }); mWCH.WriteSkip(); mWCH.WriteBar(0, 3); mWCH.WritePreCommentList(0, mInputData.mFileHeaderData.mPreCommentList); mWCH.WriteSkip(); mWCH.WriteLine(0, "namespace {0}", mInputData.mFileHeaderData.mNameSpace); mWCH.WriteLine(0, "{"); mWCH.WriteSkip(); }
//********************************************************************** //********************************************************************** //********************************************************************** public void writeIdentifiers() { mWCS.WriteBar(1, 3); mWCS.WriteLine(1, "// Message Types"); mWCS.WriteSkip(); mWCS.WriteLine(1, "{0}", "public class MsgIdT"); mWCS.WriteLine(1, "{0}", "{"); mWCS.WriteLine(2, "public const int c{0} = {1,3};", stringExtend("Unspecified", mInputData.mNameMaxSize), 0); int tIdent = 1; mInputData.mBlockList.ForEach(delegate(BlockData tBlock) { if (tBlock.mBlockType == Defs.cBlockT_Message) { mWCS.WriteLine(2, "public const int c{0} = {1,3};", stringExtend(tBlock.mName, mInputData.mNameMaxSize), tIdent++); } }); mWCS.WriteLine(1, "{0}", "};"); mWCS.WriteSkip(); }