Files Classes Functions Hierarchy
#include <messagetest.h>
Public Member Functions | |
| void | test01 () |
| Write messages to log error file. | |
| void | test02 () |
| Overloading << with return type message, write messages to log error file. | |
| void | test03 () |
| Overloading << with return type message, write messages to log list of strings. | |
Static Public Attributes | |
| static string | doc [] |
| Brief description of each test. | |
Definition at line 7 of file messagetest.h.
| void messagetest::test01 | ( | ) |
Write messages to log error file.
Definition at line 18 of file messagetest.cpp.
00019 { 00020 cout << "Testing messagefile" << endl; 00021 00022 stringc filename("error.txt"); 00023 cout << "Appending to file " << filename << endl; 00024 cout << "On unix use $tail -f " << filename << " to follow changes" << endl; 00025 00026 00027 messagefile err(filename.c_str(),false); 00028 00029 cout << "Enter text, " << endl; 00030 string quit("quit"); 00031 cout << "To terminate enter " << quit << endl; 00032 char buff[256]; 00033 for (;;) 00034 { 00035 cin.getline(buff,256); 00036 00037 string in(buff); 00038 00039 if (in==quit) 00040 return; 00041 00042 err() << in << endl; 00043 } 00044 }
| void messagetest::test02 | ( | ) |
Overloading << with return type message, write messages to log error file.
Definition at line 48 of file messagetest.cpp.
00049 { 00050 cout << "Testing messagefile with implicit calls." << endl; 00051 00052 stringc filename("error.txt"); 00053 messagefile err(filename); 00054 00055 cout << "Enter text, " << endl; 00056 string quit("quit"); 00057 cout << "To terminate enter " << quit << endl; 00058 char buff[256]; 00059 for (;;) 00060 { 00061 cin.getline(buff,256); 00062 string in(buff); 00063 00064 if (in==quit) 00065 return; 00066 00067 /* (message&)err << in; // << endl; */ 00068 // ((message&)err << in) << endl; 00069 // (message&)err << endl; 00070 // http://www.velocityreviews.com/forums/t279958-stdendl-type-unknown.html 00071 (message&)err << in << endl<char, char_traits<char> >; 00072 } 00073 }
| void messagetest::test03 | ( | ) |
Overloading << with return type message, write messages to log list of strings.
Definition at line 75 of file messagetest.cpp.
References SHOW, and messagelist::vi.
00076 { 00077 messagelist err; 00078 00079 cout << "Adding some inapropriate message" << endl; 00080 (message&)err << "a" << "love" << "boat" << "at" << "work"; 00081 00082 cout << "Enter text, " << endl; 00083 string quit("quit"); 00084 cout << "To terminate enter " << quit << endl; 00085 char buff[256]; 00086 for (;;) 00087 { 00088 cin.getline(buff,256); 00089 string in(buff); 00090 00091 if (in==quit) 00092 break; 00093 00094 (message&)err << in; // << "a" << "cat" << "b"; //endl<char, char_traits<char> >; 00095 } 00096 00097 cout << SHOW(err.vi.size()) << endl; 00098 for (uint i=0; i<err.vi.size(); ++i) 00099 cout << "*" << err.vi[i] << "*" << endl; 00100 00101 }
string messagetest::doc [static] |
Initial value:
{
"",
"Write messages to log error file.",
"Overloading << with return type message, write messages to log error file.",
"Overloading << with return type message, write messages to log list of strings."
}
Definition at line 12 of file messagetest.h.
Referenced by main().
1.5.8