9 #include "StMessTypeList.h"
10 #include "StMessageStream.h"
13 StMessTypePair::StMessTypePair(
const char* ty,
const char* te) :
16 StMessTypePair::~StMessTypePair() {}
21 StMessTypeList::StMessTypeList() : messList() {
24 StMessTypeList::~StMessTypeList() {
25 for (
size_t i=0; i<messList.size(); i++)
36 int StMessTypeList::AddType(
const char* type,
const char* text) {
40 *(
const_cast<char*
> (type)) = toupper(*type);
43 messList.push_back(temp);
44 return messList.size();
47 int StMessTypeList::FindTypeNum(
const char* type) {
48 StMessTypeVecIter iter;
49 char ty=toupper(*type);
51 for (iter=messList.begin(); iter!=messList.end(); iter++) {
53 if (*((*iter)->Type())==ty) {
return j;}
59 StMessTypeVecIter iter;
60 char ty=toupper(*type);
61 for (iter=messList.begin(); iter!=messList.end(); iter++) {
62 if (*((*iter)->Type())==ty) {
return (*iter);}
67 const char* StMessTypeList::FindNumType(
size_t typeNum) {
68 if ((typeNum < 1) || (typeNum > messList.size()))
return 0;
69 return messList[(typeNum - 1)]->Type();
72 const char* StMessTypeList::FindNumText(
size_t typeNum) {
73 if ((typeNum < 1) || (typeNum > messList.size()))
return 0;
74 return messList[(typeNum - 1)]->Text();
77 int StMessTypeList::ListTypes() {
78 StMessTypeVecIter iter;
79 myout <<
"List of StMessage types:\n"
80 <<
"--------------------------------------------------------"
82 for (iter=messList.begin(); iter!=messList.end(); iter++) {
84 myout <<
" " << current->Type() <<
" : " << current->Text() << endl;
86 return messList.size();