HCE project C++ developers source code library  1.1.1
HCE project developer library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MessagesCollection.cpp
Go to the documentation of this file.
1 #include "MessagesCollection.hpp"
2 
3 namespace HCE
4 {
5 //-----------------------------------------------------------------------------
7 : Messages()
8 {
9 }
10 //-----------------------------------------------------------------------------
11 MessagesCollection::MessagesCollection(const std::vector<MsgItem>& msgItems)
12 : Messages()
13 {
14  set(msgItems);
15 }
16 //-----------------------------------------------------------------------------
18 {
19 }
20 //-----------------------------------------------------------------------------
21 void MessagesCollection::set(const std::vector<MsgItem>& msgItems)
22 {
23  Messages.clear();
24  for (size_t i=0;i<msgItems.size();++i)
25  Messages.insert(MSG_MAP::value_type(msgItems[i]));
26 }
27 //-----------------------------------------------------------------------------
28 std::string MessagesCollection::getMessage(unsigned int type)
29 {
30  std::string message;
31  MSG_MAP::iterator iter = Messages.find(type);
32  if (iter!=Messages.end())
33  message = (*iter).second;
34 
35  return message;
36 }
37 //-----------------------------------------------------------------------------
38 //-----------------------------------------------------------------------------
39 } // end namespace HCE