Torque3D Documentation / _generateds / messageVector.cpp

messageVector.cpp

Engine/source/gui/utility/messageVector.cpp

More...

Public Variables

_MessageVectordump1 ("@brief Dump the message vector to a file without a header.\n\n" "@param filename Name and path of file to dump text to.\n" "@tsexample\n" "// Dump the entire chat log to a text file\n" "HudMessageVector.dump(\"./chatLog.txt\");\n" "@endtsexample\n\n\n", "MessageVector", "void dump( string filename);")

Public Functions

_MessageVectordump2("@brief Dump the message vector <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> with <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">header.\n\n</a>" "@param filename Name and path of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> dump text <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n</a>" "@param header Prefix information <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> write <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">out\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Arbitrary header <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">data\n</a>" "% headerInfo, "MessageVector" , "void dump( string filename, string header);" )
ConsoleDocClass(MessageVector , "@brief Store <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> list of chat <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">messages.\n\n</a>" "This is responsible <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> managing messages which appear in the chat HUD, not the actual <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> rendered <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">screen\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Declare ChatHud, which is what will display the actual chat from <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">MessageVector\n</a>" "<a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classguimessagevectorctrl/">GuiMessageVectorCtrl</a>(ChatHud) {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " profile=\"ChatHudMessageProfile\";\n" "   horizSizing = \"width\";\n" "   vertSizing = \"height\";\n" "   position = \"1 1\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   extent = \"252 16\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   minExtent = \"8 8\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   visible = \"1\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   helpTag = \"0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   lineSpacing = \"0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   lineContinuedIndex = \"10\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   matchColor = \"0 0 255 255\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   maxColorIndex = \"5\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "};\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "// All messages are stored in this HudMessageVector, the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">actual\n</a>" "//MainChatHud only displays the contents of this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "<a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classmessagevector/">MessageVector</a>(HudMessageVector);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "//Attach the <a href="/coding/class/classmessagevector/">MessageVector</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the chat <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control\n</a>" "chatHud.attach(HudMessageVector);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" " @see <a href="/coding/class/classguimessagevectorctrl/">GuiMessageVectorCtrl</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> more details on how this is used." " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiUtil\n</a>" )
DefineEngineMethod(MessageVector , clear , void , () , "Clear all messages in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "HudMessageVector.clear();\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" )
DefineEngineMethod(MessageVector , deleteLine , bool , (S32 deletePos) , "Delete the line at the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n\n</a>" "@param deletePos Position in the vector containing the line <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">deleted\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Delete the first line (index 0) in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector...\n</a>" "HudMessageVector.deleteLine(0);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@return False <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> deletePos is greater than the number of lines in the current vector" )
DefineEngineMethod(MessageVector , dump , void , (const char *filename, const char *header) , ("") , "(string filename, string header=<a href="/coding/file/typesx86unix_8h/#typesx86unix_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)" "Dump the message vector <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> file, optionally prefixing <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> header." " @hide" )
DefineEngineMethod(MessageVector , getLineIndexByTag , S32 , (S32 tag) , "Scan through the vector, returning the line number of the first line that matches the specified tag;else returns -1 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> no match was <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n\n</a>" " @param tag Numerical <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> assigned <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> message when it was added or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">inserted\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Locate <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> line of text tagged with the <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> \"1\" , then delete <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">it.\n</a>" "% taggedLine, other wise -1" )
DefineEngineMethod(MessageVector , getLineTag , S32 , (S32 pos) , "Get the tag of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">line.\n\n</a>" "@param pos Position in vector <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> grab tag <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">from\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Remove all lines that do not have <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> tag <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> of 1.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a>( HudMessageVector.getNumLines())\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   %tag = HudMessageVector.getLineTag(1);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a>(%tag != 1)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "      %tag.delete();\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   HudMessageVector.popFrontLine();\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "}\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@return Tag <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> given line, <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the position is greater than the number of lines return 0" )
DefineEngineMethod(MessageVector , getLineText , const char * , (S32 pos) , "Get the text at <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">line.\n\n</a>" "@param pos Position in vector <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> grab text <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">from\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Print <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> line of text at position 1.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "% text, <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the position is greater than the number of lines return \"\"" )
DefineEngineMethod(MessageVector , getLineTextByTag , const char * , (S32 tag) , "Scan through the lines in the vector, returning the first line that has <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> matching <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tag.\n\n</a>" " @param tag Numerical <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> assigned <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> message when it was added or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">inserted\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Locate text in the vector tagged with the <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> \"1\" , then print <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">it\n</a>" "% taggedText, other wise \"\"" )
DefineEngineMethod(MessageVector , getNumLines , S32 , () )
DefineEngineMethod(MessageVector , insertLine , bool , (S32 insertPos, const char *msg, S32 tag) , "Push <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> line onto the back of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">list.\n\n</a>" "@param msg Text that makes up the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">message\n</a>" "@param tag Numerical <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> associated with this message, useful <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">searching.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Add the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">message...\n</a>" "HudMessageVector.insertLine(1, \"Hello World\", 0);\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@return False <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> insertPos is greater than the number of lines in the current vector" )
DefineEngineMethod(MessageVector , popBackLine , bool , () , "Pop <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> line from the back of the list; destroys the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">line.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "HudMessageVector. popBackLine, true otherwise" )
DefineEngineMethod(MessageVector , popFrontLine , bool , () , "Pop <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> line from the front of the vector, destroying the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">line.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "HudMessageVector. popFrontLine, true otherwise" )
DefineEngineMethod(MessageVector , pushBackLine , void , (const char *msg, S32 tag) , "Push <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> line onto the back of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">list.\n\n</a>" "@param msg Text that makes up the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">message\n</a>" "@param tag Numerical <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> associated with this message, useful <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">searching.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Add the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">message...\n</a>" "HudMessageVector.pushBackLine(\"Hello World\", 0);\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" )
DefineEngineMethod(MessageVector , pushFrontLine , void , (const char *msg, S32 tag) , "Push <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> line onto the front of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n\n</a>" "@param msg Text that makes up the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">message\n</a>" "@param tag Numerical <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> associated with this message, useful <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">searching.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Add the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">message...\n</a>" "HudMessageVector.pushFrontLine(\"Hello World\", 0);\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" )

Detailed Description

Public Variables

ConsoleDocFragment _MessageVectordump1 ("@brief Dump the message vector to a file without a header.\n\n" "@param filename Name and path of file to dump text to.\n" "@tsexample\n" "// Dump the entire chat log to a text file\n" "HudMessageVector.dump(\"./chatLog.txt\");\n" "@endtsexample\n\n\n", "MessageVector", "void dump( string filename);")

Public Functions

_MessageVectordump2("@brief Dump the message vector <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> with <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">header.\n\n</a>" "@param filename Name and path of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> dump text <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n</a>" "@param header Prefix information <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> write <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">out\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Arbitrary header <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">data\n</a>" "% headerInfo, "MessageVector" , "void dump( string filename, string header);" )

ConsoleDocClass(MessageVector , "@brief Store <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> list of chat <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">messages.\n\n</a>" "This is responsible <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> managing messages which appear in the chat HUD, not the actual <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> rendered <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">screen\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Declare ChatHud, which is what will display the actual chat from <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">MessageVector\n</a>" "<a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classguimessagevectorctrl/">GuiMessageVectorCtrl</a>(ChatHud) {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " profile=\"ChatHudMessageProfile\";\n" "   horizSizing = \"width\";\n" "   vertSizing = \"height\";\n" "   position = \"1 1\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   extent = \"252 16\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   minExtent = \"8 8\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   visible = \"1\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   helpTag = \"0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   lineSpacing = \"0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   lineContinuedIndex = \"10\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   matchColor = \"0 0 255 255\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   maxColorIndex = \"5\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "};\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "// All messages are stored in this HudMessageVector, the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">actual\n</a>" "//MainChatHud only displays the contents of this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n</a>" "<a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classmessagevector/">MessageVector</a>(HudMessageVector);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "//Attach the <a href="/coding/class/classmessagevector/">MessageVector</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the chat <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control\n</a>" "chatHud.attach(HudMessageVector);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" " @see <a href="/coding/class/classguimessagevectorctrl/">GuiMessageVectorCtrl</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> more details on how this is used." " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiUtil\n</a>" )

DefineEngineMethod(MessageVector , clear , void , () , "Clear all messages in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "HudMessageVector.clear();\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" )

DefineEngineMethod(MessageVector , deleteLine , bool , (S32 deletePos) , "Delete the line at the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n\n</a>" "@param deletePos Position in the vector containing the line <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">deleted\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Delete the first line (index 0) in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector...\n</a>" "HudMessageVector.deleteLine(0);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@return False <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> deletePos is greater than the number of lines in the current vector" )

DefineEngineMethod(MessageVector , dump , void , (const char *filename, const char *header) , ("") , "(string filename, string header=<a href="/coding/file/typesx86unix_8h/#typesx86unix_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)" "Dump the message vector <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> file, optionally prefixing <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> header." " @hide" )

DefineEngineMethod(MessageVector , getLineIndexByTag , S32 , (S32 tag) , "Scan through the vector, returning the line number of the first line that matches the specified tag;else returns -1 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> no match was <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n\n</a>" " @param tag Numerical <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> assigned <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> message when it was added or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">inserted\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Locate <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> line of text tagged with the <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> \"1\" , then delete <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">it.\n</a>" "% taggedLine, other wise -1" )

DefineEngineMethod(MessageVector , getLineTag , S32 , (S32 pos) , "Get the tag of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">line.\n\n</a>" "@param pos Position in vector <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> grab tag <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">from\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Remove all lines that do not have <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> tag <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> of 1.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a>( HudMessageVector.getNumLines())\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   %tag = HudMessageVector.getLineTag(1);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a>(%tag != 1)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "      %tag.delete();\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   HudMessageVector.popFrontLine();\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "}\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@return Tag <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> given line, <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the position is greater than the number of lines return 0" )

DefineEngineMethod(MessageVector , getLineText , const char * , (S32 pos) , "Get the text at <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">line.\n\n</a>" "@param pos Position in vector <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> grab text <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">from\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Print <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> line of text at position 1.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "% text, <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the position is greater than the number of lines return \"\"" )

DefineEngineMethod(MessageVector , getLineTextByTag , const char * , (S32 tag) , "Scan through the lines in the vector, returning the first line that has <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> matching <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tag.\n\n</a>" " @param tag Numerical <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> assigned <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> message when it was added or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">inserted\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Locate text in the vector tagged with the <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> \"1\" , then print <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">it\n</a>" "% taggedText, other wise \"\"" )

DefineEngineMethod(MessageVector , getNumLines , S32 , () )

DefineEngineMethod(MessageVector , insertLine , bool , (S32 insertPos, const char *msg, S32 tag) , "Push <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> line onto the back of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">list.\n\n</a>" "@param msg Text that makes up the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">message\n</a>" "@param tag Numerical <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> associated with this message, useful <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">searching.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Add the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">message...\n</a>" "HudMessageVector.insertLine(1, \"Hello World\", 0);\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@return False <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> insertPos is greater than the number of lines in the current vector" )

DefineEngineMethod(MessageVector , popBackLine , bool , () , "Pop <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> line from the back of the list; destroys the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">line.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "HudMessageVector. popBackLine, true otherwise" )

DefineEngineMethod(MessageVector , popFrontLine , bool , () , "Pop <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> line from the front of the vector, destroying the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">line.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "HudMessageVector. popFrontLine, true otherwise" )

DefineEngineMethod(MessageVector , pushBackLine , void , (const char *msg, S32 tag) , "Push <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> line onto the back of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">list.\n\n</a>" "@param msg Text that makes up the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">message\n</a>" "@param tag Numerical <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> associated with this message, useful <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">searching.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Add the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">message...\n</a>" "HudMessageVector.pushBackLine(\"Hello World\", 0);\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" )

DefineEngineMethod(MessageVector , pushFrontLine , void , (const char *msg, S32 tag) , "Push <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> line onto the front of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">vector.\n\n</a>" "@param msg Text that makes up the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">message\n</a>" "@param tag Numerical <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> associated with this message, useful <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">searching.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Add the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">message...\n</a>" "HudMessageVector.pushFrontLine(\"Hello World\", 0);\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" )

IMPLEMENT_CONOBJECT(MessageVector )

  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2012 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24#include "gui/utility/messageVector.h"
 25#include "core/fileObject.h"
 26#include "console/engineAPI.h"
 27
 28IMPLEMENT_CONOBJECT(MessageVector);
 29
 30ConsoleDocClass( MessageVector,
 31   "@brief Store a list of chat messages.\n\n"
 32
 33   "This is responsible for managing messages which appear in the chat HUD, not the actual control rendered to the screen\n\n"
 34   
 35   "@tsexample\n"
 36   "// Declare ChatHud, which is what will display the actual chat from a MessageVector\n"
 37   "new GuiMessageVectorCtrl(ChatHud) {\n"
 38    "   profile = \"ChatHudMessageProfile\";\n"
 39    "   horizSizing = \"width\";\n"
 40    "   vertSizing = \"height\";\n"
 41    "   position = \"1 1\";\n"
 42    "   extent = \"252 16\";\n"
 43    "   minExtent = \"8 8\";\n"
 44    "   visible = \"1\";\n"
 45    "   helpTag = \"0\";\n"
 46    "   lineSpacing = \"0\";\n"
 47    "   lineContinuedIndex = \"10\";\n"
 48    "   matchColor = \"0 0 255 255\";\n"
 49    "   maxColorIndex = \"5\";\n"
 50    "};\n\n"
 51   "// All messages are stored in this HudMessageVector, the actual\n"
 52   "// MainChatHud only displays the contents of this vector.\n"
 53   "new MessageVector(HudMessageVector);\n\n"
 54   "// Attach the MessageVector to the chat control\n"
 55   "chatHud.attach(HudMessageVector);\n"
 56   "@endtsexample\n\n"
 57
 58   "@see GuiMessageVectorCtrl for more details on how this is used."
 59
 60   "@ingroup GuiUtil\n"
 61);
 62
 63DefineEngineMethod( MessageVector, clear, void, (),,
 64   "Clear all messages in the vector\n\n"
 65   "@tsexample\n"
 66   "HudMessageVector.clear();\n"
 67   "@endtsexample\n\n")
 68{
 69   object->clear();
 70}
 71
 72//ConsoleMethod( MessageVector, clear, void, 2, 2, "Clear the message vector.")
 73//{
 74//   object->clear();
 75//}
 76
 77DefineEngineMethod( MessageVector, pushBackLine, void, ( const char* msg, S32 tag ),,
 78   "Push a line onto the back of the list.\n\n"
 79   "@param msg Text that makes up the message\n"
 80   "@param tag Numerical value associated with this message, useful for searching.\n\n"
 81   "@tsexample\n"
 82   "// Add the message...\n"
 83   "HudMessageVector.pushBackLine(\"Hello World\", 0);\n"
 84   "@endtsexample\n\n")
 85{
 86   object->pushBackLine(msg, tag);
 87}
 88
 89//ConsoleMethod( MessageVector, pushBackLine, void, 3, 4, "(string msg, int tag=0)"
 90//              "Push a line onto the back of the list.")
 91//{
 92//   U32 tag = 0;
 93//   if (argc == 4)
 94//      tag = dAtoi(argv[3]);
 95//
 96//   object->pushBackLine(argv[2], tag);
 97//}
 98
 99DefineEngineMethod( MessageVector, popBackLine, bool, (),,
100   "Pop a line from the back of the list; destroys the line.\n\n"
101   "@tsexample\n"
102   "HudMessageVector.popBackLine();\n"
103   "@endtsexample\n\n"
104   "@return False if there are no lines to pop (underflow), true otherwise")
105{
106   if (object->getNumLines() == 0) {
107      Con::errorf(ConsoleLogEntry::General, "MessageVector::popBackLine(): underflow");
108      return false;
109   }
110
111   object->popBackLine();
112   return true;
113}
114
115//ConsoleMethod( MessageVector, popBackLine, bool, 2, 2, "()"
116//              "Pop a line from the back of the list; destroys the line.")
117//{
118//   if (object->getNumLines() == 0) {
119//      Con::errorf(ConsoleLogEntry::General, "MessageVector::popBackLine(): underflow");
120//      return false;
121//   }
122//
123//   object->popBackLine();
124//   return true;
125//}
126
127DefineEngineMethod( MessageVector, pushFrontLine, void, ( const char* msg, S32 tag ),,
128   "Push a line onto the front of the vector.\n\n"
129   "@param msg Text that makes up the message\n"
130   "@param tag Numerical value associated with this message, useful for searching.\n\n"
131   "@tsexample\n"
132   "// Add the message...\n"
133   "HudMessageVector.pushFrontLine(\"Hello World\", 0);\n"
134   "@endtsexample\n\n")
135{
136   object->pushFrontLine(msg, tag);
137}
138
139//ConsoleMethod( MessageVector, pushFrontLine, void, 3, 4, "(string msg, int tag=0)"
140//              "Push a line onto the front of the vector.")
141//{
142//   U32 tag = 0;
143//   if (argc == 4)
144//      tag = dAtoi(argv[3]);
145//
146//   object->pushFrontLine(argv[2], tag);
147//}
148
149DefineEngineMethod( MessageVector, popFrontLine, bool, (),,
150   "Pop a line from the front of the vector, destroying the line.\n\n"
151   "@tsexample\n"
152   "HudMessageVector.popFrontLine();\n"
153   "@endtsexample\n\n"
154   "@return False if there are no lines to pop (underflow), true otherwise")
155{
156   if (object->getNumLines() == 0) {
157      Con::errorf(ConsoleLogEntry::General, "MessageVector::popFrontLine(): underflow");
158      return false;
159   }
160
161   object->popFrontLine();
162   return true;
163}
164
165//ConsoleMethod( MessageVector, popFrontLine, bool, 2, 2,
166//              "Pop a line from the front of the vector, destroying the line.")
167//{
168//   if (object->getNumLines() == 0) {
169//      Con::errorf(ConsoleLogEntry::General, "MessageVector::popFrontLine(): underflow");
170//      return false;
171//   }
172//
173//   object->popFrontLine();
174//   return true;
175//}
176
177DefineEngineMethod( MessageVector, insertLine, bool, ( S32 insertPos, const char* msg, S32 tag ),,
178   "Push a line onto the back of the list.\n\n"
179   "@param msg Text that makes up the message\n"
180   "@param tag Numerical value associated with this message, useful for searching.\n\n"
181   "@tsexample\n"
182   "// Add the message...\n"
183   "HudMessageVector.insertLine(1, \"Hello World\", 0);\n"
184   "@endtsexample\n\n"
185   "@return False if insertPos is greater than the number of lines in the current vector")
186{
187   if (insertPos > object->getNumLines())
188      return false;
189
190   object->insertLine(insertPos, msg, tag);
191   return true;
192}
193
194//ConsoleMethod( MessageVector, insertLine, bool, 4, 5, "(int insertPos, string msg, int tag=0)"
195//              "Insert a new line into the vector at the specified position.")
196//{
197//   U32 pos = U32(dAtoi(argv[2]));
198//   if (pos > object->getNumLines())
199//      return false;
200//
201//   S32 tag = 0;
202//   if (argc == 5)
203//      tag = dAtoi(argv[4]);
204//
205//   object->insertLine(pos, argv[3], tag);
206//   return true;
207//}
208
209DefineEngineMethod( MessageVector, deleteLine, bool, ( S32 deletePos),,
210   "Delete the line at the specified position.\n\n"
211   "@param deletePos Position in the vector containing the line to be deleted\n"
212   "@tsexample\n"
213   "// Delete the first line (index 0) in the vector...\n"
214   "HudMessageVector.deleteLine(0);\n"
215   "@endtsexample\n\n"
216   "@return False if deletePos is greater than the number of lines in the current vector")
217{
218   if (deletePos >= object->getNumLines())
219      return false;
220
221   object->deleteLine(deletePos);
222   return true;
223}
224
225//ConsoleMethod( MessageVector, deleteLine, bool, 3, 3, "(int deletePos)"
226//               "Delete the line at the specified position.")
227//{
228//   U32 pos = U32(dAtoi(argv[2]));
229//   if (pos >= object->getNumLines())
230//      return false;
231//
232//   object->deleteLine(pos);
233//   return true;
234//}
235static ConsoleDocFragment _MessageVectordump1(
236   "@brief Dump the message vector to a file without a header.\n\n"
237   
238   "@param filename Name and path of file to dump text to.\n"
239   
240   "@tsexample\n"
241   "// Dump the entire chat log to a text file\n"
242   "HudMessageVector.dump(\"./chatLog.txt\");\n"
243   "@endtsexample\n\n\n",
244   "MessageVector",
245   "void dump( string filename);");
246
247static ConsoleDocFragment _MessageVectordump2(
248   "@brief Dump the message vector to a file with a header.\n\n"
249   
250   "@param filename Name and path of file to dump text to.\n"
251   "@param header Prefix information for write out\n\n"
252   
253   "@tsexample\n"
254   "// Arbitrary header data\n"
255   "%headerInfo = \"Ars Moriendi Chat Log\";\n\n"
256   "// Dump the entire chat log to a text file\n"
257   "HudMessageVector.dump(\"./chatLog.txt\", %headerInfo);\n"
258   "@endtsexample\n\n\n",
259   "MessageVector",
260   "void dump( string filename, string header);");
261
262DefineEngineMethod( MessageVector, dump, void, (const char * filename, const char * header), (""), "(string filename, string header=NULL)"
263              "Dump the message vector to a file, optionally prefixing a header."
264           "@hide")
265{
266
267   object->dump( filename, header );
268}
269
270DefineEngineMethod( MessageVector, getNumLines, S32, (),,
271   "Get the number of lines in the vector.\n\n"
272   "@tsexample\n"
273   "// Find out how many lines have been stored in HudMessageVector\n"
274   "%chatLines = HudMessageVector.getNumLines();\n"
275   "echo(%chatLines);\n"
276   "@endtsexample\n\n")
277{
278   return object->getNumLines();
279}
280
281//ConsoleMethod( MessageVector, getNumLines, S32, 2, 2, "Get the number of lines in the vector.")
282//{
283//   return object->getNumLines();
284//}
285
286DefineEngineMethod( MessageVector, getLineTextByTag, const char*, ( S32 tag),,
287   "Scan through the lines in the vector, returning the first line that has a matching tag.\n\n"
288   "@param tag Numerical value assigned to a message when it was added or inserted\n"
289   "@tsexample\n"
290   "// Locate text in the vector tagged with the value \"1\", then print it\n"
291   "%taggedText = HudMessageVector.getLineTextByTag(1);\n"
292   "echo(%taggedText);\n"
293   "@endtsexample\n\n"
294   "@return Text from a line with matching tag, other wise \"\"")
295{
296   for(U32 i = 0; i < object->getNumLines(); i++)
297      if(object->getLine(i).messageTag == tag)
298         return object->getLine(i).message;
299   return "";
300}
301
302//ConsoleMethod( MessageVector, getLineTextByTag, const char*, 3, 3, "(int tag)"
303//              "Scan through the lines in the vector, returning the first line that has a matching tag.")
304//{
305//   U32 tag = dAtoi(argv[2]);
306//
307//   for(U32 i = 0; i < object->getNumLines(); i++)
308//      if(object->getLine(i).messageTag == tag)
309//         return object->getLine(i).message;
310//   return "";
311//}
312
313DefineEngineMethod( MessageVector, getLineIndexByTag, S32, ( S32 tag),,
314   "Scan through the vector, returning the line number of the first line that matches the specified tag; else returns -1 if no match was found.\n\n"
315   "@param tag Numerical value assigned to a message when it was added or inserted\n"
316   "@tsexample\n"
317   "// Locate a line of text tagged with the value \"1\", then delete it.\n"
318   "%taggedLine = HudMessageVector.getLineIndexByTag(1);\n"
319   "HudMessageVector.deleteLine(%taggedLine);\n"
320   "@endtsexample\n\n"
321   "@return Line with matching tag, other wise -1")
322{
323   for(U32 i = 0; i < object->getNumLines(); i++)
324      if(object->getLine(i).messageTag == tag)
325         return i;
326   return -1;
327}
328
329//ConsoleMethod( MessageVector, getLineIndexByTag, S32, 3, 3, "(int tag)"
330//              "Scan through the vector, returning the line number of the first line that matches the specified tag; else returns -1 if no match was found.")
331//{
332//   U32 tag = dAtoi(argv[2]);
333//
334//   for(U32 i = 0; i < object->getNumLines(); i++)
335//      if(object->getLine(i).messageTag == tag)
336//         return i;
337//   return -1;
338//}
339
340DefineEngineMethod( MessageVector, getLineText, const char*, ( S32 pos),,
341   "Get the text at a specified line.\n\n"
342   "@param pos Position in vector to grab text from\n"
343   "@tsexample\n"
344   "// Print a line of text at position 1.\n"
345   "%text = HudMessageVector.getLineText(1);\n"
346   "echo(%text);\n"
347   "@endtsexample\n\n"
348   "@return Text at specified line, if the position is greater than the number of lines return \"\"")
349{
350   if (pos >= object->getNumLines()) {
351      Con::errorf(ConsoleLogEntry::General, "MessageVector::getLineText(con): out of bounds line");
352      return "";
353   }
354
355   return object->getLine(pos).message;
356}
357
358//ConsoleMethod( MessageVector, getLineText, const char*, 3, 3, "(int line)"
359//              "Get the text at a specified line.")
360//{
361//   U32 pos = U32(dAtoi(argv[2]));
362//   if (pos >= object->getNumLines()) {
363//      Con::errorf(ConsoleLogEntry::General, "MessageVector::getLineText(con): out of bounds line");
364//      return "";
365//   }
366//
367//   return object->getLine(pos).message;
368//}
369
370DefineEngineMethod( MessageVector, getLineTag, S32, ( S32 pos),,
371   "Get the tag of a specified line.\n\n"
372   "@param pos Position in vector to grab tag from\n"
373   "@tsexample\n"
374   "// Remove all lines that do not have a tag value of 1.\n"
375   "while( HudMessageVector.getNumLines())\n"
376   "{\n"
377   "   %tag = HudMessageVector.getLineTag(1);\n"
378   "   if(%tag != 1)\n"
379   "      %tag.delete();\n"
380   "   HudMessageVector.popFrontLine();\n"
381   "}\n"
382   "@endtsexample\n\n"
383   "@return Tag value of a given line, if the position is greater than the number of lines return 0")
384{
385   if (pos >= object->getNumLines()) {
386      Con::errorf(ConsoleLogEntry::General, "MessageVector::getLineTag(con): out of bounds line");
387      return 0;
388   }
389
390   return object->getLine(pos).messageTag;
391}
392
393//ConsoleMethod( MessageVector, getLineTag, S32, 3, 3, "(int line)"
394//              "Get the tag of a specified line.")
395//{
396//   U32 pos = U32(dAtoi(argv[2]));
397//   if (pos >= object->getNumLines()) {
398//      Con::errorf(ConsoleLogEntry::General, "MessageVector::getLineTag(con): out of bounds line");
399//      return 0;
400//   }
401//
402//   return object->getLine(pos).messageTag;
403//}
404
405//--------------------------------------------------------------------------
406MessageVector::MessageVector()
407{
408   VECTOR_SET_ASSOCIATION(mMessageLines);
409   VECTOR_SET_ASSOCIATION(mSpectators);
410}
411
412
413//--------------------------------------------------------------------------
414MessageVector::~MessageVector()
415{
416   for (U32 i = 0; i < mMessageLines.size(); i++) {
417      char* pDelete = const_cast<char*>(mMessageLines[i].message);
418      delete [] pDelete;
419      mMessageLines[i].message = 0;
420      mMessageLines[i].messageTag = 0xFFFFFFFF;
421   }
422   mMessageLines.clear();
423}
424
425
426//--------------------------------------------------------------------------
427void MessageVector::initPersistFields()
428{
429   Parent::initPersistFields();
430}
431
432
433
434//--------------------------------------------------------------------------
435bool MessageVector::onAdd()
436{
437   return Parent::onAdd();
438}
439
440
441//--------------------------------------------------------------------------
442void MessageVector::onRemove()
443{
444   // Delete all the lines from the observers, and then forcibly detatch ourselves
445   //
446   for (S32 i = mMessageLines.size() - 1; i >= 0; i--)
447      spectatorMessage(LineDeleted, i);
448   spectatorMessage(VectorDeletion, 0);
449   mSpectators.clear();
450
451   Parent::onRemove();
452}
453
454
455//--------------------------------------------------------------------------
456void MessageVector::pushBackLine(const char* newMessage, const S32 newMessageTag)
457{
458   insertLine(mMessageLines.size(), newMessage, newMessageTag);
459}
460
461
462void MessageVector::popBackLine()
463{
464   AssertFatal(mMessageLines.size() != 0, "MessageVector::popBackLine: nothing to pop!");
465   if (mMessageLines.size() == 0)
466      return;
467
468   deleteLine(mMessageLines.size() - 1);
469}
470
471void MessageVector::clear()
472{
473   while(mMessageLines.size())
474      deleteLine(mMessageLines.size() - 1);
475}
476
477//--------------------------------------------------------------------------
478void MessageVector::pushFrontLine(const char* newMessage, const S32 newMessageTag)
479{
480   insertLine(0, newMessage, newMessageTag);
481}
482
483
484void MessageVector::popFrontLine()
485{
486   AssertFatal(mMessageLines.size() != 0, "MessageVector::popBackLine: nothing to pop!");
487   if (mMessageLines.size() == 0)
488      return;
489
490   deleteLine(0);
491}
492
493
494//--------------------------------------------------------------------------
495void MessageVector::insertLine(const U32   position,
496                               const char* newMessage,
497                               const S32   newMessageTag)
498{
499   AssertFatal(position >= 0 && position <= mMessageLines.size(), "MessageVector::insertLine: out of range position!");
500   AssertFatal(newMessage != NULL, "Error, no message to insert!");
501
502   U32 len = dStrlen(newMessage) + 1;
503   char* copy = new char[len];
504   dStrcpy(copy, newMessage, len);
505
506   mMessageLines.insert(position);
507   mMessageLines[position].message    = copy;
508   mMessageLines[position].messageTag = newMessageTag;
509
510   // Notify of insert
511   spectatorMessage(LineInserted, position);
512}
513
514
515//--------------------------------------------------------------------------
516void MessageVector::deleteLine(const U32 position)
517{
518   AssertFatal(position >= 0 && position < mMessageLines.size(), "MessageVector::deleteLine: out of range position!");
519
520   char* pDelete = const_cast<char*>(mMessageLines[position].message);
521   delete [] pDelete;
522   mMessageLines[position].message    = NULL;
523   mMessageLines[position].messageTag = 0xFFFFFFFF;
524
525   mMessageLines.erase(position);
526
527   // Notify of delete
528   spectatorMessage(LineDeleted, position);
529}
530
531
532//--------------------------------------------------------------------------
533bool MessageVector::dump( const char* filename, const char* header )
534{
535   Con::printf( "Dumping message vector %s to %s...", getName(), filename );
536   FileObject file;
537   if ( !file.openForWrite( filename ) )
538      return( false );
539
540   // If passed a header line, write it out first:
541   if ( header )
542      file.writeLine( (const U8*) header );
543
544   // First write out the record count:
545   char* lineBuf = (char*) dMalloc( 10 );
546   dSprintf( lineBuf, 10, "%d", mMessageLines.size() );
547   file.writeLine( (const U8*) lineBuf );
548
549   // Write all of the lines of the message vector:
550   U32 len;
551   for ( U32 i = 0; i < mMessageLines.size(); i++ )
552   {
553      len = ( dStrlen( mMessageLines[i].message ) * 2 ) + 10;
554      lineBuf = (char*) dRealloc( lineBuf, len );
555      dSprintf( lineBuf, len, "%d ", mMessageLines[i].messageTag );
556      expandEscape( lineBuf + dStrlen( lineBuf ), mMessageLines[i].message );
557      file.writeLine( (const U8*) lineBuf );
558   }
559
560   file.close();
561   return( true );
562}
563
564
565//--------------------------------------------------------------------------
566void MessageVector::registerSpectator(SpectatorCallback callBack, void *spectatorKey)
567{
568   AssertFatal(callBack != NULL, "Error, must have a callback!");
569
570   // First, make sure that this hasn't been registered already...
571   U32 i;
572   for (i = 0; i < mSpectators.size(); i++) {
573      AssertFatal(mSpectators[i].key != spectatorKey, "Error, spectator key already registered!");
574      if (mSpectators[i].key == spectatorKey)
575         return;
576   }
577
578   mSpectators.increment();
579   SpectatorRef& lastSpectatorRef = mSpectators.last();
580   lastSpectatorRef.callback = callBack;
581   lastSpectatorRef.key = spectatorKey;
582
583   // Need to message this spectator of all the lines currently inserted...
584   for (i = 0; i < mMessageLines.size(); i++) {
585      (*lastSpectatorRef.callback)(lastSpectatorRef.key,
586                                     LineInserted, i);
587   }
588}
589
590void MessageVector::unregisterSpectator(void * spectatorKey)
591{
592   for (U32 i = 0; i < mSpectators.size(); i++) {
593      if (mSpectators[i].key == spectatorKey) {
594         // Need to message this spectator of all the lines currently inserted...
595         for (S32 j = mMessageLines.size() - 1; j >= 0 ; j--) {
596            (*mSpectators[i].callback)(mSpectators[i].key,
597                                       LineDeleted, j);
598         }
599
600         mSpectators.erase(i);
601         return;
602      }
603   }
604
605   AssertFatal(false, "MessageVector::unregisterSpectator: tried to unregister a spectator that isn't subscribed!");
606   Con::errorf(ConsoleLogEntry::General,
607               "MessageVector::unregisterSpectator: tried to unregister a spectator that isn't subscribed!");
608}
609
610void MessageVector::spectatorMessage(MessageCode code, const U32 arg)
611{
612   for (U32 i = 0; i < mSpectators.size(); i++) {
613      (*mSpectators[i].callback)(mSpectators[i].key,
614                                 code, arg);
615   }
616}
617
618